Create Your Instance

  1. Please follow GCP Setup instructions to 'select image' part.
  2. In boot disk, instead of custom image, select 'Ubuntu 16.04 LTS' from 'OS images'.


  1. Update & upgrade System
    sudo apt-get update 
    sudo apt-get upgrade
  2. Install python 3.6, pip, gcc, etc.
    sudo add-apt-repository ppa:deadsnakes/ppa
    sudo apt-get update
    sudo apt-get install python3.6
    sudo python3.6
    sudo apt-get install build-essential
    sudo apt-get install git zip unzip
  3. Verify GPU, Linux version, kernel headers and development packages
    lspci | grep -i nvidia
    uname -m && cat /etc/*release
    uname -r
    sudo apt-get install linux-headers-$(uname -r)

CUDA and cuDNN

  1. Install CUDA 9.0
    mv cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64.deb
    sudo dpkg -i cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64.deb
    sudo apt-key add /var/cuda-repo-9-0-local/
    sudo apt-get update
    sudo apt-get install cuda
    echo 'export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}' >> ~/.bashrc
    echo 'export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' >> ~/.bashrc
    source ~/.bashrc
  2. Install cuDNN v7.0.5

    Download cuDNN v7.0.5 from NVIDIA as in Local Setup

    gcloud compute scp [LOCAL_FILE_PATH] ecbm4040@your-instance-name:~/
    tar xvf cudnn-9.0-linux-x64-v7.tar
    sudo cp cuda/include/cudnn.h /usr/local/cuda/include
    sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
    sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
  3. Check CUDA installation. You can use "nvcc -V" to check the version of CUDA toolkits. And "nvidia smi" can help you check availble GPU device.

Miniconda and other packages

  1. Download Miniconda
  2. Install Miniconda
    source ~/.bashrc
  3. Create your own virtual environment in Miniconda
    conda create -n dlenv
  4. Activate the virtual environment.
    source activate dlenv
  5. Install baisc packages.
    conda install pandas numpy scipy pillow matplotlib scikit-learn
    conda install jupyter notebook


  1. Use pip to install tensorflow-gpu.
    pip install tensorflow-gpu
  2. Open python and try to run a simple tensorflow function.

Now you can proceed to Step 3 in GCP Setup.