How do I configure Google Cloud Datalab to use GPU

2019-05-01 01:08发布

问题:

I can import tensorflow and run models inside of Cloud Datalab, but how do I configure it to use GPUs?

The documentation here only talks about machines, which I'm not sure how to configure through Datalab: https://cloud.google.com/ml-engine/docs/how-tos/using-gpus

I've tried this:

datalab create --machine-type standard_gpu ml

and when I select the us-east1 region, I get the error:

Creating the instance ml
ERROR: (gcloud.compute.instances.create) Some requests did not succeed:
- Invalid value for field 'resource.machineType': 'https://www.googleapis.com/compute/v1/projects/project-160204/zones/us-east1-d/machineTypes/standard_gpu'. Machine type with name 'standard_gpu' does not exist in zone 'us-east1-d'.

回答1:

It is now possible to create datalab instances with GPUs: https://cloud.google.com/datalab/docs/reference/command-line/create

datalab beta create-gpu datalab-instance-name


回答2:

The page you link to (https://cloud.google.com/ml-engine/docs/how-tos/using-gpus) does describe how to use GPUs when training using the Google Cloud ML Engine API, and you can submit a job against the ML Engine API using Datalab. Some samples of that are included in Datalab (e.g. samples/ML Toolbox/Image Classification/Flower/Service End to End.ipynb)

If you want to train a Tensorflow model locally on the Datalab VM, then Datalab would have to be running against a GPU on the Datalab VM, which is not currently supported.



回答3:

According this document on GPUs on Compute Engine, only these zones provide GPU Machines for now.

  • us-west1-b
  • us-east1-d
  • europe-west1-b
  • asia-east1-a

You can create your GPU instance in gui https://console.cloud.google.com/compute/instances