【发布时间】:2016-03-06 08:32:41
【问题描述】:
我最近安装了用于分布式处理的tensorflow版本。 从trend,我尝试在多台计算机上使用多个gpu 实现,还找到了white paper 用于一些额外的规范。 我可以在 2 台不同的计算机上分别运行服务器和一个工作程序,分别具有 2 个和 1 个 gpus,并使用会话 grpc,在远程或本地模式下分配和运行程序。
我在远程计算机上运行了本地 tensorflow:
bazel-bin/tensorflow/core/distributed_runtime/rpc/grpc_tensorflow_server \
--cluster_spec='local|localhost:2500' --job_name=local --task_id=0 &
在服务器上使用
bazel-bin/tensorflow/core/distributed_runtime/rpc/grpc_tensorflow_server \
--cluster_spec='worker|192.168.170.193:2500,prs|192.168.170.226:2500' --job_name=worker --task_id=0 \
--job_name=prs --task_id=0 &
但是,当我尝试指定同时在 2 台计算机上运行的设备时,python 会显示错误:
Could not satisfy explicit device specification '/job:worker/task:0'
当我使用时
with tf.device("/job:prs/task:0/device:gpu:0"):
x = tf.placeholder(tf.float32, [None, 784], name='x-input')
W = tf.Variable(tf.zeros([784, 10]), name='weights')
with tf.device("/job:prs/task:0/device:gpu:1"):
b = tf.Variable(tf.zeros([10], name='bias'))
# Use a name scope to organize nodes in the graph visualizer
with tf.device("/job:worker/task:0/device:gpu:0"):
with tf.name_scope('Wx_b'):
y = tf.nn.softmax(tf.matmul(x, W) + b)
甚至更改工作名称。所以我想知道Add a New Device是否需要它,或者我可能在集群初始化时做错了什么。
【问题讨论】:
标签: python tensorflow