I am trying to run a simple feed-forward network on multiple GPUs (to asynchronously updated shared weights).
However, I am unable to get the weights to be shared.
From the research I've done I just need to set reuse=True on variable_scope but that does not seem to be working:
for i_, gpu_id in enumerate(gpus):
with tf.device(gpu_id):
# [Build graph in here.]
with variable_scope.variable_scope(variable_scope.get_variable_scope(), reuse=i_>0):
x = tf.placeholder(tf.float32, [None, 784])
W = tf.Variable(tf.zeros([784, 10]))
b = tf.Variable(tf.zeros([10]))
y = tf.nn.softmax(tf.matmul(x, W) + b)
y_ = tf.placeholder(tf.float32, [None, 10])
# More code..., see pastebin link below
# Start an interactive tensorflow session
sess = tf.Session()
# Initialize all variables associated with this session
sess.run(tf.initialize_all_variables())
The above is a sample of the code, in the full code (https://pastebin.com/i4NBnHHC) I show how training on one GPU does not update the weights on the other GPUs.