2
votes

I just came across a weird situation after installing cuda... I literally followed every single step suggested by the nvidia website: http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-linux/#axzz3H0tm46yY.... everything seems to be fine, even the samples work... however when I try to run the "hello world" program presented in Cuda by Example documentation, the terminal displays:

The program 'nvcc' is currently not installed. You can install it by typing: sudo apt-get install nvidia-cuda-toolkit

This is quite strange since nvcc should already be installed during the procedure suggested by the nvidia website....

Does anyone have any idea?

1
IIRC you have to add nvcc to your path explicitly in your .shellrc (or wherever). - maxywb
note that the need to modify the PATH variable is indicated by the installer at the completion of installation and documented in the getting started guide you linked in the question. - Robert Crovella

1 Answers

8
votes

The PATH variable needs to include your cuda /bin directory (by default it is /usr/local/cuda-6.5/bin)

On Ubuntu you can edit the .bashrc file on your $HOME directory, adding the following;

export PATH=/usr/local/cuda-6.5/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-6.5/lib64:$LD_LIBRARY_PATH

If you are running a 32-bit Ubuntu version, then the paths are:

export PATH=/usr/local/cuda-6.5/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-6.5/lib:$LD_LIBRARY_PATH

After editing the bashrc file, source it (or simply restart the terminal):

source ~/.bashrc

Of course, if you have changed the default location of your CUDA directory you must change the PATHS accordingly.

PLUS: there are another options to tell the system where to find a library, a program, etc. like using enviromental modules, specify the complete path to the libraries and programs manually are another options. There are many methods out there!