There seem be be several options to install CUDA on Ubuntu 20.10: It is pre-bundled with 20.10, there are various installers at the official NVIDIA page, etc.
Question: What is a recommended way to install CUDA 11.X on Ubuntu 20.10, and how do I verify the installation?
Install the NVIDIA driver
This might be an optional step, but it is always good to first remove potential previously installed NVIDIA drivers:
Next, let's install the latest driver:
After this, we need to restart the computer to finalize the driver installation. Next we can verify whether the drive was succesfully installed:
This should contain the following or similar:
Install CUDA Toolkit
Next we can install the CUDA toolkit:
We also need to set the CUDA_PATH. Add this
at the end of your
.bashrc
and runNow your CUDA installation should be complete, and
should indicate that you have CUDA 11.1 installed.
Test the CUDA toolkit installation /configuration
One of the best way to verify whether CUDA is properly installed is using the official "CUDA-sample". Ubuntu does not package them as part of "nvidia-cuda-toolkit" but we can download them directly from NVIDIA's github page:
For whatever reason, NVIDIA did not chose to include a modern build system (e.g. cmake), but ships a plain old Makefile instead. If just running "make" does not work for you, carefully read the error messages and see whether e.g. some required dependencies are not installed.
In order to help the build process a little, it might be advisable to specify the compute architecture of your GPU.
nvidia-smi
. Mine is a Quadro RTX 3000.If the compilation was succesful, you can try out one of the samples. For instance:
You should see the following or similar output:
since all of the explanations i found so far were not satisfying, here are the steps i came up with to install the latest nvidia driver (465) with cuda
11.3
first you have to uninstall all cuda and nvidia related drivers and packages
then
then (if not already done) disable nouveau as described here: https://askubuntu.com/a/951892/634048 and
reboot
againdownload cuda and install.
Follow the post-installation instructions found on the CUDA Toolkit Installation Guide for Linux. This involves updating the PATH and environment variables:
IMPORTANT if you need 32bit support - there are several applications only running with 32-bit drivers (like steam)
opt out of installation of nvidia drivers for cuda installation and install drivers from here: https://www.nvidia.com/download/driverResults.aspx/171980/en-us also check if driver is compatible for your model! (in general that should be the case)
and opt in for 32-bit support when asked
done
I did NOT test it for any other versions than
20.04
, but it should work for18.04
to21.04