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.

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

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

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

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

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

4. Set a default Compute Engine region

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

5. Request for increase in quota for GPU

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

6. Receive email approval of quota increase

Image for post
Image for post
Approval email from Google Cloud Platform Support.

7. Navigate to the Google Cloud Marketplace

Image for post
Image for post
Marketplace page

8. Select the Deep Learning VM

Image for post
Image for post
Filter by “Virtual Machines” and “Compute”

9. Launch Deep Learning VM on Compute Engine

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

10. Fill in VM specs and select Pytorch 1.0 Preview

Image for post
Image for post
Select GPU and check install GPU driver automatically

11. Deploying the VM

Image for post
Image for post
Warnings due to deprecated image being used

12. Check that VM is now running

Image for post
Image for post
Compute Engine → VM Instances

13. Connecting to the VM via SSH

Method 1: SSH from the browser:

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

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

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

14. Connect to JupyterLab

Image for post
Image for post
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

Image for post
Image for post
Stopping your instance via the online console.

Method 2: Command line on Cloud SDK

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

Method 3: Use the Cloud Console mobile app

Image for post
Image for post
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

Image for post
Image for post
The default firewall rules.
Image for post
Image for post
Name: “default-allow-jupyter” and Target tags: “jupyter”
Image for post
Image for post
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

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

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

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

(Ignore) 10. Connecting to the VM instance

Method 1: SSH from the browser:

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

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

Image for post
Image for post
Successful connection to VM running on Ubuntu 16.04.3 LTS.

(Ignore) Step 11: Run the bash setup script

Image for post
Image for post

(Ignore) Step 12: Reconnect to the VM instance

Image for post
Image for post
Run “jupyter notebook”

(Ignore) Step 13: Connect to Jupyter notebook

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

Image for post
Image for post

Method 2: Connecting using ssh and port forwarding

Image for post
Image for post
Image for post
Image for post

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

Image for post
Image for post