Installing multiple CUDA Libraries in the same machine

Atinesh
2 min readJan 25, 2021

--

Nvidia CUDA (Source)

If you are in a situation where you need to use multiple CUDA libraries in the same machine because maybe you are experimenting with some codes which require different CUDA versions then don’t worry there is a trick to have multiple CUDA libraries installed in the same machine.

Note: Below I will be showing how to configure CUDA 10.0 and CUDA 9.0 in Ubuntu 18.04 but the mentioned method should work for any CUDA version and it should also work for more than 2 CUDA libraries

Step 1: Install CUDA libraries

Follow this post to Install CUDA libraries. Don’t worry about file overwriting because both CUDA libraries will be installed at different paths. CUDA 9.0 will be installed at /usr/local/cuda-9.0 path and CUDA 10.0 will be installed at /usr/local/cuda-10.0 path

The only thing which will be overwritten is the Symbolic link and I will show later how to fix that

Note: You can install libraries in any order

Step 2: Remove Symbolic link

$ cd /usr/local
$ sudo rm cuda

Update Symbolic link

# If switching to CUDA 10.0
$ sudo ln -s cuda-10.0 cuda

or

# If switching to CUDA 9.0
$ sudo ln -s cuda-9.0 cuda

Step 3: Update CUDA path in ~/.bashrc file

  • If switching to CUDA 10.0 then comment CUDA 9.0 path and uncomment CUDA 10.0 path
  • If switching to CUDA 9.0 then comment CUDA 10.0 path and uncomment CUDA 9.0 path

Step 4: Reload bashrc file

$ source ~/.bashrc

Step 5: Check current CUDA version

$ nvcc --version

Thank you for reading this post, If you like it then please clap and share it on Facebook, LinkedIn or Twitter so that other people get benefits from it.

You can follow me on Github, LinkedIn or contact me at atinesh.s@gmail.com

Happy Coding!

--

--

Atinesh
Atinesh

Written by Atinesh

Machine Learning Engineer

No responses yet