Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update HasAllMultiClientEnvVars() #5459

Merged
merged 5 commits into from
Jul 12, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions oneflow/python/framework/env_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,13 +394,12 @@ def GetEnvDefaultParallelConf(device_tag):


def HasAllMultiClientEnvVars():
return (
os.getenv("MASTER_ADDR")
and os.getenv("MASTER_PORT")
and os.getenv("WORLD_SIZE")
and os.getenv("RANK")
and os.getenv("LOCAL_RANK")
)
env_var_names = ["MASTER_ADDR", "MASTER_PORT", "WORLD_SIZE", "RANK", "LOCAL_RANK"]
has_all_env_vars = all([os.getenv(x) for x in env_var_names])
if not has_all_env_vars:
has_at_least_one_env_var = any([os.getenv(x) for x in env_var_names])
assert not has_at_least_one_env_var
return has_all_env_vars


def _UpdateDefaultEnvProtoByMultiClientEnvVars(env_proto):
Expand Down