The faster way to CUDA programming. Just open it right now here ↗
or
visit colab.research.google.com for Google Colab for online jupyter notebooks. Make sure to set GPU
accelerator in the Runtime
-> Change runtime type
.
1. Remove existing CUDA installation
This remove all the nvidia
and libnvidia
named packages and libraries in the system.
!apt-get --purge remove cuda nvidia* libnvidia-* !dpkg -l | grep cuda- | awk '{print $2}' | xargs -n1 dpkg --purge !apt-get remove cuda-* !apt autoremove !apt-get update
2. Download and install latest CUDA
Visit https://developer.nvidia.com/cuda-downloads
Latest example,
!wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin !sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 !wget https://developer.download.nvidia.com/compute/cuda/11.6.0/local_installers/cuda-repo-ubuntu2004-11-6-local_11.6.0-510.39.01-1_amd64.deb !sudo dpkg -i cuda-repo-ubuntu2004-11-6-local_11.6.0-510.39.01-1_amd64.deb !sudo apt-key add /var/cuda-repo-ubuntu2004-11-6-local/7fa2af80.pub !sudo apt-get update !sudo apt-get -y install cuda
3. Check the installation
!nvcc --version
and create simple .cu
file
%%writefile /content/main.cu #include <iostream> int main() { std::cout << "This is from CUDA\n"; return 0; }
and compile it.
!nvcc main.cu -o main
Resources
Top comments (0)