Skip to Content
Deep Learning with TensorFlow - Second Edition
book

Deep Learning with TensorFlow - Second Edition

by Giancarlo Zaccone, Vihan Jain, Md. Rezaul Karim, Motaz Saad
March 2018
Intermediate to advanced content levelIntermediate to advanced
484 pages
10h 31m
English
Packt Publishing
Content preview from Deep Learning with TensorFlow - Second Edition

The distributed TensorFlow setup

In this section, we will explore the mechanisms through which computation in TensorFlow can be distributed. The first step in running distributed TensorFlow is to specify the architecture of the cluster using tf.train.ClusterSpec:

import tensorflow as tf

cluster = tf.train.ClusterSpec({"ps": ["localhost:2222"],\
                                "worker": ["localhost:2223",\
                                           "localhost:2224"]})

Nodes are typically divided into two jobs: parameter servers (ps), which host variables, and workers, which perform heavy computation. In the preceding code, we have one parameter server and two workers, as well as the IP address and port of each node.

Then we have to build a tf.train.Server for each parameter server and worker, previously defined:

ps = tf.train.Server(cluster, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Deep Learning with TensorFlow

Deep Learning with TensorFlow

Giancarlo Zaccone, Fabrizio Milo, Md. Rezaul Karim, Ahmed Menshawy
Deep Learning with TensorFlow 2 and Keras - Second Edition

Deep Learning with TensorFlow 2 and Keras - Second Edition

Antonio Gulli, Dr. Amita Kapoor, Sujit Pal
TensorFlow for Deep Learning

TensorFlow for Deep Learning

Bharath Ramsundar, Reza Bosagh Zadeh

Publisher Resources

ISBN: 9781788831109Supplemental Content