Main Content

GPU device index


Specify the CUDA® device to target.

Category: Code Generation > GPU Code


Default: -1

In a multi GPU environment such as NVIDIA® Drive platforms, specify the CUDA device to target.


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


  • This parameter requires a GPU Coder™ license.

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

Command-Line Information

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

Related Topics