INNER CODE UNIT · Python
suspend
bytedance/byteps · byteps/common/__init__.py:71
def suspend(self):
"""A function that suspends BytePS for elastic training."""
return self.C_LIB_CTYPES.byteps_suspend()
def resume(self, num_workers, num_servers, global_rank, context=None):
"""A function that restarts BytePS after being suspended, for elastic training."""
# set DMLC environment variables here
os.environ['DMLC_NUM_WORKER'] = str(num_workers)
os.environ['DMLC_NUM_SERVER'] = str(num_servers)
os.environ['BYTEPS_GLOBAL_RANK'] = str(global_rank)
return self.C_LIB_CTYPES.byteps_resume(num_workers, num_servers)
def size(self):
"""A function that returns the number of BytePS processes.
Returns:
An integer scalar containing the number of BytePS processes.
"""
size = self.C_LIB_CTYPES.byteps_size()