Xintong Li

Tools

cuda

Multiple CUDA in the same system

Sometimes, we need different environments. Here shows a way to install the second coda in your current system. In my situation, cuda-8.0 was installed, so I’m not going to install the graphics driver again. You are recommend to install CUDA with .run file, because .deb could replace the graphics driver.

You may run the installer with the following command. —tmpdir solves the problem of Not enough space on parition mounted at /.

sudo sh cuda_9.0.176_384.81_linux-run --tmpdir=<dir_with_enough_space>

You can select the options as follows.

Do you accept the previously read EULA?      
accept/decline/quit: accept                  

Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 384.81?

(y)es/(n)o/(q)uit: n                         

Install the CUDA 9.0 Toolkit?                
(y)es/(n)o/(q)uit: y                         

Enter Toolkit Location
 [ default is /usr/local/cuda-9.0 ]:         

Do you want to install a symbolic link at /usr/local/cuda?

(y)es/(n)o/(q)uit: n                         

Install the CUDA 9.0 Samples?                
(y)es/(n)o/(q)uit: n

After the CUDA is installed, You can set your environment as follows.

sudo rm /usr/local/cuda
sudo ln -s /usr/local/cuda-9.0 /usr/local/cuda
export PATH=$PATH:/usr/local/cuda/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64

Then, you can check your CUDA version by nvcc --version. Finally, install cuDNN as following commands.

tar -zxvf cudnn-9.0-linux-x64-v7.1.tgz
sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/ -d
sudo chmod a+r /usr/local/cuda/include/cudnn.h
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*