Main Content

GPU index

GPU device selection in a multi GPU environment

Since R2020b

Model Configuration Pane: Code Generation / GPU Code

Description

Specify the CUDA® device to target.

The GPU index parameter specifies the CUDA device to target in a multi GPU environment such as NVIDIA® Drive.

Note

GPU index can be used with gpuArray only if gpuDevice and GPU index point to the same GPU. If gpuDevice points to a different GPU, a CUDA_ERROR_INVALID_VALUE runtime error is thrown.

Dependencies

  • This parameter requires a GPU Coder™ license.

  • To enable this parameter, select Generate GPU code on the Code Generation pane.

Settings

-1 (default) | integer

If the GPU index parameter is set to -1, the software selects the default CUDA device.

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

Programmatic Use

Parameter: GPUDeviceID
Type: integer
Value: -1 or a valid user-specified index value
Default: -1

Version History

Introduced in R2020b