8.1 CUDA Setup For Google CoLab
8.1 CUDA Setup For Google CoLab
!lsb_release -a
2. Getting setup code from nvidia koolkit site for Ubuntu 20.04.5 LTS
https://developer.nvidia.com/cuda-downloads
3. Run the following commands obtained from the official site (for cuda 11.3)
!wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/
cuda-ubuntu2004.pinsudo
!mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
!wget https://developer.download.nvidia.com/compute/cuda/11.3.0/local_installers/cuda-
repo-ubuntu2004-11-3-local_11.3.0-465.19.01-1_amd64.debsudo
!dpkg -i cuda-repo-ubuntu2004-11-3-local_11.3.0-465.19.01-1_amd64.debsudo
!apt-key add /var/cuda-repo-ubuntu2004-11-3-local/7fa2af80.pubsudo
!apt-get updatesudo
!apt-get -y install cuda
CUDA-C/C++ setup For Google CoLab
• Step 3: check cuda version
!nvcc --version
%%cu
#include <iostream>
int main()
{
std::cout << "Welcome To GeeksforGeeks\n";
return 0;
}
CUDA-C Example Programs
• Vector Addition in CUDA-C
https://github.com/olcf-tutorials/vector_addition_cuda