【问题标题】:Does Google Cloud ML support GPU?Google Cloud ML 是否支持 GPU?
【发布时间】:2017-02-02 16:19:30
【问题描述】:

我正在测试 Google Cloud ML,以便使用 Tensorflow 加速我的 ML 模型。

不幸的是,Google Cloud ML 似乎非常缓慢。我的主流级 PC 至少比 Google Cloud ML 快 10 倍。

我怀疑它使用 GPU,所以我做了一个测试。我修改了一个示例 code 以强制使用 GPU。

diff --git a/mnist/trainable/trainer/task.py b/mnist/trainable/trainer/task.py
index 9acb349..a64a11d 100644
--- a/mnist/trainable/trainer/task.py
+++ b/mnist/trainable/trainer/task.py
@@ -131,11 +131,12 @@ def run_training():
     images_placeholder, labels_placeholder = placeholder_inputs(
     FLAGS.batch_size)

-    # Build a Graph that computes predictions from the inference model.
-    logits = mnist.inference(images_placeholder, FLAGS.hidden1, FLAGS.hidden2)
+    with tf.device("/gpu:0"):
+      # Build a Graph that computes predictions from the inference model.
+      logits = mnist.inference(images_placeholder, FLAGS.hidden1, FLAGS.hidden2)

-    # Add to the Graph the Ops for loss calculation.
-    loss = mnist.loss(logits, labels_placeholder)
+      # Add to the Graph the Ops for loss calculation.
+      loss = mnist.loss(logits, labels_placeholder)

     # Add to the Graph the Ops that calculate and apply gradients.
     train_op = mnist.training(loss, FLAGS.learning_rate)

此培训代码适用于我的 PC (gcloud beta ml local train ...),但不适用于云端。它给出了这样的错误:

 "Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/root/.local/lib/python2.7/site-packages/trainer/task.py", line 239, in <module>
    tf.app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 43, in run
    sys.exit(main(sys.argv[:1] + flags_passthrough))
  File "/root/.local/lib/python2.7/site-packages/trainer/task.py", line 235, in main
    run_training()
  File "/root/.local/lib/python2.7/site-packages/trainer/task.py", line 177, in run_training
    sess.run(init)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 766, in run
    run_metadata_ptr)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 964, in _run
    feed_dict_string, options, run_metadata)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1014, in _do_run
    target_list, options, run_metadata)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 1034, in _do_call
    raise type(e)(node_def, op, message)
InvalidArgumentError: Cannot assign a device to node 'softmax_linear/biases': Could not satisfy explicit device specification '/device:GPU:0' because no devices matching that specification are registered in this process; available devices: /job:localhost/replica:0/task:0/cpu:0
Colocation Debug Info:
Colocation group had the following types and devices:
ApplyGradientDescent: CPU
Identity: CPU
Assign: CPU
Variable: CPU
     [[Node: softmax_linear/biases = Variable[container="", dtype=DT_FLOAT, shape=[10], shared_name="", _device="/device:GPU:0"]()]]

Google Cloud ML 是否支持 GPU?

【问题讨论】:

    标签: tensorflow google-cloud-platform google-cloud-ml


    【解决方案1】:

    GPU 现在处于测试阶段,所有 Cloud ML 客户都可以访问。

    这里是 docs 用于将 GPU 与 Cloud ML 结合使用。

    【讨论】:

    • 运气好让他们工作吗?当我尝试运行指定 GPU 的作业时,该作业只是在队列中... ``` gcloud beta ml 作业提交培训 gpu_job_basic_gpu \ --package-path=train \ --staging-bucket="${STAGING_BUCKET }" \ --module-name=train.1-multiply \ --region=us-central1 \ --scale-tier=BASIC_GPU ``
    • 尝试区域 us-east1。
    • 哇,好用。当文档明确说 Central 应该可以工作时,是什么让你直觉尝试东方?
    • 我在 Google 工作,负责 Cloud ML 中的 GPU。由于 GPU 的需求,我们已经搬出 us-central1。 docs 已更新以反映这一点。
    • 感谢您的更新,现在我的工作从东部跑出去了。
    猜你喜欢
    • 1970-01-01
    • 2017-09-05
    • 2016-06-09
    • 2017-10-24
    • 1970-01-01
    • 2017-10-04
    • 1970-01-01
    • 2019-01-08
    • 2019-10-12
    相关资源
    最近更新 更多