Contents


Create Your Instance

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

Basics

  1. Update & upgrade System
    sudo apt-get update 
    sudo apt-get upgrade
    
  2. Install essentials like gcc compiler, git e.t.c.
    sudo apt-get install build-essential
    sudo apt-get install git zip unzip
    

CUDA and cuDNN

  1. Install CUDA 10.1
    wget https://developer.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda-repo-ubuntu1804-10-1-local-10.1.105-418.39_1.0-1_amd64.deb
    sudo dpkg -i cuda-repo-ubuntu1804-10-1-local-10.1.105-418.39_1.0-1_amd64.deb
    sudo apt-key add /var/cuda-repo-ubuntu1804-10-1-local-10.1.105-418.39/7fa2af80.pub
    sudo apt-get update
    sudo apt-get install cuda
    echo 'export PATH=/usr/local/cuda-10.1/bin${PATH:+:${PATH}}' >> ~/.bashrc 
    echo 'export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' >> ~/.bashrc 
    source ~/.bashrc
    
  2. Install cuDNN v7.6.5 for CUDA 10.1

    Download cuDNN v7.6.5 from NVIDIA as in Local Setup. Note that this time you are installing cuDNN on virtual machine instance with Linux.

    gcloud compute scp [LOCAL_FILE_PATH] ecbm4040@your-instance-name:
    cp cudnn-10.1-linux-x64-v7.6.5.32.solitairetheme8 cudnn-10.1-linux-x64-v7.6.5.32.tgz
    tar xvf cudnn-10.1-linux-x64-v7.6.5.32.tgz
    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.

Anaconda and other packages

  1. Download Anaconda
    https://repo.anaconda.com/archive/Anaconda3-2020.02-Windows-x86_64.exe
    
  2. Install Anaconda
    bash https://repo.anaconda.com/archive/Anaconda3-2020.02-Windows-x86_64.exe
    source ~/.bashrc
    
  3. Create your own virtual environment in Anaconda with Python 3.7
    conda create -n envTF22 python=3.7
    
  4. Activate the virtual environment.
    conda activate envTF22
    
  5. Install basic packages.
    conda install pandas numpy scipy pillow matplotlib scikit-learn
    conda install -c conda-forge jupyterlab 
    

Tensorflow

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

Now you can proceed to Step 3 in GCP Setup.