You are not logged in.

#1 2018-05-16 13:50:36

retogenes
Member
Registered: 2016-01-21
Posts: 33

Installing two versions of CUDA and two versions of CUDNN

I have the latest versions of CUDA and CUDNN installed in my Arch system (cudnn 7.1.3-1 and cuda 9.1.85.3-5). In addition, I would like to have some earlier versions of cuda/cudnn in the system. What would be the best way of achieving this?

What I have tried so far:

I have seen some AUR packages (https://aur.archlinux.org/packages/cuda-8.0/), but unfortunately they seem to be incompatible with the current version of cuda. They compile, but when installing, I get errors of the type

cuda-8.0: /opt/cuda/extras/CUPTI/sample/unified_memory/unified_memory.cu exists in filesystem
....
/opt/cuda/samples/6_Advanced/eigenvalues/bisect_kernel_large_multi.cuh exists in filesystem
.....
cuda-8.0: /usr/share/man/man7/libcusparse.so.7.gz exists in filesystem

Do you think it is possible to modify PKGBUILD to make pacman place the files somewhere else? (like /opt/cuda-8.0 instead of /opt/cuda, but unsure about what to place the man files)

Offline

#2 2023-08-17 22:18:06

hully
Member
Registered: 2022-11-14
Posts: 150

Re: Installing two versions of CUDA and two versions of CUDNN

This is how I figured out to manage different version of CUDA.

Do not use the `cuda` nor the `cudnn` package (they only install the latest version).

1. Install CUDA. Go to NVIDIA CUDA download page (https://developer.nvidia.com/cuda-downloads), and select Linux -> x86_64 -> Ubuntu -> (latest Ubunutu version) -> runfile (local).
2. Copy paste the `wget` command in a terminal and run it
3. Install CUDA. The script will install it in /usr/local/cuda-AA.BB.CC

The trick is to have /usr/local/cuda always point to the current CUDA version we are utilizing.
So to switch CUDA versions, run `ln -sfT /usr/local/cuda-AA.BB.CC /usr/local/cuda`.

The -s creates a symbolic link, the -f (which stands for force) will overwrite an eventually already existing link, and the -T tells ln that the target is a file.

4. Export the appropriate paths. In your .bashrc add

export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64/:/usr/local/cudnn/lib:$LD_LIBRARY_PATH

5. To switch to a different CUDA version, just make a script that changes the symbolic link. For example:

#!/usr/bin/env bash
sudo ln -sfT /usr/local/cuda-11.8 /usr/local/cuda

An analogous reasoning goes for cuDNN (with the difference that the file you download from NVIDIA is already portable, is not an installer.

Offline

#3 2023-08-17 22:21:15

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,645

Re: Installing two versions of CUDA and two versions of CUDNN

Thanks for the contribution, but this thread is five years old and the OP has not been back since 2020.

Closing.

Offline

Board footer

Powered by FluxBB