Class DriverAPINativeMethods.DeviceManagement
Combines all API calls for device management
Inheritance
Inherited Members
Namespace: ManagedCuda
Assembly: ManagedCuda.dll
Syntax
public static class DeviceManagement
Methods
cuDeviceComputeCapability(ref Int32, ref Int32, CUdevice)
Returns in major and minor the major and minor revision numbers that define the compute capability of the
device dev.
Declaration
[Obsolete("Don't use this CUDA API call with CUDA version >= 5.0.")]
public static CUResult cuDeviceComputeCapability(ref int major, ref int minor, CUdevice dev)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | major | Major revision number |
| System.Int32 | minor | Minor revision number |
| CUdevice | dev | Device handle |
Returns
| Type | Description |
|---|---|
| CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized,
ErrorInvalidContext, ErrorInvalidValue, ErrorInvalidDevice.
|
cuDeviceGet(ref CUdevice, Int32)
Returns in device a device handle given an ordinal in the range [0, cuDeviceGetCount(ref Int32)-1].
Declaration
public static CUResult cuDeviceGet(ref CUdevice device, int ordinal)
Parameters
| Type | Name | Description |
|---|---|---|
| CUdevice | device | Returned device handle |
| System.Int32 | ordinal | Device number to get handle for |
Returns
| Type | Description |
|---|---|
| CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized,
ErrorInvalidContext, ErrorInvalidValue, ErrorInvalidDevice.
|
cuDeviceGetAttribute(ref Int32, CUDeviceAttribute, CUdevice)
Returns in pi the integer value of the attribute attrib on device dev. See CUDeviceAttribute.
Declaration
public static CUResult cuDeviceGetAttribute(ref int pi, CUDeviceAttribute attrib, CUdevice dev)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | pi | Returned device attribute value |
| CUDeviceAttribute | attrib | Device attribute to query |
| CUdevice | dev | Device handle |
Returns
| Type | Description |
|---|---|
| CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized,
ErrorInvalidContext, ErrorInvalidValue, ErrorInvalidDevice.
|
cuDeviceGetByPCIBusId(ref CUdevice, Byte[])
Returns in device a device handle given a PCI bus ID string.
Declaration
public static CUResult cuDeviceGetByPCIBusId(ref CUdevice dev, byte[] pciBusId)
Parameters
| Type | Name | Description |
|---|---|---|
| CUdevice | dev | Returned device handle |
| System.Byte[] | pciBusId | String in one of the following forms: [domain]:[bus]:[device].[function] [domain]:[bus]:[device] [bus]:[device].[function] where domain, bus, device, and function are all hexadecimal values |
Returns
| Type | Description |
|---|---|
| CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized, ErrorInvalidValue, ErrorInvalidDevice. |
cuDeviceGetCount(ref Int32)
Returns in count the number of devices with compute capability greater than or equal to 2.0 that are available for
execution. If there is no such device, cuDeviceGetCount(ref Int32) returns 0.
Declaration
public static CUResult cuDeviceGetCount(ref int count)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | count | Returned number of compute-capable devices |
Returns
| Type | Description |
|---|---|
| CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized,
ErrorInvalidContext, ErrorInvalidValue.
|
cuDeviceGetName(Byte[], Int32, CUdevice)
Returns an ASCII string identifying the device dev in the NULL-terminated string pointed to by name. len specifies
the maximum length of the string that may be returned.
Declaration
public static CUResult cuDeviceGetName(byte[] name, int len, CUdevice dev)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | name | Returned identifier string for the device |
| System.Int32 | len | Maximum length of string to store in |
| CUdevice | dev | Device to get identifier string for |
Returns
| Type | Description |
|---|---|
| CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized,
ErrorInvalidContext, ErrorInvalidValue, ErrorInvalidDevice.
|
cuDeviceGetPCIBusId(Byte[], Int32, CUdevice)
Returns an ASCII string identifying the device dev in the NULL-terminated
string pointed to by pciBusId. len specifies the maximum length of the
string that may be returned.
Declaration
public static CUResult cuDeviceGetPCIBusId(byte[] pciBusId, int len, CUdevice dev)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | pciBusId | Returned identifier string for the device in the following format [domain]:[bus]:[device].[function] where domain, bus, device, and function are all hexadecimal values. pciBusId should be large enough to store 13 characters including the NULL-terminator. |
| System.Int32 | len | Maximum length of string to store in |
| CUdevice | dev | Device to get identifier string for |
Returns
| Type | Description |
|---|---|
| CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized, ErrorInvalidValue, ErrorInvalidDevice. |
cuDeviceGetProperties(ref CUDeviceProperties, CUdevice)
Returns in prop the (basic) properties of device dev. See CUDeviceProperties.
Declaration
[Obsolete("Don't use this CUDA API call with CUDA version >= 5.0.")]
public static CUResult cuDeviceGetProperties(ref CUDeviceProperties prop, CUdevice dev)
Parameters
| Type | Name | Description |
|---|---|---|
| CUDeviceProperties | prop | Returned properties of device |
| CUdevice | dev | Device to get properties for |
Returns
| Type | Description |
|---|---|
| CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized,
ErrorInvalidContext, ErrorInvalidValue, ErrorInvalidDevice.
|
cuDeviceTotalMem_v2(ref SizeT, CUdevice)
Returns in bytes the total amount of memory available on the device dev in bytes.
Declaration
public static CUResult cuDeviceTotalMem_v2(ref SizeT bytes, CUdevice dev)
Parameters
| Type | Name | Description |
|---|---|---|
| SizeT | bytes | Returned memory available on device in bytes |
| CUdevice | dev | Device handle |
Returns
| Type | Description |
|---|---|
| CUResult | CUDA Error Codes: Success, ErrorDeinitialized, ErrorNotInitialized,
ErrorInvalidContext, ErrorInvalidValue, ErrorInvalidDevice.
|
cuIpcCloseMemHandle(CUdeviceptr)
Unmaps memory returnd by ::cuIpcOpenMemHandle. The original allocation in the exporting process as well as imported mappings in other processes will be unaffected.
Any resources used to enable peer access will be freed if this is the last mapping using them.
IPC functionality is restricted to devices with support for unified addressing on Linux operating systems.
Declaration
public static CUResult cuIpcCloseMemHandle(CUdeviceptr dptr)
Parameters
| Type | Name | Description |
|---|---|---|
| CUdeviceptr | dptr | Device pointer returned by ::cuIpcOpenMemHandle |
Returns
| Type | Description |
|---|---|
| CUResult | CUDA Error Codes: Success, ErrorInvalidHandle, ErrorInvalidContext, ErrorMapFailed |
cuIpcGetEventHandle(ref CUipcEventHandle, CUevent)
Takes as input a previously allocated event. This event must have been created with the ::CU_EVENT_INTERPROCESS and ::CU_EVENT_DISABLE_TIMING flags set. This opaque handle may be copied into other processes and opened with ::cuIpcOpenEventHandle to allow efficient hardware synchronization between GPU work in different processes.
After the event has been been opened in the importing process, ::cuEventRecord, ::cuEventSynchronize, ::cuStreamWaitEvent and ::cuEventQuery may be used in either process. Performing operations on the imported event after the exported event has been freed with ::cuEventDestroy will result in undefined behavior.
IPC functionality is restricted to devices with support for unified addressing on Linux operating systems.
Declaration
public static CUResult cuIpcGetEventHandle(ref CUipcEventHandle pHandle, CUevent cuevent)
Parameters
| Type | Name | Description |
|---|---|---|
| CUipcEventHandle | pHandle | Pointer to a user allocated CUipcEventHandle in which to return the opaque event handle |
| CUevent | cuevent | Event allocated with ::CU_EVENT_INTERPROCESS and ::CU_EVENT_DISABLE_TIMING flags. |
Returns
| Type | Description |
|---|---|
| CUResult | CUDA Error Codes: Success, ErrorInvalidHandle, ErrorOutOfMemory, ErrorMapFailed |
cuIpcGetMemHandle(ref CUipcMemHandle, CUdeviceptr)
Takes a pointer to the base of an existing device memory allocation created with ::cuMemAlloc and exports it for use in another process. This is a lightweight operation and may be called multiple times on an allocation without adverse effects.
If a region of memory is freed with ::cuMemFree and a subsequent call to ::cuMemAlloc returns memory with the same device address, ::cuIpcGetMemHandle will return a unique handle for the new memory.
IPC functionality is restricted to devices with support for unified addressing on Linux operating systems.
Declaration
public static CUResult cuIpcGetMemHandle(ref CUipcMemHandle pHandle, CUdeviceptr dptr)
Parameters
| Type | Name | Description |
|---|---|---|
| CUipcMemHandle | pHandle | Pointer to user allocated ::CUipcMemHandle to return the handle in. |
| CUdeviceptr | dptr | Base pointer to previously allocated device memory |
Returns
| Type | Description |
|---|---|
| CUResult | CUDA Error Codes: Success, ErrorInvalidHandle, ErrorOutOfMemory, ErrorMapFailed |
cuIpcOpenEventHandle(ref CUevent, CUipcEventHandle)
Opens an interprocess event handle exported from another process with ::cuIpcGetEventHandle. This function returns a ::CUevent that behaves like a locally created event with the ::CU_EVENT_DISABLE_TIMING flag specified. This event must be freed with ::cuEventDestroy.
Performing operations on the imported event after the exported event has been freed with ::cuEventDestroy will result in undefined behavior.
IPC functionality is restricted to devices with support for unified addressing on Linux operating systems.
Declaration
public static CUResult cuIpcOpenEventHandle(ref CUevent phEvent, CUipcEventHandle handle)
Parameters
| Type | Name | Description |
|---|---|---|
| CUevent | phEvent | Returns the imported event |
| CUipcEventHandle | handle | Interprocess handle to open |
Returns
| Type | Description |
|---|---|
| CUResult | CUDA Error Codes: Success, ErrorInvalidHandle, ErrorInvalidContext, ErrorMapFailed |
cuIpcOpenMemHandle(ref CUdeviceptr, CUipcMemHandle, UInt32)
Maps memory exported from another process with ::cuIpcGetMemHandle into the current device address space. For contexts on different devices ::cuIpcOpenMemHandle can attempt to enable peer access between the devices as if the user called ::cuCtxEnablePeerAccess. This behavior is controlled by the ::CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS flag. ::cuDeviceCanAccessPeer can determine if a mapping is possible.
Contexts that may open ::CUipcMemHandles are restricted in the following way. ::CUipcMemHandles from each ::CUdevice in a given process may only be opened by one ::CUcontext per ::CUdevice per other process.
Memory returned from ::cuIpcOpenMemHandle must be freed with ::cuIpcCloseMemHandle.
Calling ::cuMemFree on an exported memory region before calling ::cuIpcCloseMemHandle in the importing context will result in undefined behavior.
IPC functionality is restricted to devices with support for unified addressing on Linux operating systems.
Declaration
public static CUResult cuIpcOpenMemHandle(ref CUdeviceptr pdptr, CUipcMemHandle handle, uint Flags)
Parameters
| Type | Name | Description |
|---|---|---|
| CUdeviceptr | pdptr | Returned device pointer |
| CUipcMemHandle | handle | ::CUipcMemHandle to open |
| System.UInt32 | Flags | Flags for this operation. Must be specified as ::CU_IPC_MEM_LAZY_ENABLE_PEER_ACCESS |
Returns
| Type | Description |
|---|---|
| CUResult | CUDA Error Codes: Success, ErrorInvalidHandle, ErrorInvalidContext, ErrorMapFailed, ErrorTooManyPeers |