This topic contains instructions for creating a new Deep Learning VM Images instance
from the command line. You can use the
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:
- Download and install the Cloud SDK using the instructions given on Installing Google Cloud SDK.
- Initialize the SDK using the instructions given on Initializing Cloud SDK.
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
--image-familymust be one of the CPU-specific image types. For more information, see Choosing an Image.
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"
--image-familymust be one of the GPU-specific image types. For more information, see Choosing an Image.
TERMINATE. See GPU Restrictions to learn more.
--acceleratorspecifies the GPU type to use. Must be specified in the format
--accelerator="type=TYPE,count=COUNT". Supported values of
Not all GPU types are supported in all regions. For details, see GPUs on Compute Engine.
--metadatais 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
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:
Follow the instructions located above to create a new instance. To the
gcloud compute instances createcommand, append the following:
For instructions on connecting to your new Deep Learning VM instance
through the Cloud Console or command line, see Connecting to
Instances. Your instance name
is the Deployment name you specified with