SkillAgentSearch skills...

Gcloud

Google Cloud tutorial and setup

Install / Use

/learn @cs231n/Gcloud
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Google Cloud Setup and Tutorial

(Last Update on April 7, 2021)

Table of contents

  1. Overview
  2. Create and Configure Your Account
    1. Sign Up GCP for the First Time
    2. Configure Your Project
  3. Claim CS231N GCP credits
  4. Request an Increase in GPU Quota
    1. Why don't I See Any GPU-related Quota
  5. Set Up Google Cloud VM Image
    1. Customize VM Hardware
    2. Configure Networking
  6. Access Your Newly created VM
    1. Install gcloud command-line Tools
  7. Remote Server Development
    1. Using Jupyter Notebook with Google Compute Engine
    2. Verification
    3. Transferring Files From Your Instance To Your Computer
    4. Other Tips

Overview

For your class project, we recommend setting up a GPU instance on GCP (Google Cloud Platform).

BIG REMINDER: Make sure you stop your instances!

(We know you won't read until the very bottom once your assignment is running, so we are printing this at the top too since it is super important)

Don't forget to stop your instance when you are done (by clicking on the stop button at the top of the page showing your instances), otherwise you will run out of credits and that will be very sad. :(

If you follow our instructions below correctly, you should be able to restart your instance and the downloaded software will still be available.

Colab vs GCP

While Colab is good for assignments, and is still a helpful and free tool for experimentation for your project, you will likely need a dedicated GPU instance when you start training on large datasets and collaborating as a team:

  • Colab will disconnect after 12 hours or ~30 min of idling (and you will lose your unsaved data). A GCP VM instance will not disconnect untill you stop it (or run out of credits).
  • A GCP VM instance's disk space allows you to deal with larger datasets. In Colab's case, you will have to save all your data and models to Google Drive.
  • Colab does not innately support real-time collaboration.
  • You can choose your GPU models and can set >1 GPUs for distributed training on GCP.

Create and Configure Your Account

You should use your personal GMail account for GCP, i.e. NOT SUID@stanford.edu, because Stanford University managed email accounts do not support creating a new project.

For the class project, we offer students $50 GCP coupons for each student to use Google Compute Engine for developing and testing your implementations. When you first sign up on GCP, you will have $300 free credits.

If your credits ends up not being enough, contact course staff on Piazza. We will also send out forms for extra GCP credit request form later in the quarter.

This tutorial lists the necessary steps of working on the projects using Google Cloud. We expect this tutorial to take up to an hour. Don't get intimidated by the steps, we tried to make the tutorial detailed so that you are less likely to get stuck on a particular step. Please tag all questions related to Google Cloud with google_cloud on Piazza.

Sign Up GCP for the First Time

You should receive $300 credits from Google when you first sign up with Personal GMail and also UPGRADE it into a full account. Please try to use the resources judiciously.

  1. Create Google Cloud account by going to the Google Cloud homepage. Click on the blue Get Started for free button. Sign into your Gmail account. Here is an illustrative example.

  2. Choose Account type to be Individual. You will then fill in your name, address and credit card information.

  3. Click the "Google Cloud Platform" (in red circle), and it will take you to the main project dashboard:

Configure Your Project

  1. On the main project dashboard, you can change the name of your project by clicking Go to project settings.

  2. To add project collaborators, click ADD PEOPLE TO THIS PROJECT. Add their email and make their role owners.

  3. Upgrade your account in order to use GPUs following this instruction. Otherwise Google Cloud Free Tier does not come with GPU support or quota.

Claim CS231N GCP credits

NOTE: You should have created and logged in your GCP account registered with your personal gmail account by now.

  1. We will release the $50 GCP credits Google form on Piazza. After your complete the form, you will see a link to Google Cloud Education Grants page. It requires your Stanford email to receive the credits. (These credits can be applied to your GCP account registered with Personal GMail. )

  2. After submission, you should receive a email from GCP with a link to confirm your email address. Click the link to verify your Stanford email.

  3. You will soon receive another email from GCP with a link that applys the $50 credits to your account. After that the website will jump to your Billing page where you should see your have linked to CS231N billing account with $50 free credits.

  4. Switching billing accounts from Free Tier credits to CS231N credits Google Cloud does not support combining credits. You will need to switch billing account if you want to use 2 sources of gcloud credits.

i.e. You can use up the $300 free credits first. Then switch to the CS231N billing account referring to this GCloud documentation.

Request an Increase in GPU Quota

Your account typically does not come with GPU quota. You have to explicitly request for it under IAM Admin > Quotas.

Please request the quota increase ASAP, because they will take up between couple minutes to a week to process! If you don't have GPU quota, you will have to create a CPU-only VM first and create another GPU VM later, explained in the next section.

You will need to change your quota for GPU (all regions).

  1. Select Limit name from the dropdown. Then select GPUs (all regions) from the next prompted dropdown. Click the checkbox for Global in the menu to the right, and click into ALL QUOTAS.

  2. Select the checkbox to the left of the first item in the table, and click EDIT QUOTAS. Set the New limit to 1, and make the Request description "Stanford CS 231N class project".

  3. Wait until GCP sends you a second email (first email is just to notify they receive the request) that looks like this. It could take couple minutes to couple days for them to approve.

Why don't I See Any GPU-related Quota

  1. First, make sure you upgrade your free tier account to a full account following these instructions.

  2. If you just registered a Google Cloud account, GCP can be slow on setting up its Compute Engine API services (this is the service that provides GPU access, so the GPU quota won't show up before it is ready).

One way I found that can make Compute Engine API setup faster is by visiting the VM instance page by clicking Compute Engine > VM instances

If you see that Compute Engine is not ready yet, wait for couple minutes until you see something like this screenshot below. The GPU-related Quota should now show up in IAM Admin > Quotas.

  1. For region-specific GPUs: Check that you have a default zone and region set under Compute Engine > Settings > Region / Zone. Some zones do not have certain GPU resources. Check pricing and spec for GCP GPUs to find the availability of GPU resources.

More instructions at General quota instructions and Step-by-step GPU-specific walk-through (all answers in the link are useful)

Set Up Google Cloud VM Image

Customize VM Hardware

  1. Go to this gcloud marketplace. You may (or may not) be taken to a page where you have to click on "Launch", and then you should see a configuration sheet with the title "New Deep Learning VM deployment".
  2. Fill in Deployment name field with your preferred VM name.
  3. In Machine type box, click Customize.
  4. Choose your desired number of CPUs and memory (if you are unsure, keep the default).
  5. For GPU type, NVIDIA Tesla K80 is typically enough. P100 and V100 are way more expensive (check the price on the right), but also faster and has larger memory. Check [pricing and s

Related Skills

View on GitHub
GitHub Stars498
CategoryDevelopment
Updated1mo ago
Forks184

Languages

Python

Security Score

80/100

Audited on Feb 15, 2026

No findings