MATLAB: Unable to find ‘nvcc’

GPU Codernvcc

Hi! I'm start learning programming Jetson TX2. After installing all packages i try code from help:
>> envCfg = coder.gpuEnvConfig('jetson'); % Use 'drive' for NVIDIA DRIVE hardware
envCfg.BasicCodegen = 1;
envCfg.Quiet = 1;
envCfg.HardwareObject = hwobj;
coder.checkGpuInstall(envCfg);
and get answer:
Error using coder.checkGpuInstall (line 32)
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)
CUDA Environment: (Unable to find 'nvcc' on the system path. Update the '.bashrc' script on the target to setup the 'PATH'
environment variable.)
but on TX2 have:
user@user-tx2:~$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Sun_Sep_30_21:09:22_CDT_2018
Cuda compilation tools, release 10.0, V10.0.166
user@user-tx2:~$ echo $PATH
/usr/local/cuda-10.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
How fix problem with nvcc?

Best Answer

Hi,
I was having the same problem, I solved it by correctly modifying the .bashrc file. In the .bashrc file of your Jetson board look for this section:
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
And modify it like this:
# 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
return;;
esac
This way now coder.checkGpuInstall(envCfg); passes without errors or warnings.
Best regards
Related Question