Creating a Deep Learning VM Instance From the Command Line

This topic contains instructions for creating a new instance of a AI Platform Deep Learning VM Image 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 gcloud command-line tool to create a new Deep Learning VM instance, you must first install and initialize the Cloud SDK:

  1. Download and install the Cloud SDK using the instructions given on Installing Google Cloud SDK.
  2. Initialize the SDK using the instructions given on Initializing Cloud SDK.

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-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:

  • --image-family must be one of the CPU-specific image types. For more information, see Choosing an Image.

  • --image-project must be deeplearning-platform-release.

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-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:

  • --image-family must be one of the GPU-specific image types. For more information, see Choosing an Image.

  • --image-project must be deeplearning-platform-release.

  • --maintenance-policy must be TERMINATE. See GPU Restrictions to learn more.

  • --accelerator specifies the GPU type to use. Must be specified in the format --accelerator="type=TYPE,count=COUNT". Supported values of TYPE are:

    • nvidia-tesla-v100 (count=1 or 8)
    • nvidia-tesla-p100 (count=1, 2, or 4)
    • nvidia-tesla-p4 (count=1, 2, or 4)
    • nvidia-tesla-k80 (count=1, 2, 4, or 8)

    Not all GPU types are supported in all regions. For details, see GPUs on Compute Engine.

  • --metadata is used to specify that the NVIDIA driver should be installed on your behalf. The value is install-nvidia-driver=True. If specified, Compute Engine loads the latest stable driver on the first boot and performs the necessary steps (including a final reboot to activate the driver).

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 SSH into your machine. When the installation is complete, to guarantee that the driver installation was successful, you can SSH in 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 terminate (preempt) these instances if it requires access to those resources for other tasks. Preemptible instances will always terminate after 24 hours. To learn more about preemptible instances, see Preemptible VM Instances.

To create a preemptible Deep Learning VM instance:

  • Follow the instructions located above to create a new instance. To the gcloud compute instances create command, append the following:

      --preemptible

What's next

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

Оцените, насколько информация на этой странице была вам полезна:

Оставить отзыв о...

Текущей странице
Deep Learning VM
Нужна помощь? Обратитесь в службу поддержки.