Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Constructors

constructor

  • new Device(deviceId?: number, flags?: DeviceFlags): Device

Properties

Readonly id

id: number

The CUDA device identifer

Readonly pciBusName

pciBusName: string

The CUDA device PCI bus string id

Accessors

name

  • get name(): string

pciBusId

  • get pciBusId(): number

Static activeDeviceId

  • get activeDeviceId(): number

Static numDevices

  • get numDevices(): number

Methods

activate

  • summary

    Set this device to be used for GPU executions.

    description

    Sets this device as the current device for the calling host thread.

    Any device memory subsequently allocated from this host thread will be physically resident on this device. Any host memory allocated from this host thread will have its lifetime associated with this device. Any streams or events created from this host thread will be associated with this device. Any kernels launched from this host thread will be executed on this device.

    This call may be made from any host thread, to any device, and at any time. This function will do no synchronization with the previous or new device, and should be considered a very low overhead call.

    Returns Device

callInContext

  • callInContext(work: () => any): Device
  • summary

    Ensures this device is active, then executes the supplied work function.

    If the current device was not already the active device, restores the active device after the work function has completed.

    Parameters

    • work: () => any

      A function to execute

        • (): any
        • Returns any

    Returns Device

canAccessPeerDevice

  • canAccessPeerDevice(peerDevice: Device): boolean
  • summary

    Queries if a device may directly access a peer device's memory.

    If direct access of peerDevice from this device is possible, then access may be enabled on two specific devices by calling enablePeerAccess.

    Parameters

    • peerDevice: Device

    Returns boolean

    true if this Device's contexts are capable of directly accessing memory from contexts on peerDevice, otherwise false.

disablePeerAccess

  • disablePeerAccess(peerDevice: Device): Device
  • summary

    Disables direct access to memory allocations in a peer device and unregisters any registered allocations.

    Parameters

    • peerDevice: Device

    Returns Device

enablePeerAccess

  • enablePeerAccess(peerDevice: Device): Device
  • summary

    Enables direct access to memory allocations in a peer device.

    Parameters

    • peerDevice: Device

    Returns Device

getFlags

  • getFlags(): DeviceFlags
  • summary

    Get the {@link DeviceFlag_ device flags} used to initialize this device.

    Returns DeviceFlags

getProperties

  • getProperties(): DeviceProperties
  • summary

    An object with information about the device.

    Returns DeviceProperties

reset

  • summary

    Destroy all allocations and reset all state on the current device in the current process.

    description

    Explicitly destroys and cleans up all resources associated with the current device in the current process. Any subsequent API call to this device will reinitialize the device.

    Note that this function will reset the device immediately. It is the caller's responsibility to ensure that the device is not being accessed by any other host threads from the process when this function is called.

    Returns Device

setFlags

  • setFlags(newFlags: DeviceFlags): void
  • summary

    Set the {@link DeviceFlag device flags} for the device's primary context.

    Parameters

    • newFlags: DeviceFlags

      The new flags for the device's primary context.

    Returns void

synchronize

  • summary

    Wait for this compute device to finish.

    description

    Blocks execution of further device calls until the device has completed all preceding requested tasks.

    throws

    an error if one of the preceding tasks has failed. If the cudaDeviceScheduleBlockingSync flag was set for this device, the host thread will block until the device has finished its work.

    Returns Device