GPUDevice

Graphics processing unit (GPU)

Constructor

gpuDevice

Description

A GPUDevice object represents a graphic processing unit (GPU) in your computer. You can use the GPU to execute CUDA kernels or MATLAB code.

Methods

The following functions let you identify, select, reset, or wait for a GPU device:

gpuDeviceQuery or select GPU device
gpuDeviceCountNumber of GPU devices present
resetReset GPU device and clear its memory
wait (GPUDevice)Wait for GPU calculation to complete

Methods of the class include the following:

Method NameDescription
parallel.gpu.GPUDevice.isAvailable(idx)True if the GPU specified by index idx is supported and capable of being selected. idx can be an integer or a vector of integers; the default index is the current device.
parallel.gpu.GPUDevice.getDevice(idx)Returns a GPUDevice object without selecting it.

For the complete list, use the methods function on the GPUDevice class:

methods('parallel.gpu.GPUDevice')

You can get help on any of the class methods with the command

help parallel.gpu.GPUDevice.methodname

where methodname is the name of the method. For example, to get help on isAvailable, type

help parallel.gpu.GPUDevice.isAvailable

Properties

A GPUDevice object has the following read-only properties:

Property NameDescription
NameName of the CUDA device.
IndexIndex by which you can select the device.
ComputeCapabilityComputational capability of the CUDA device. Must meet required specification.
SupportsDoubleIndicates if this device can support double precision operations.
DriverVersionThe CUDA device driver version currently in use. Must meet required specification.
ToolkitVersionVersion of the CUDA toolkit used by the current release of MATLAB.
MaxThreadsPerBlockMaximum supported number of threads per block during CUDAKernel execution.
MaxShmemPerBlockMaximum supported amount of shared memory that can be used by a thread block during CUDAKernel execution.
MaxThreadBlockSizeMaximum size in each dimension for thread block. Each dimension of a thread block must not exceed these dimensions. Also, the product of the thread block size must not exceed MaxThreadsPerBlock.
MaxGridSizeMaximum size of grid of thread blocks.
SIMDWidthNumber of simultaneously executing threads.
TotalMemoryTotal memory (in bytes) on the device.
AvailableMemoryTotal amount of memory (in bytes) available for data. This property is available only for the currently selected device.
MultiprocessorCountThe number of vector processors present on the device.
ClockRateKHzPeak clock rate of the GPU in kHz.
ComputeModeThe compute mode of the device, according to the following values:
'Default' — The device is not restricted and can be used by multiple applications simultaneously. MATLAB can share the device with other applications, including other MATLAB sessions or workers.
'Exclusive thread' or 'Exclusive process' — The device can be used by only one application at a time. While the device is selected in MATLAB, it cannot be used by other applications, including other MATLAB sessions or workers.
'Prohibited' — The device cannot be used.
GPUOverlapsTransfersIndicates if the device supports overlapped transfers.
KernelExecutionTimeoutIndicates if the device can abort long-running kernels. If true, the operating system places an upper bound on the time allowed for the CUDA kernel to execute, after which the CUDA driver times out the kernel and returns an error.
CanMapHostMemoryIndicates if the device supports mapping host memory into the CUDA address space.
DeviceSupportedIndicates if toolbox can use this device. Not all devices are supported; for example, if their ComputeCapability is insufficient, the toolbox cannot use them.
DeviceSelectedIndicates if this is the currently selected device.

Introduced in R2010b

Was this topic helpful?