coder.checkGpuInstall(envCfg) giving error invalid CUDA device error on Jetson nano

I am executing following command sequence on Matlab

% Use ‘drive’ for NVIDIA DRIVE hardware
envCfg = coder.gpuEnvConfig(‘jetson’);
envCfg.BasicCodegen = 1;
envCfg.Quiet = 1;
envCfg.HardwareObject = hwobj;

Getting error as Invalid CUDA device ID: 0

I am using Jetson nano 2GB trainer kit

also done the following settings for PATH

Environment Variable on the Target

The support package uses environment variables to locate the necessary tools, compilers, and libraries required for code generation. Ensure that the following environment variables are set.

Variable Name Default Value Description
PATH /usr/local/cuda/bin Path to the CUDA toolkit executable on the Jetson or DRIVE platform.
LD_LIBRARY_PATH /usr/local/cuda/lib64 Path to the CUDA library folder on the Jetson or DRIVE platform.


Below is a similar issue from the Mathworks forum.
Could you give it a check first?



Compatible GPU: (Invalid CUDA device id: 0. Select a device id from the range 0:-1)

done all the settings mentioned in the above link for PATH etc.

My Jetson nano is not responding the GPU Info

I am using MATLAB to access Jetson nano

Changed the bashrc file as follows:

If not running interactively, don’t do anything

case $- in
i) ;;
export PATH=$PATH:/usr/local/cuda/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64

Still getting the following error while executing:

One or more of the system checks did not pass, with the following errors …
Compatible GPU: (Invalid CUDA device id: 0. Select a device id from the range 0:-1)

Is there any command to read the GPU version of Jetson nano from it’s command prompt?


Could you check if you can get the current GPU information with our CUDA sample first?

$ /usr/local/cuda-10.2/bin/ .
$ cd NVIDIA_CUDA-10.2_Samples/1_Utilities/deviceQuery
$ make
$ ./deviceQuery