Skip to content

Instantly share code, notes, and snippets.

@Ending2015a
Last active April 25, 2024 16:25
Show Gist options
  • Save Ending2015a/88169ffb078075b93b84c65558f4e1a2 to your computer and use it in GitHub Desktop.
Save Ending2015a/88169ffb078075b93b84c65558f4e1a2 to your computer and use it in GitHub Desktop.
Install CUDA 10.0 and nvcc on Google Colaboratory
# install cuda 10.0
!apt-get update;
!wget https://developer.nvidia.com/compute/cuda/10.0/Prod/local_installers/cuda-repo-ubuntu1604-10-0-local-10.0.130-410.48_1.0-1_amd64 -O cuda-repo-ubuntu1604-10-0-local-10.0.130-410.48_1.0-1_amd64.deb
!dpkg -i cuda-repo-ubuntu1604-10-0-local-10.0.130-410.48_1.0-1_amd64.deb
!apt-key add /var/cuda-repo-10-0-local/7fa2af80.pub
!apt-get update
!apt-get -y install gcc-7 g++-7
!apt-get -y install cuda
!export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}
!export LD_LIBRARY_PATH=/usr/local/cuda/lib64\${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
# check if installed successfully
!/usr/local/cuda/bin/nvcc --version
# install python-nvcc plugin
!pip install git+git://github.com/andreinechaev/nvcc4jupyter.git
%load_ext nvcc_plugin
# you can start writing your cuda code
%%cu
#include <iostream>
int main(){
std::cout << "hello" << std::endl;
return 0;
}
@AhmedUKamel
Copy link

Replace

!apt-get -y install gcc-7 g++-7

with

!apt-get -y install gcc g++

and

!pip install git+git://github.com/andreinechaev/nvcc4jupyter.git

with

!pip install git+https://github.com/andreinechaev/nvcc4jupyter.git

@VietDung7301
Copy link

@AhmedUKamel can I ask a question that how to remove cuda version. After follow this guild, my cuda's version is still 12.2

@AhmedUKamel
Copy link

how to remove cuda version

@VietDung7301, Have you tried the following command?

apt-get purge cuda

@erayyym
Copy link

erayyym commented Apr 25, 2024

Hi, I tried all the code the above. my cuda is still not 10.0 and even got upgrade to 12.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment