Max
Max

Reputation: 51

Best solution to have multiple CUDA/cuDNN versions installed on Ubuntu

I am using Conda on Ubuntu 16.04. My objective is to associate each Conda environment to a specific version of CUDA / cuDNN. I had a look around and I found this interesting article, which basically suggests to put different CUDA versions into different folders and then use an environment-specific bash script (run when the environment is activated) to properly set the PATH/LD_LIBRARY_PATH variables (which creates the association with the CUDA version). This is fine, but when I try to install frameworks such as pytorch using Conda, it forces me to install also the "cudatoolkit" package. So, a couple of questions:

1) does downloading cudatoolkit mess up my previous CUDA configurations? which version will be used?

2) if using Conda is possible to install "cudatoolkit" and also "cudnn", why not just using conda for everything? Why even needing to apply the instructions of the above mentioned article?

Thank you.

Upvotes: 5

Views: 7999

Answers (1)

user11127113
user11127113

Reputation:

As an answer to the first question, no, downloading and installing another CUDA toolkit won't mess up other configurations. From CUDA toolkit installer, you specify an installation directory, so just pick whatever works for you that is unique to that CUDA version. This won't affect any currently installed CUDA versions. A Pytorch install will look for a CUDA_HOME environment variable as well as in '/usr/local/cuda' (the default CUDA toolkit install dir.), so it's just this environment variable that needs to be changed.

I can't speak for the second part. Perhaps the installation using Conda will use the default installation directory for the CUDA toolkit (seems silly but this is just speculation).

Upvotes: 4

Related Questions