Unable to find 'nvcc'

55 views (last 30 days)
Dmitry Sartakov
Dmitry Sartakov on 3 Jun 2019
Commented: 贝宁 竺 on 10 Apr 2022
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?
  3 Comments
Kevin Jia
Kevin Jia on 4 Nov 2019
Has this issue been resolved? If so, would you please share how to get it done?
Thanks,
Kevin
贝宁 竺
贝宁 竺 on 10 Apr 2022
I have the same problem in Jetson TX2 nx. How did you solve it?

Sign in to comment.

Accepted Answer

Alejandro Josue Calderon Torres
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
  2 Comments
Safwana Razak
Safwana Razak on 25 Feb 2020
Thanks Alejandro!! this is the best solution so far.
Tohru Kikawada
Tohru Kikawada on 27 Jan 2021
This is now described in "Environment Variable on the Target" section in the official documentation.

Sign in to comment.

More Answers (1)

Walter Roberson
Walter Roberson on 3 Jun 2019
When you start MATLAB from an icon, it does not go through a login shell. Copying from a previous posting of mine, https://www.mathworks.com/matlabcentral/answers/27762-executing-unix-commands-set-in-path-in-matlab-does-not-work-with-unix-command#comment_194290
[your current PATH configuration might be done in] /etc/profile or ~/.bash_profile or ~/.bash_login or ~/.profile as those are the ones checked for interactive login, which would not be the case in this situation. However, ~/.bashrc would be used for interactive non-login shells, and for any shell the environment variable BASE_ENV is checked and if it refers to a file then the file is sourced. But if the shell was invoked as "sh" instead of as "bash" then some of the above files are skipped and the environment variable examined is ENV instead of BASE_ENV

Categories

Find more on Get Started with GPU Coder in Help Center and File Exchange

Tags

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!