To use multiple nodes, you can use TensorFlow's "MultiWorkerMirroredStrategy" variable, which is described in their article Distributed Training with TensorFlow.
The collective operations include the following options:
CollectiveCommunication.RING
Implements ring-based collectives using gRPC as the communication layer.
CollectiveCommunication.NCCL
Uses NVIDIA's NCCL to implement collectives.
CollectiveCommunication.AUTO
Defers the choice to the runtime.
You also need to set up the TF_CONFIG environment variable, which is required by TensorFlow:
if dist_nodes :
index = int(sys.argv[1]) # $@ has n indices indicating n nodes
verbose = index < 1 # verbose is True only when index = 0
nodes=[]
# node names for each node, append a port # to the names
for i in range(2,len(sys.argv)):
nodes.append(sys.argv[i] + ':2001')
# set TF_CONFIG variable that MultiWorkerMirroredStrategy needs
os.environ['TF_CONFIG'] = json.dumps({
'cluster': {
'worker': nodes
},
'task': {'type': 'worker', 'index': index}
})
print(os.environ['TF_CONFIG'])
##