Ultimate guide to setting up a Google Cloud machine for fast.ai course (deprecated)

Latest: 13 Feb 2019 — This guide has been deprecated. Please refer to the official guide (https://course.fast.ai/start_gcp.html)

How Khang
How Khang
Jan 3, 2018 · 9 min read

Official Guide:

1. Sign up on Google Cloud Platform Free Tier.

12 months worth of US$300 credit (3 Jan 2018).

2. Upgrade to a paid account (credit card required).

https://cloud.google.com/free/docs/frequently-asked-questions#upgrading-billing

3. Create a new project for the fast.ai course

Click on “Create Project”.
Give your project an identifiable name and click “Create”.

4. Set a default Compute Engine region

Compute Engine → Settings

Set default region and zone (choose one from list).
Zones with NVIDIA K80 GPU and Intel Broadwell CPU (3 Jan 2018).

5. Request for increase in quota for GPU

IAM & Admin → Quotas

Select your project’s region.
Select NVIDIA K80 GPUs (without “preemptible”) → Edit Quotas → Change to “1” → Submit Request.

6. Receive email approval of quota increase

Approval email from Google Cloud Platform Support.

7. Navigate to the Google Cloud Marketplace

Compute Engine → Marketplace

Marketplace page

8. Select the Deep Learning VM

Filter by “Virtual Machines” and “Compute”

9. Launch Deep Learning VM on Compute Engine

Note that the OS is Debian 9 (and not Ubuntu)

10. Fill in VM specs and select Pytorch 1.0 Preview

Select GPU and check install GPU driver automatically

11. Deploying the VM

Warnings due to deprecated image being used

12. Check that VM is now running

Compute Engine → VM Instances

13. Connecting to the VM via SSH

There are a few methods of connecting to your Debian VM according to Google Cloud Platform’s official documentation (which can be found here). Two of those methods will be mentioned briefly.

Method 1: SSH from the browser:

Requires enabling popups on your browser (usually disabled by default).

Method 2: Command line using Google Cloud SDK (recommended)

Step a. Download and install Cloud Tools for your OS to use the Cloud SDK. (Windows users: (1) verify that the option to install bundled Python is checked and (2) ensure that you have PuTTY installed).

Successful login to Debian 9.5 VM and running nvidia-smi command

14. Connect to JupyterLab

Connected to JupyterLab

**Stopping your VM instance

Important: Remember to stop your VM instance when you are done with your notebooks or you will continue to incur charges.

Method 1: Online console

Compute Engine → VM instances

Stopping your instance via the online console.

Method 2: Command line on Cloud SDK

Enter the command: gcloud compute instances stop <insert instance name>

Method 3: Use the Cloud Console mobile app

Allows you to check on your instances anytime on your smartphone.

The instructions beyond this point were for the fast.ai course part 1 v 2 and no longer apply as of October 2018. They are archived here in case there is a need to update them to provide another option to the Deep Learning Image option above.

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

(Ignore) 7. Configure firewall for Jupyter notebook

VPC Network → Firewall rules

The default firewall rules.
Name: “default-allow-jupyter” and Target tags: “jupyter”
Source IP ranges:“0.0.0.0/0” and Specified protocols and ports: “tcp:8888-8889”

(Ignore) 8. Create your virtual machine instance for fast.ai

Compute Engine → VM instances → Create

CPU platform: “Intel Broadwell or later” and Number of GPUs: “1”
Boot disk: “Ubuntu 16.04 LTS” and “50 GB SSD”, Firewall: Check both, Network tags: “jupyter”
Newly created VM instance is running.

(Ignore) 9. (Optional) Convert the IP address to static

VPC network → External IP addresses

Convert IP address to “Static” and give it a name.

(Ignore) 10. Connecting to the VM instance

There are a few methods of connecting to your Ubuntu VM according to Google Cloud Platform’s official documentation (which can be found here). Two of those methods will be mentioned briefly.

Method 1: SSH from the browser:

Requires enabling popups on your browser (usually disabled by default).

Method 2: Command line using Google Cloud SDK (recommended)

Step a. Download and install Cloud Tools for your OS to use the Cloud SDK. (Windows users: (1) verify that the option to install bundled Python is checked and (2) ensure that you have PuTTY installed).

Successful connection to VM running on Ubuntu 16.04.3 LTS.

(Ignore) Step 11: Run the bash setup script

(Ignore) Step 12: Reconnect to the VM instance

Run “jupyter notebook”

(Ignore) Step 13: Connect to Jupyter notebook

Method 1: Connecting using your VM’s static IP address

Use this method only if you went through step 9 to obtain a static IP address.

Method 2: Connecting using ssh and port forwarding

Use this method if you skipped obtaining a static IP address in step 9 or if you encounter difficulties connecting to your Jupyter notebook using method 1.

(Ignore) Step 14: Get ready to do some serious learning!