docstr: Adds ops to enqueue on all worker queues.
  
  Args:
      name: prefixed for the shared_name of ops.
      dependencies: control dependency from ops.
  
  Returns:
      an op that should be used as control dependency before starting next step.
docstr_tok: ["Adds","ops","to","enqueue","on","all","worker","queues",".","Args",":","name",":","prefixed","for","the","shared_name","of","ops",".","dependencies",":","control","dependency","from","ops",".","Returns",":","an","op","that","should","be","used","as","control","dependency","before","starting","next","step","."]
code: def _add_sync_queues_and_barrier(self, name, dependencies):
      """Adds ops to enqueue on all worker queues.
  
      Args:
          name: prefixed for the shared_name of ops.
          dependencies: control dependency from ops.
  
      Returns:
          an op that should be used as control dependency before starting next step.
      """
      self._sync_queue_counter += 1
      with tf.device(
          self.sync_queue_devices[
              self._sync_queue_counter % len(self.sync_queue_devices)
          ]
      ):
          sync_queues = [
              tf.FIFOQueue(
                  self.num_worker,
                  [tf.bool],
                  shapes=[[]],
                  shared_name="%s%s" % (name, i),
              )
              for i in range(self.num_worker)
          ]
          queue_ops = []
          # For each other worker, add an entry in a queue, signaling that it can finish this step.
          token = tf.constant(False)
          with tf.control_dependencies(dependencies):
              for i, q in enumerate(sync_queues):
                  if i != self.task_index:
                      queue_ops.append(q.enqueue(token))
  
          # Drain tokens off queue for this worker, one for each other worker.
          queue_ops.append(
              sync_queues[self.task_index].dequeue_many(
                  len(sync_queues) - 1
              )
          )
  
          return tf.group(*queue_ops, name=name)
  
imports: import re
  import tensorflow
  from ..tfutils.common import get_global_step_var, get_op_tensor_name
  from ..utils import logger
  from ..utils.argtools import memoized
  from .training import DataParallelBuilder, GraphBuilder
  from .utils import OverrideCachingDevice, split_grad_list, allreduce_grads_naive, override_to_local_variable
label_desc: Use image node_id 2 for calling the DistributedBuilderBase obj's underlying member method code with example usage: obj._add_sync_queues_and_barrier(name, dependencies) and returns: tf