How to install multiple versions of CUDA

My machine is CUDA16.04, and CUDA10.0 was installed before. For some reasons, now I need to install CUDA9.0.

1. first https://developer.nvidia.com/cuda-90-download-archive?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1604&target_type=runfilelocal

Download the run Version (if CUDA has not been installed before, you can download the deb version)

2. Follow the above tutorial

Sudo Chmod + X CUDA? 9.0.176? Linux.run? Add executable permissions for CUDA? 9.0.176? Linux.run 
. / CUDA? 9.0.176? Linux.run? Install CUDA? 9.0.176? Linux.run

3. Setting of relevant parameters

Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 384.81?

(y)es/(n)o/(q)uit: n #I've installed CUDA10, so I don't need to install the 9.0 video card driver

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


/usr/local/cuda-9.0 is not writable. 
Do you wish to run the installation with 'sudo'? (y)es/(n)o: y #Use superuser rights

Please enter your password: Do you want to install a symbolic link at /usr/local/cuda? # Whether to connect the installation directory through soft connection link reach /usr/local/cuda,yes or no Either, depending on whether you use it or not /usr/local/cuda Default cuda Catalog. 
(y)es/(n)o/(q)uit: y  #I currently need to use 9.0

 

Enter Toolkit Location
[ default is /usr/local/cuda-9.0 ]:#Direct carriage return

 

4. Setting of relevant environment variables after the completion of installation and transfer

Finished copying samples.

===========
= Summary =
===========

Driver:   Not Selected
Toolkit:  Installed in /usr/local/cuda-9.0
Samples:  Installed in /usr/local/cuda-9.0/Samples

Please make sure that
 -   PATH includes /usr/local/cuda-9.0/bin
 -   LD_LIBRARY_PATH includes /usr/local/cuda-9.0/lib64, or, add /usr/local/cuda-9.0/lib64 to /etc/ld.so.conf and run ldconfig as root

To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-9.0/bin

Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-9.0/doc/pdf for detailed information on setting up CUDA.

***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 384.00 is required for CUDA 9.0 functionality to work.
To install the driver using this installer, run the following command, replacing <CudaInstaller> with the name of this run file:
    sudo <CudaInstaller>.run -silent -driver

Logfile is /tmp/cuda_install_11003.log

As mentioned above, you need to set two variables: PATH and LD library PATH. Just modify them in. / bashrc file. Remember to source some. / bashrc to make it effective.

After the above steps are completed, multiple versions can be switched. You can directly modify / usr/local/cuda to point to different versions of CUDA.

Tags: Linux sudo Ubuntu

Posted on Mon, 02 Dec 2019 04:16:33 -0500 by BillyBoB