I am launching a large distributed Tensorflow model in the Google cloud ML engine. I want to use machines with GPUs. My chart consists of two main parts: data input / read function and computing part.
I want to place the variables in the PS task, the input part in the CPU and the computing part on the GPU. The tf.train.replica_device_setter function automatically places the variables in the PS server.
This is what my code looks like:
with tf.device(tf.train.replica_device_setter(cluster=cluster_spec)): input_tensors = model.input_fn(...) output_tensors = model.model_fn(input_tensors, ...)
Is it possible to use tf.device() together with replica_device_setter() , as in:
with tf.device(tf.train.replica_device_setter(cluster=cluster_spec)): with tf.device('/cpu:0') input_tensors = model.input_fn(...) with tf.device('/gpu:0') tensor_dict = model.model_fn(input_tensors, ...)
Will replica_divice_setter() be overridden and the variables are not placed on the PS server?
Also, since the device names in the cluster are similar to job:master/replica:0/task:0/gpu:0 , how can I tell Tensorflow tf.device(whatever/gpu:0) ?
source share