Installing CUDA 9 RC side-by-side with 8

How would I go about installing the RC of CUDA 9 without modifying or removing my existing installation of version 8? Subsequently, how would specify which version I want to use when compiling?

On linux just run the installer normally.

Your CUDA 8 installation will be left alone at /usr/local/cuda-8.0/

The new installation will show up at /usr/local/cuda-9.0/, and if you choose, you will also have a symlink from /usr/local/cuda to /usr/local/cuda-9.0

The new installation will also install a new GPU driver, required for CUDA 9, but this driver is compatible with CUDA 8 also.

When you want to select one or the other, modify your environment variables accordingly:

For CUDA 9.0 usage,

PATH should contain /usr/local/cuda-9.0/bin
(and it should not contain any reference to /usr/local/cuda-8.0)
LD_LIBRARY_PATH should contain /usr/local/cuda-9.0/lib64
(and it should not contain any reference to /usr/local/cuda-8.0)

For CUDA 8.0 usage:

PATH should contain /usr/local/cuda-8.0/bin
(and it should not contain any reference to /usr/local/cuda-9.0, or /usr/local/cuda/…)
LD_LIBRARY_PATH should contain /usr/local/cuda-8.0/lib64
(and it should not contain any reference to /usr/local/cuda-9.0 or /usr/local/cuda/…)

The method to modify these environment variables may depend on your preference, which shell you are running, and possibly your linux distro. Setting/modifying environment variables is not unique to CUDA, so you can find plenty of help for this online already.

Applications previously statically linked to cuda 8 cudart library will run just fine in the new setup without recompilation. Applications compiled with dynamic linking to CUDART will require that the LD_LIBRARY_PATH variable be properly set.

The application I’m building (via cmake) is erroring because it can’t find /usr/local/cuda-8.0/. I have cuda 9 installed and now I need to install 8 too. I’ve downloaded


but when I run

"sudo dpkg -i cuda-repo-ubuntu1604_8.0.61-1_amd64.deb"

I get a notification that the 8.0 installation is overwriting 9.0

dpkg: warning: downgrading cuda-repo-ubuntu1604 from 9.0.176-1 to 8.0.61-1
(Reading database ... 389963 files and directories currently installed.)
Preparing to unpack cuda-repo-ubuntu1604_8.0.61-1_amd64.deb ...
<b>Unpacking cuda-repo-ubuntu1604 (8.0.61-1) over (9.0.176-1)</b> ...
Setting up cuda-repo-ubuntu1604 (8.0.61-1) ...

How can I get the /usr/local/cuda-8.0 without having to completely remove 9.0?

read about package manager side-by-side installs here:

Thx for the info txbob. The following commands from the link you posted installed both
sudo apt-get install cuda-8-0
sudo apt-get install cuda-9-0
I’m also happy that sudo apt-get autoremove didn’t remove cuda-8.0.

I got cuda-9.0 and cuda-8.0. I installed cuda-9.0 firstly. Then I need to use cuda-8.0 so I installed cuda-8.0 side by side with cuda-9.0. Now, I am using cuda-8.0, how can I use cuda-9.0?

I did the above mentioned and I still get nvcc not found when trying to check for version.
My BASHRC has correct paths for cuda 9.1 and I have sourced it repeatedly, still no luck.

Could you resolve it?