## Ubuntu Remove CUDA Toolkit: ``` sudo apt-get --purge remove "*cuda*" "*cublas*" "*cufft*" "*cufile*" "*curand*" \ "*cusolver*" "*cusparse*" "*gds-tools*" "*npp*" "*nvjpeg*" "nsight*" "*nvvm*" ``` Remove NVIDIA Drivers: ``` sudo apt-get --purge remove "*nvidia*" "libxnvctrl*" ``` or ``` sudo apt autoremove nvidia* --purge ``` Autoremove ``` sudo apt-get autoremove ``` Installa Nvidia Drivers and Cuda ``` sudo apt-get install linux-headers-$(uname -r) distribution=$(. /etc/os-release;echo $ID$VERSION_ID | sed -e 's/\.//g') cd /tmp && wget https://developer.download.nvidia.com/compute/cuda/repos/$distribution/x86_64/cuda-keyring_1.0-1_all.deb && sudo dpkg -i cuda-keyring_1.0-1_all.deb && sudo apt-get update && sudo apt-get -y install cuda-drivers ``` Add cuda to PATH. Change X.Y with the cuda version ``` export PATH=/usr/local/cuda-X.Y/bin${PATH:+:${PATH}} && export LD_LIBRARY_PATH=/usr/local/cuda-X.Y/lib64\ ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} ``` Reboot ``` sudo reboot ``` Check if nvidia-persistenced is running otherwise enable it ``` systemctl status nvidia-persistenced sudo systemctl enable nvidia-persistenced ``` Check if installation was successful ``` nvidia-smi nvcc --version ``` if Cuda toolkit is not installed follow these instructions: ``` wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb sudo dpkg -i cuda-keyring_1.1-1_all.deb sudo apt-get update sudo apt-get -y install cuda-toolkit-12-3 ```