Ubuntu GPU Setup
Detailed here are the steps taken for Ubuntu GPU setup to uninstall/(re)install NVIDIA/CUDA. Note that the NVIDIA driver and CUDA keyring are dependent on the user's own GPU hardware and Ubuntu version. Steps may differ slightly dependent on these factors and are noted.
Removal of previous installs of NVIDIA/CUDA (not required if you've never installed):
sudo apt install --reinstall linux-image-generic
sudo apt install --reinstall linux-headers-generic
sudo apt remove --purge '^nvidia-.*'
sudo apt remove --purge '^libnvidia-.*'
sudo apt-get --purge remove "*cuda*" "*cublas*" "*cufft*" "*cufile*" "*curand*" "*cusolver*" "*cusparse*" "*gds-tools*" "*npp*" "*nvjpeg*" "nsight*" "*nvvm*"
sudo apt-get --purge remove "*nvidia*" "libxnvctrl*"
sudo apt-get autoremoveInstall NVIDIA driver 525 (This may be different between setups. Users will need to figure out what NVIDIA driver they need based on their GPU hardware and Linux software.)
sudo apt-get install nvidia-driver-525
Restart computer and try running
nvidia-smi
to see if NVIDIA side is correctly setup. The next step is installing CUDA.Get CUDA keyring (this version (Ubuntu 18.04) works for the specific ubuntu version 22.04, again users may need to find their specific CUDA keyring needed)
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-keyring_1.0-1_all.deb
sudo dpkg -i cuda-keyring_1.0-1_all.debInstall CUDA drivers (get these from the keyring)
sudo apt-get update
sudo apt-get install cuda-drivers-525
sudo apt-get install cuda-toolkit-11-2Added CUDA to path in
.profile
and in/etc/environment
fileexport PATH=/usr/local/cuda-11.2/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}Install python-3 dev package:
sudo apt-get install python3.7-dev
Install NumPy/pyCUDA:
python3 -m pip install numpy
python3 -m pip install 'pycuda<2021.1'Install cuDNN / NVIDIA optimization (again system specific, this works on Ubuntu 22.04):
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
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub
sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/ /"
sudo apt-get update
(for CUDA 11.2)
sudo apt-get install libcudnn8=8.1.0.*-1+cuda11.2
sudo apt-get install libcudnn8-dev=8.1.0.*-1+cuda11.2Install NVIDIA-Docker2:
sudo apt-get update
sudo apt-get install -y nvidia-docker2
sudo systemctl restart dockerRestart Computer! Confirm that everything works through individual commands (NVIDIA:
nvidia-smi
and CUDA:nvcc -v
) or use the./bin/graphgrid gpu check
command to check if you system is now GraphGrid GPU compatible.