Graphics processing unit (GPU)
A GPUDevice
object represents a graphic processing
unit (GPU) in your computer. You can use the GPU to execute CUDA kernels
or MATLAB code.
The following functions let you identify, select, reset, or wait for a GPU device:
gpuDevice | Query or select GPU device |
gpuDeviceCount | Number of GPU devices present |
reset | Reset GPU device and clear its memory |
wait (GPUDevice) | Wait for GPU calculation to complete |
Methods of the class include the following:
Method Name | Description |
---|---|
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
A GPUDevice
object has the following read-only
properties:
Property Name | Description | |||
---|---|---|---|---|
Name | Name of the CUDA device. | |||
Index | Index by which you can select the device. | |||
ComputeCapability | Computational capability of the CUDA device. Must meet required specification. | |||
SupportsDouble | Indicates if this device can support double precision operations. | |||
DriverVersion | The CUDA device driver version currently in use. Must meet required specification. | |||
ToolkitVersion | Version of the CUDA toolkit used by the current release of MATLAB. | |||
MaxThreadsPerBlock | Maximum supported number of threads per block during CUDAKernel execution. | |||
MaxShmemPerBlock | Maximum supported amount of shared memory that can be used by a thread block during CUDAKernel execution. | |||
MaxThreadBlockSize | Maximum 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 . | |||
MaxGridSize | Maximum size of grid of thread blocks. | |||
SIMDWidth | Number of simultaneously executing threads. | |||
TotalMemory | Total memory (in bytes) on the device. | |||
AvailableMemory | Total amount of memory (in bytes) available for data. This property is available only for the currently selected device. | |||
MultiprocessorCount | The number of vector processors present on the device. | |||
ClockRateKHz | Peak clock rate of the GPU in kHz. | |||
ComputeMode | The compute mode of the device, according to the following
values:
| |||
GPUOverlapsTransfers | Indicates if the device supports overlapped transfers. | |||
KernelExecutionTimeout | Indicates 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. | |||
CanMapHostMemory | Indicates if the device supports mapping host memory into the CUDA address space. | |||
DeviceSupported | Indicates if toolbox can use this device. Not all devices are
supported; for example, if their ComputeCapability is
insufficient, the toolbox cannot use them. | |||
DeviceSelected | Indicates if this is the currently selected device. |