CUDA Installation

conda is an easy-to-use way of managing not only Python packages but also many software packages, including CUDA. Switching between different CUDA versions using is therefore straightforward.

update-alternatives

One can use update-alternatives to switch between different CUDA versions OS-wide. But I wouldn’t recommend it.

>>> sudo update-alternatives --install /usr/local/cuda cuda /usr/local/cuda-11.8 118
>>> sudo update-alternatives --display cuda
cuda - manual mode
  link best version is /usr/local/cuda-12.2
  link currently points to /usr/local/cuda-11.8
  link cuda is /usr/local/cuda
/usr/local/cuda-11.4 - priority 114
/usr/local/cuda-11.8 - priority 118
/usr/local/cuda-12.2 - priority 122
>>> sudo update-alternatives --config cuda