Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ColossalAI
Commits
7a64fae3
Unverified
Commit
7a64fae3
authored
Apr 26, 2022
by
Frank Lee
Committed by
GitHub
Apr 26, 2022
Browse files
[doc] improved error messages in initialize (#872)
parent
1190b2c4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
10 deletions
+28
-10
colossalai/initialize.py
colossalai/initialize.py
+28
-10
No files found.
colossalai/initialize.py
View file @
7a64fae3
...
...
@@ -138,8 +138,14 @@ def launch_from_slurm(config: Union[str, Path, Config, Dict],
seed (int, optional): Specified random seed for every process. Defaults to 1024.
verbose (bool, optional): Whether to print logs. Defaults to True.
"""
rank
=
int
(
os
.
environ
[
'SLURM_PROCID'
])
world_size
=
int
(
os
.
environ
[
'SLURM_NPROCS'
])
try
:
rank
=
int
(
os
.
environ
[
'SLURM_PROCID'
])
world_size
=
int
(
os
.
environ
[
'SLURM_NPROCS'
])
except
KeyError
as
e
:
raise
RuntimeError
(
f
"Could not find
{
e
}
in the SLURM environment, visit https://www.colossalai.org/ for more information on launching with SLURM"
)
launch
(
config
=
config
,
rank
=
rank
,
world_size
=
world_size
,
...
...
@@ -167,9 +173,15 @@ def launch_from_openmpi(config: Union[str, Path, Config, Dict],
seed (int, optional): Specified random seed for every process. Defaults to 1024.
verbose (bool, optional): Whether to print logs. Defaults to True.
"""
rank
=
int
(
os
.
environ
[
'OMPI_COMM_WORLD_RANK'
])
local_rank
=
int
(
os
.
environ
[
'OMPI_COMM_WORLD_LOCAL_RANK'
])
world_size
=
int
(
os
.
environ
[
'OMPI_COMM_WORLD_SIZE'
])
try
:
rank
=
int
(
os
.
environ
[
'OMPI_COMM_WORLD_RANK'
])
local_rank
=
int
(
os
.
environ
[
'OMPI_COMM_WORLD_LOCAL_RANK'
])
world_size
=
int
(
os
.
environ
[
'OMPI_COMM_WORLD_SIZE'
])
except
KeyError
as
e
:
raise
RuntimeError
(
f
"Could not find
{
e
}
in the OpenMPI environment, visit https://www.colossalai.org/ for more information on launching with OpenMPI"
)
launch
(
config
=
config
,
local_rank
=
local_rank
,
rank
=
rank
,
...
...
@@ -194,11 +206,17 @@ def launch_from_torch(config: Union[str, Path, Config, Dict],
seed (int, optional): Specified random seed for every process. Defaults to 1024.
verbose (bool, optional): Whether to print logs. Defaults to True.
"""
rank
=
int
(
os
.
environ
[
'RANK'
])
local_rank
=
int
(
os
.
environ
[
'LOCAL_RANK'
])
world_size
=
int
(
os
.
environ
[
'WORLD_SIZE'
])
host
=
os
.
environ
[
'MASTER_ADDR'
]
port
=
int
(
os
.
environ
[
'MASTER_PORT'
])
try
:
rank
=
int
(
os
.
environ
[
'RANK'
])
local_rank
=
int
(
os
.
environ
[
'LOCAL_RANK'
])
world_size
=
int
(
os
.
environ
[
'WORLD_SIZE'
])
host
=
os
.
environ
[
'MASTER_ADDR'
]
port
=
int
(
os
.
environ
[
'MASTER_PORT'
])
except
KeyError
as
e
:
raise
RuntimeError
(
f
"Could not find
{
e
}
in the torch environment, visit https://www.colossalai.org/ for more information on launching with torch"
)
launch
(
config
=
config
,
local_rank
=
local_rank
,
rank
=
rank
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment