Follow the instructions from https://cloud.google.com/compute/docs/gpus/install-drivers-gpu to get the NVIDIA CUDA drivers installed:
- Retrieve the CUDA repository:
curl -O http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
- Install the .deb package:
sudo dpkg -i cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
- Add the NVIDIA GPG key to the apt sources keyring:
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
- Install the NVIDIA CUDA drivers:
sudo apt-get update && sudo apt-get install cuda
- We now have a CUDA-enabled GPU on our GCP VM. We can validate this with the nvidia-smi command:
nvidia-smi
- We will see the following output in the screenshot: