Create a Deep Learning VM instance from the command line (original) (raw)

This document contains instructions for creating a new Deep Learning VM Images instance from the command line. You can use the gcloud command-line tool with your preferred SSH application or in Cloud Shell.

Before you begin

To use the Google Cloud CLI to create a new Deep Learning VM instance, you must first install and initialize the Google Cloud CLI:

  1. Download and install the Google Cloud CLI using the instructions given onInstalling Google Cloud CLI.
  2. Initialize the SDK using the instructions given inInitialize the gcloud CLI.

To use gcloud in Cloud Shell, first activate Cloud Shell using the instructions given on Starting Cloud Shell.

Next, choose the specific Deep Learning VM image to use. Your choice depends on your preferred framework and processor type. For more information about the available images, see Choosing an Image.

Creating an instance without GPUs

To provision a Deep Learning VM instance with a CPU but no GPU:

export IMAGE_FAMILY="tf-ent-latest-cpu"
export ZONE="us-west1-b"
export INSTANCE_NAME="my-instance"

gcloud compute instances create $INSTANCE_NAME \
  --zone=$ZONE \
  --image-family=$IMAGE_FAMILY \
  --image-project=deeplearning-platform-release

Options:

Creating an instance with one or more GPUs

Compute Engine offers the option of adding GPUs to your virtual machine instances. GPUs offer faster processing for many complex data and machine learning tasks. To learn more about GPUs, see GPUs on Compute Engine.

To provision a Deep Learning VM instance with one or more GPUs:

export IMAGE_FAMILY="tf-ent-latest-gpu"
export ZONE="us-west1-b"
export INSTANCE_NAME="my-instance"

gcloud compute instances create $INSTANCE_NAME \
  --zone=$ZONE \
  --image-family=$IMAGE_FAMILY \
  --image-project=deeplearning-platform-release \
  --maintenance-policy=TERMINATE \
  --accelerator="type=nvidia-tesla-v100,count=1" \
  --metadata="install-nvidia-driver=True"

Options:

If you've elected to install NVIDIA drivers, allow 3-5 minutes for installation to complete.

It may take up to 5 minutes before your VM is fully provisioned. In this time, you will be unable to connect to your instance using SSH. When the installation is complete, to ensure that the driver installation was successful, you can connect to your instance using SSH and run nvidia-smi.

When you've configured your image, you can save a snapshot of your image so that you can start derivative instances without having to wait for the driver installation.

Creating a preemptible instance

You can create a preemptible Deep Learning VM instance. A preemptible instance is an instance you can create and run at a much lower price than normal instances. However, Compute Engine might stop (preempt) these instances if it requires access to those resources for other tasks. Preemptible instances always stop after 24 hours. To learn more about preemptible instances, see Preemptible VM Instances.

To create a preemptible Deep Learning VM instance:

What's next

For instructions on connecting to your new Deep Learning VM instance through the Google Cloud console or command line, see Connecting to Instances. Your instance name is the Deployment name you specified with -vm appended.