HowTo: Using Google Cloud

One of the fastest ways to get your very own deep learning machine is to use Google Cloud. Other cloud providers have similar services (Amazon AWS, Microsoft Azure, IBM cloud). This will give you a GPU machine pre-made with all major machine learning packages, as well as a built-in Jupyter server so you don’t have to use the command line at all (mostly).

 

Step 1: GCP Account

Make sure you have an account with Google Cloud Platform.

If you go on console.cloud.google.com you should be able to see your dashboard.

(For this class we also provided credits for GCP. Also be aware that Google provides $300 for all new users)

If you don’t have an account – open one. It is incredibly easy with your existing Google account (e.g. your Gmail or work account).

Step 1.1: Ask for GPUs quota

To get a deep learning machine you need permission to use Google’s GPUs in any virtual machines you bring up.

It’s easy to do, go on to your IAM -> Quotas section:

and make a request for 4 GPUs:

The quota will be approved within a few minutes.

Step 2: Deep Learning Deployment

Google provides images of provisioned machines with all the required packages to get going with Deep Learning. You can, of course, roll your own machine and install anything you need manually, but this will take a while and require command line skills. The pre-made machines are bundled very well and tested to work.

Go to the Deployment Manager -> Deployments.

Crete a new deployment from the marketplace and find the “Deep Learning VM” machine type.

Setup access to your machine, and customize it: (most things should remain as-is)

Remember to enable the GPU drivers and access to Jupyter:

Consider taking a P100 GPU over the default K80.
It’s going to be quite expensive to keep it up 24/7:

Create the deployment and wait for it to finish:

then you’d see it in your Deployment Manager:

Once it’s done you can see it also in the Compute Engine -> VM Instances section, where you can control the machine.

Step 3: Access Jupyter

This you would be doing every time you need access to your machine’s Jupyter server. Once the machine boots up it starts the Jupyter server, so really all we need is the hostname or ip address.

You can get the hostname in the command line if you have the gcloud utility installed (that’s easy to do).

The Deployment Manager screen can give you the command line to run to get the hostname: (the “copy” icon will copy the command into your clipboard so you can just paste it into the terminal)

$ gcloud compute instances describe --project  --zone us-east1-b  | grep googleusercontent.com | grep datalab

value: -dot-datalab-vm-us-east1.googleusercontent.com

The value is your machine’s hostname.

If you don’t want to install GCP command line utility to your personal machine, you can also get the hostname on the “cloud shell”:

The hostname will be the result of that command execution.

Once you have the hostname just copy and paste it in any browser and you’ll bet at your Jupyter server, ready to start learning.

Step 4: Manage your Machine

Your deep learning machine will charge your account by the hour, so it’s important to shut it off as soon as you’re done. These machines are quite costly (see the Deployment step), and will burn through your credits and soon Google will come after you for real money 💸.

To shut down your machine (after you’ve made sure to save everything you need), just go on the Compute Engine, And shut the machine down:

Later you can bring it back up in the same place by hitting the “Start” button.

 

This is pretty much it.

Enjoy deep learning!