It looks like you want to manage different versions of CUDA on your system using update-alternatives
, which is a smart way to easily switch between them. However, since CUDA 11.8 is not appearing in your list of alternatives, you’ll need to add it manually. Here’s how you can do it:
-
First, verify that CUDA 11.8 is indeed installed at
/usr/local/cuda-11.8
. You should see a directory structure similar to other CUDA versions if it’s correctly installed. -
Use the
update-alternatives
command to add CUDA 11.8 to the alternatives system. We’ll assign it a priority; based on your existing priorities, we can use118
for CUDA 11.8. You can adjust the priority if needed. Open a terminal and type the following command:sudo update-alternatives --install /usr/local/cuda cuda /usr/local/cuda-11.8 118
This command breaks down as follows:
--install
: Command to add an alternative./usr/local/cuda
: The generic name for the master link.cuda
: The name of the alternative link group./usr/local/cuda-11.8
: The path to the actual CUDA 11.8 installation.118
: The priority assigned to this version.
-
After adding CUDA 11.8 to the alternatives, you can check if it has been added successfully by running:
sudo update-alternatives --display cuda
You should now see CUDA 11.8 in the list.
-
If you want to switch to CUDA 11.8, you can use the following command:
sudo update-alternatives --config cuda
This will prompt you with a list of all installed CUDA versions. You can select the number corresponding to CUDA 11.8 to switch to it.
-
Verify that the switch was successful by checking the symlink:
ls -l /usr/local/cuda
This should show that
/usr/local/cuda
points to/usr/local/cuda-11.8
.
Following these steps will allow you to manage and switch between different CUDA versions easily using the update-alternatives
utility.