How to Install CUDA on GCP(compute engine)

Navaneeth Kt
Apr 8, 2019

--

Start by logging into your compute instance, use the gcloud SDK or GCP cli. Change your-project-name , your-zone , your-instance-name accordingly.

my instance is a Ubuntu 16.04 version

$ gcloud compute --project 'your-project-name' ssh --zone 'your-zone' 'your-instance-name'

Then, start by downloading the repository from Nvidia.

$ curl -O http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.61-1_amd64.deb

When you’ve completed, install with dpkg and update the repository.Then,

$ sudo dpkg -i cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
$ sudo apt-get update
$ rm cuda-repo-ubuntu1604_8.0.61-1_amd64.deb

Yaas !! we’re good to start installing CUDA.

$ sudo apt-get install cuda-8-0

The following commands should set up the environment variables and add them to run command script file

$ echo 'export CUDA_HOME=/usr/local/cuda' >> ~/.bashrc
$ echo 'export PATH=$PATH:$CUDA_HOME/bin' >> ~/.bashrc
$ echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CUDA_HOME/lib64' >> ~/.bashrc
$ source ~/.bashrc

Test !!!

$ nvcc --version
$ nvidia-smi
Result without errors

https://github.com/Navan0

--

--

Navaneeth Kt

navaneeth@lisa:~$ Deep learning dev \ full stack dreamer \ nyctophilist