我正在尝试学习分布式TensorFlow。根据这里的解释,试用了一段代码:
with tf.device("/cpu:0"):
W = tf.Variable(tf.zeros([784, 10]))
b = tf.Variable(tf.zeros([10]))
with tf.device("/cpu:1"):
y = tf.nn.softmax(tf.matmul(x, W) + b)
loss = tf.reduce_mean(-tf.reduce_sum(y_ * tf.log(y), reduction_indices=[1]))
遇到以下错误:
tensorflow.python.framework.errors_impl.InvalidArgumentError: 不能为操作'MatMul'分配设备:操作明确分配给/device:CPU:1,但可用的设备是[/job:localhost/replica:0/task:0/cpu:0]。请确保设备规范引用有效设备。 [[Node: MatMul = MatMul[T=DT_FLOAT, transpose_a=false, transpose_b=false, _device="/device:CPU:1"](Placeholder, Variable/read)]]
这意味着TensorFlow无法识别 CPU:1。
我正在一台具有40个CPU的RedHat服务器上运行 (cat /proc/cpuinfo | grep processor | wc -l
)。
有什么想法吗?