def env_init(): global default_env_proto assert len(default_env_proto.machine) > 0 CompleteEnvProto(default_env_proto) c_api_util.InitEnv(default_env_proto) if oneflow_api.CurrentMachineId() == 0: scope_util.InitScopeStack() else: exit(0) return True
def get_current_machine_id() -> int: return oneflow_api.CurrentMachineId()
def is_current_machine_master(ctx): return oneflow_api.CurrentMachineId() == 0