Skip to content

Instantly share code, notes, and snippets.

@harshityadav95
Last active January 15, 2024 09:34
Show Gist options
  • Save harshityadav95/e56c525dcc14eec0d4f64eac67ad5102 to your computer and use it in GitHub Desktop.
Save harshityadav95/e56c525dcc14eec0d4f64eac67ad5102 to your computer and use it in GitHub Desktop.
Archived : Initialise CUDA environment on Google Colab
!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
!wget https://developer.nvidia.com/compute/cuda/9.2/Prod/local_installers/cuda-repo-ubuntu1604-9-2-local_9.2.88-1_amd64 -O cuda-repo-ubuntu1604-9-2-local_9.2.88-1_amd64.deb
!dpkg -i cuda-repo-ubuntu1604-9-2-local_9.2.88-1_amd64.deb
!apt-key add /var/cuda-repo-9-2-local/7fa2af80.pub
!apt-get update
!apt-get install cuda-9.2
!pip install git+git://github.com/andreinechaev/nvcc4jupyter.git
%load_ext nvcc_plugin
@uroojz
Copy link

uroojz commented Jan 14, 2024

i am using this code on google colab 12.2 version to run the CUDA C code but when i run the sample code you provided I get the following error

File "", line 3
global void add(int *a, int *b, int *c) {
^
SyntaxError: invalid syntax

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