I installed CUDA Toolkit 12.6 Update 1 in Ubuntu 22.04 using the command below (instructions are found here):
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin
sudo mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/12.6.1/local_installers/cuda-repo-ubuntu2204-12-6-local_12.6.1-560.35.03-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2204-12-6-local_12.6.1-560.35.03-1_amd64.deb
sudo cp /var/cuda-repo-ubuntu2204-12-6-local/cuda-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get -y install cuda-toolkit-12-6
The installation is successful. However, the nvcc
version is still 11.5. Here are 2 packages I installed. I thought installing the CUDA Toolkit 12.6 would replace 11.5, but the NVCC still comes from 11.5.
$ dpkg -l nvidia-cuda-toolkit
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-===================-===============-============-=================================
ii nvidia-cuda-toolkit 11.5.1-1ubuntu1 amd64 NVIDIA CUDA development toolkit
$ dpkg -l cuda-toolkit-12-6
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-=================-============-============-=================================
ii cuda-toolkit-12-6 12.6.1-1 amd64 CUDA Toolkit 12.6 meta-package
How can I update the nvcc
version to 12.6?
Here is the output of nvcc -V
:
$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Thu_Nov_18_09:45:30_PST_2021
Cuda compilation tools, release 11.5, V11.5.119
Build cuda_11.5.r11.5/compiler.30672275_0
Listing out the contents of the cuda-toolkit-12-6
, it does not include the nvcc
:
$ dpkg -L cuda-toolkit-12-6
/.
/usr
/usr/local
/usr/local/cuda-12.6
/usr/local/cuda-12.6/version.json
/usr/share
/usr/share/doc
/usr/share/doc/cuda-toolkit-12-6
/usr/share/doc/cuda-toolkit-12-6/changelog.Debian.gz
Output of nvidia-smi
:
$ nvidia-smi
Mon Sep 23 13:11:55 2024
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.183.01 Driver Version: 535.183.01 CUDA Version: 12.2 |
|-----------------------------------------+----------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+======================+======================|
| 0 NVIDIA GeForce RTX 4090 Off | 00000000:81:00.0 Off | Off |
| 0% 24C P8 21W / 450W | 10893MiB / 24564MiB | 0% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
| 1 NVIDIA GeForce RTX 4090 Off | 00000000:C1:00.0 Off | Off |
| 0% 24C P8 32W / 450W | 818MiB / 24564MiB | 0% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
+---------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=======================================================================================|
| 0 N/A N/A 1720 G /usr/lib/xorg/Xorg 4MiB |
| 0 N/A N/A 2174 C /usr/local/bin/ollama 384MiB |
| 0 N/A N/A 1808406 C /opt/tljh/user/bin/python 10486MiB |
| 1 N/A N/A 1720 G /usr/lib/xorg/Xorg 15MiB |
| 1 N/A N/A 1896 G /usr/bin/gnome-shell 10MiB |
| 1 N/A N/A 2174 C /usr/local/bin/ollama 384MiB |
| 1 N/A N/A 1808406 C /opt/tljh/user/bin/python 386MiB |
+---------------------------------------------------------------------------------------+
You should check your environment variables. It’s possible that nvcc
is still pointing to CUDA 11.5 because your PATH
and LD_LIBRARY_PATH
are set to the old version.
To fix this, update your environment variables by adding the following lines to your .bashrc
(or .zshrc
):
export PATH=/usr/local/cuda-12.6/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-12.6/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export CUDA_HOME=/usr/local/cuda-12.6
Then, source the file:
source ~/.bashrc
This should make nvcc
point to the correct CUDA version.
or create a symbolic link pointing to your new CUDA version.