docstr: Returns collectives and other info to be used in tests.
  
  Args:
    num_processes: an integer indicating the number of processes that
      participate in the collective.
    gpu_per_process: number of GPUs (0 if no GPUs) used by each process.
  
  Returns:
   A tuple of (collective, devices, pid) where collective is a instance
   of `CollectiveAllReduce`, devices are a list of local devices (str)
   attached to the current process, and pid is the id of this process among
   all participant processes.
docstr_tok: ["Returns","collectives","and","other","info","to","be","used","in","tests",".","Args",":","num_processes",":","an","integer","indicating","the","number","of","processes","that","participate","in","the","collective",".","gpu_per_process",":","number","of","GPUs","(","0","if","no","GPUs",")","used","by","each","process",".","Returns",":","A","tuple","of","(","collective",",","devices",",","pid",")","where","collective","is","a","instance","of","`","CollectiveAllReduce","`",",","devices","are","a","list","of","local","devices","(","str",")","attached","to","the","current","process",",","and","pid","is","the","id","of","this","process","among","all","participant","processes","."]
code: def make_collective(self, num_processes, gpu_per_process):
      """Returns collectives and other info to be used in tests.
  
      Args:
        num_processes: an integer indicating the number of processes that
          participate in the collective.
        gpu_per_process: number of GPUs (0 if no GPUs) used by each process.
  
      Returns:
       A tuple of (collective, devices, pid) where collective is a instance
       of `CollectiveAllReduce`, devices are a list of local devices (str)
       attached to the current process, and pid is the id of this process among
       all participant processes.
      """
  
      cluster_resolver = cluster_resolver_lib.TFConfigClusterResolver()
      devices = [
          "/job:worker/replica:0/task:%d/device:CPU:0"
          % cluster_resolver.task_id
      ]
      if gpu_per_process > 0:
          devices = [
              "/job:worker/replica:0/task:%d/device:GPU:%d"
              % (cluster_resolver.task_id, i)
              for i in range(gpu_per_process)
          ]
      group_size = num_processes * len(devices)
      collective = cross_device_ops_lib.CollectiveAllReduce(
          devices=devices,
          group_size=group_size,
          options=collective_util.Options(),
      )
      return collective, devices, cluster_resolver.task_id
  
imports: import collections
  import os
  import threading
  import time
  from absl.testing import parameterized
  from tensorflow.core.protobuf import config_pb2
  from tensorflow.core.protobuf import tensorflow_server_pb2
  from tensorflow.python.distribute import cluster_resolver
  from tensorflow.python.distribute import collective_util
  from tensorflow.python.distribute import combinations
  from tensorflow.python.distribute import cross_device_ops
  from tensorflow.python.distribute import cross_device_utils
  from tensorflow.python.distribute import device_util
  from tensorflow.python.distribute import multi_process_runner
  from tensorflow.python.distribute import multi_worker_test_base
  from tensorflow.python.distribute import reduce_util
  from tensorflow.python.distribute import test_util
  from tensorflow.python.distribute import values
  from tensorflow.python.eager import context
  from tensorflow.python.eager import def_function
  from tensorflow.python.eager import test
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import indexed_slices
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import collective_ops
  from tensorflow.python.ops import cond
  from tensorflow.python.ops import math_ops
  from tensorflow.python.util import nest
label_desc: Use image node_id 2 for calling the CollectiveOpsTest obj's underlying member method code with example usage: obj.make_collective(num_processes, gpu_per_process) and returns: collective,  devices,  cluster_resolver