class_docstr: Tests for ops in horovod.tensorflow.keras using multiple process sets.
class_docstr_tok: ["Tests","for","ops","in","horovod.tensorflow.keras","using","multiple","process","sets","."]
docstr: Initializes Horovod with two process sets
docstr_tok: ["Initializes","Horovod","with","two","process","sets"]
code: def setUpClass(cls):
      """Initializes Horovod with two process sets"""
      _, size = get_env_rank_and_size()
  
      cls.even_ranks = [rk for rk in range(0, size) if rk % 2 == 0]
      cls.odd_ranks = [rk for rk in range(0, size) if rk % 2 == 1]
      cls.even_set = hvd.ProcessSet(cls.even_ranks)
      cls.odd_set = hvd.ProcessSet(cls.odd_ranks)
  
      hvd.init(process_sets=[cls.even_set, cls.odd_set])
  
      gpus = tf.config.experimental.list_physical_devices("GPU")
      for gpu in gpus:
          tf.config.experimental.set_memory_growth(gpu, True)
      if gpus:
          tf.config.experimental.set_visible_devices(
              gpus[hvd.local_rank()], "GPU"
          )
  
file_path: horovod/test/parallel/test_tensorflow2_keras_process_sets.py
imports: import tensorflow
  import warnings
  from packaging import version
  import pytest
  from tensorflow import keras
  import horovod.tensorflow.keras
  from horovod.runner.common.util.env import get_env_rank_and_size
label_desc: Use image node_id 2 for calling the Tf2KerasProcessSetsTests obj's underlying member method code with example usage: obj.setUpClass(cls) without return types