Skip to content

Commit

Permalink
[Bug Fix] convert environment variables' types (PaddlePaddle#55586)
Browse files Browse the repository at this point in the history
  • Loading branch information
Windfarer authored and wz1qqx committed Jul 31, 2023
1 parent 22e697b commit 08da996
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 26 deletions.
5 changes: 3 additions & 2 deletions python/paddle/distributed/launch/context/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ def continous_log(self) -> bool:

def set_env_in_args(self):
for k, v in env_args_mapping.items():
attr, attr_type = v
if k in self.envs:
print(
f"LAUNCH WARNNING args {v} is override by env {self.envs[k]}"
f"LAUNCH WARNNING args {attr} will be overridden by env: {k} value: {self.envs[k]}"
)
setattr(self.args, v, self.envs[k])
setattr(self.args, attr, attr_type(self.envs[k]))
48 changes: 24 additions & 24 deletions python/paddle/distributed/launch/context/args_envs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,30 @@
from distutils.util import strtobool

env_args_mapping = {
'POD_IP': 'host',
'PADDLE_MASTER': 'master',
'PADDLE_DEVICES': 'devices',
'PADDLE_NNODES': 'nnodes',
'PADDLE_RUN_MODE': 'run_mode',
'PADDLE_LOG_LEVEL': 'log_level',
'PADDLE_LOG_OVERWRITE': 'log_overwrite',
'PADDLE_SORT_IP': 'sort_ip',
'PADDLE_NPROC_PER_NODE': 'nproc_per_node',
'PADDLE_JOB_ID': 'job_id',
'PADDLE_RANK': 'rank',
'PADDLE_LOG_DIR': 'log_dir',
'PADDLE_MAX_RESTART': 'max_restart',
'PADDLE_ELASTIC_LEVEL': 'elastic_level',
'PADDLE_ELASTIC_TIMEOUT': 'elastic_timeout',
'PADDLE_SERVER_NUM': 'server_num',
'PADDLE_TRAINER_NUM': 'trainer_num',
'PADDLE_SERVERS_ENDPOINTS': 'servers',
'PADDLE_TRAINERS_ENDPOINTS': 'trainers',
'PADDLE_GLOO_PORT': 'gloo_port',
'PADDLE_WITH_GLOO': 'with_gloo',
'PADDLE_START_PORT': 'start_port',
'PADDLE_IPS': 'ips',
"PADDLE_AUTO_PARALLEL_CONFIG": 'auto_parallel_config',
'POD_IP': ('host', str),
'PADDLE_MASTER': ('master', str),
'PADDLE_DEVICES': ('devices', str),
'PADDLE_NNODES': ('nnodes', str),
'PADDLE_RUN_MODE': ('run_mode', str),
'PADDLE_LOG_LEVEL': ('log_level', str),
'PADDLE_LOG_OVERWRITE': ('log_overwrite', strtobool),
'PADDLE_SORT_IP': ('sort_ip', strtobool),
'PADDLE_NPROC_PER_NODE': ('nproc_per_node', int),
'PADDLE_JOB_ID': ('job_id', str),
'PADDLE_RANK': ('rank', int),
'PADDLE_LOG_DIR': ('log_dir', str),
'PADDLE_MAX_RESTART': ('max_restart', int),
'PADDLE_ELASTIC_LEVEL': ('elastic_level', int),
'PADDLE_ELASTIC_TIMEOUT': ('elastic_timeout', int),
'PADDLE_SERVER_NUM': ('server_num', int),
'PADDLE_TRAINER_NUM': ('trainer_num', int),
'PADDLE_SERVERS_ENDPOINTS': ('servers', str),
'PADDLE_TRAINERS_ENDPOINTS': ('trainers', str),
'PADDLE_GLOO_PORT': ('gloo_port', int),
'PADDLE_WITH_GLOO': ('with_gloo', str),
'PADDLE_START_PORT': ('start_port', int),
'PADDLE_IPS': ('ips', str),
"PADDLE_AUTO_PARALLEL_CONFIG": ('auto_parallel_config', str),
}


Expand Down

0 comments on commit 08da996

Please sign in to comment.