User`s guide
9 GPU Computing
9-18
Identify and Select a GPU Device
If you have only one GPU in your computer, that GPU is the default. If you have more
than one GPU device in your computer, you can use the following functions to identify
and select which device you want to use:
Function Description
gpuDeviceCount The number of GPU devices in your computer
gpuDevice Select which device to use, or see which device is selected
and view its properties
Example: Select a GPU
This example shows how to identify and select a GPU for your computations.
1
Determine how many GPU devices are in your computer:
gpuDeviceCount
2
2
With two devices, the first is the default. You can examine its properties to
determine if that is the one you want to use:
d = gpuDevice
d =
CUDADevice with properties:
Name: 'Tesla K20c'
Index: 1
ComputeCapability: '3.5'
SupportsDouble: 1
DriverVersion: 5.5000
ToolkitVersion: 5.5000
MaxThreadsPerBlock: 1024
MaxShmemPerBlock: 49152
MaxThreadBlockSize: [1024 1024 64]
MaxGridSize: [2.1475e+09 65535 65535]
SIMDWidth: 32
TotalMemory: 5.0327e+09