Query or select GPU device
D = gpuDevice
D = gpuDevice()
D = gpuDevice(IDX)
gpuDevice([])
D = gpuDevice
or D = gpuDevice()
, if
no device is already selected, selects the default GPU device and returns a
GPUDevice object
representing that device. If a GPU device is already selected, this returns an
object representing that device without clearing it.
D = gpuDevice(
selects the GPU
device specified by index IDX
)IDX
. A warning or error might occur
if the specified GPU device is not supported. This form of the command with a
specified index resets the device and clears its memory (even if this device is
already currently selected, equivalent to reset
); so all workspace
variables representing gpuArray or CUDAKernel variables are now invalid, and you
should clear them from the workspace or redefine them.
gpuDevice([])
, with an empty argument (as opposed to no
argument), deselects the GPU device and clears its memory of gpuArray and
CUDAKernel variables. This leaves no GPU device selected as the current
device.
arrayfun
| feval
| gpuArray
| gpuDeviceCount
| parallel.gpu.CUDAKernel
| reset
| wait (GPUDevice)