Installation
https://youtu.be/8i3BiWa5AZ4?feature=shared
https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html
Pre-installation Actions
Verify the system has a CUDA-capable GPU.
lspci | grep -i nvidia
Verify the system is running a supported version of Linux.
uname -m && cat /etc/*release
Verify the system has gcc installed.
gcc --version
If not:
sudo apt-get install build-essential
Verify the system has the correct kernel headers and development packages installed.
uname -r
6.5.0-17-generic
sudo apt list linux-headers-$(uname -r)
linux-headers-6.5.0-17-generic/jammy-updates,jammy-security,now 6.5.0-17.17~22.04.1 amd64
[installed,automatic]
https://docs.vmware.com/en/VMware-Carbon-Black-Cloud/services/cbc-sensor-installation-guide/GUID-55FEB6E4-B300-4323-A6F9-8AAFA2139001.html
Download the NVIDIA CUDA Toolkit.
https://developer.nvidia.com/cuda-downloads
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.3.2/local_installers/cuda-repo-ubuntu2204-12-3-local_12.3.2-545.23.08-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2204-12-3-local_12.3.2-545.23.08-1_amd64.deb
sudo cp /var/cuda-repo-ubuntu2204-12-3-local/cuda-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get -y install cuda-toolkit-12-3
Handle conflicting installation methods.
Back to
https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#common-installation-instructions-for-ubuntu
sudo reboot
Post-installation Actions
https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#post-installation-actions
Add the required lines for path to .bashrc
Actually, the nvidia web site still says cuda-12.2
but looking in
ls /usr/local
we see that we just installed cuda-12.3
so probably the correct lines will be
export PATH=/usr/local/cuda-12.3/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-12.3/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
Note that there is no space after lib64 which could occur if you concatenate the two lines incorectly
Closa terminal and open new terminal
Verify with
echo $PATH
Note:
This did not work after logging out and back in and then opening an existing tmux session, because that
session still used the old .bashrc
Solution:
In tmux session, type logout and then start a new tmux session.
Verifying the Installation
https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#verify-the-installation
cat /proc/driver/nvidia/version
Run Test Examples:
https://github.com/nvidia/cuda-samples
download, open terminal in folder, call
make
Run executable.
Matrix Multiply works:
[Matrix Multiply Using CUDA] - Starting...
GPU Device 0: "Ampere" with compute capability 8.6
MatrixA(320,320), MatrixB(640,320)
Computing result using CUDA Kernel...
done
Performance= 626.38 GFlop/s, Time= 0.209 msec, Size= 131072000 Ops, WorkgroupSize= 1024 threads/block
Checking computed result for correctness: Result = PASS
NOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is
enabled.