On a machine that is used publicly, one can’t update its cuda or cudnn version arbitrarily. Here is a way you can use the version you need.

Without root privileges, you can do this to make your code run well:

Below is the example of cudnn:(Cuda can be done in the same way.)

Because the essence of cuda or cudnn is dynamic link library, so all you need do is to make your machine know where to link it properly.

You can download and extract the proper version of cuda or cudnn to your ~ directory (or anywhere you like).

Then append these to your ~/.bashrc (or something like .zshrc etc.)

1
2
3
4
export PATH=/usr/local/cuda/bin:$PATH
export CUDA_HOME=/usr/local/cuda
export LD_LIBRARY_PATH=~/cuda/lib64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64

Then source .bashrc will make it work perfectly.