Contents


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'.

Basics

  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
    wget https://bootstrap.pypa.io/get-pip.py
    sudo python3.6 get-pip.py
    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 10.0
    wget https://developer.nvidia.com/compute/cuda/10.0/Prod/local_installers/cuda-repo-ubuntu1604-10-0-local-10.0.130-410.48_1.0-1_amd64
    sudo dpkg -i cuda-repo-ubuntu1604-10-0-local-10.0.130-410.48_1.0-1_amd64
    sudo apt-key add /var/cuda-repo-10-0-local-10.0.130-410.48/7fa2af80.pub
    sudo apt-get update
    sudo apt-get install cuda
    echo 'export PATH=/usr/local/cuda-10.0/bin${PATH:+:${PATH}}' >> ~/.bashrc 
    echo 'export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' >> ~/.bashrc 
    source ~/.bashrc
    
  2. Install cuDNN v7.5.0

    Download cuDNN v7.5.0 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.0-linux-x64-v7.5.0.56.solitairetheme8 cudnn-10.0-linux-x64-v7.5.0.56.tgz
    tar xvf cudnn-10.0-linux-x64-v7.5.0.56.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.

Miniconda and other packages

  1. Download Miniconda
    wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
    
  2. Install Miniconda
    bash Miniconda3-latest-Linux-x86_64.sh
    source ~/.bashrc
    
  3. Create your own virtual environment in Miniconda with Python 3.6
    conda create -n envTF113 python=3.6
    
  4. Activate the virtual environment.
    source activate envTF113
    
  5. Install baisc packages.
    conda install pandas numpy scipy pillow matplotlib scikit-learn
    conda install -c conda-forge jupyterlab 
    

Tensorflow

  1. Use pip to install tensorflow-gpu.
    pip install tensorflow-gpu==1.13.1
    
  2. Open python and try to run a simple tensorflow function.
  3. (Optional) If you want to install tensorflow 2.0 instead of the lower versions, you can also use pip command:
    pip install --upgrade tensorflow
    Note: By installing version 2.0, you need to go for *_tf2.0 assignments.

Now you can proceed to Step 3 in GCP Setup.