Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I configure Google Cloud Datalab to use GPUs for TensorFlow?

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'.
like image 268
skunkwerk Avatar asked Mar 09 '17 19:03

skunkwerk


2 Answers

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
like image 66
Paul Avatar answered Sep 28 '22 06:09

Paul


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.

like image 31
Chris Meyers Avatar answered Sep 28 '22 08:09

Chris Meyers