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
deepspeed
Commits
7e3509bb
Unverified
Commit
7e3509bb
authored
Feb 27, 2020
by
Jeff Rasley
Committed by
GitHub
Feb 27, 2020
Browse files
if not init torch distributed in mpi mode, make sure they match (#112)
parent
fafc62fe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
deepspeed/pt/deepspeed_light.py
deepspeed/pt/deepspeed_light.py
+7
-3
No files found.
deepspeed/pt/deepspeed_light.py
View file @
7e3509bb
...
...
@@ -119,11 +119,11 @@ class DeepSpeedLight(Module):
self
.
gradient_average
=
True
self
.
warn_unscaled_loss
=
True
self
.
_mpi_check
(
args
)
if
dist_init_required
is
None
:
dist_init_required
=
not
dist
.
is_initialized
()
self
.
_mpi_check
(
args
,
dist_init_required
)
self
.
dist_backend
=
"nccl"
if
dist_init_required
:
if
not
dist
.
is_initialized
():
...
...
@@ -186,7 +186,7 @@ class DeepSpeedLight(Module):
if
self
.
dump_state
():
print_configuration
(
self
,
'DeepSpeedLight'
)
def
_mpi_check
(
self
,
args
):
def
_mpi_check
(
self
,
args
,
dist_init_required
):
if
hasattr
(
args
,
'deepspeed_mpi'
)
and
args
.
deepspeed_mpi
:
from
mpi4py
import
MPI
import
subprocess
...
...
@@ -220,6 +220,10 @@ class DeepSpeedLight(Module):
os
.
environ
[
'MASTER_ADDR'
],
os
.
environ
[
'MASTER_PORT'
]))
if
not
dist_init_required
and
dist
.
is_initialized
():
assert
dist
.
get_rank
()
==
rank
,
"MPI rank {} does not match torch rank {}"
.
format
(
rank
,
dist
.
get_rank
())
assert
dist
.
get_world_size
()
==
world_size
,
"MPI world size {} does not match torch world size {}"
.
format
(
world_size
,
dist
.
get_world_size
())
def
tensorboard_enabled
(
self
):
return
self
.
_config
.
tensorboard_enabled
...
...
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