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
apex
Commits
82dac9c9
Commit
82dac9c9
authored
Nov 22, 2019
by
Roshan Rao
Committed by
mcarilli
Nov 22, 2019
Browse files
update _amp_state to check distributed on maybe_print (#620)
parent
37cdaf4a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
6 deletions
+3
-6
apex/amp/_amp_state.py
apex/amp/_amp_state.py
+3
-6
No files found.
apex/amp/_amp_state.py
View file @
82dac9c9
# This is a "header object" that allows different amp modules to communicate.
# I'm a C++ guy, not a python guy. I decided this approach because it seemed most C++-like.
# I'm a C++ guy, not a python guy. I decided this approach because it seemed most C++-like.
# But apparently it's ok:
# http://effbot.org/pyfaq/how-do-i-share-global-variables-across-modules.htm
import
os
...
...
@@ -35,12 +35,9 @@ def warn_or_err(msg):
# "hard_override=True to amp.initialize.")
distributed
=
False
if
'WORLD_SIZE'
in
os
.
environ
:
distributed
=
int
(
os
.
environ
[
'WORLD_SIZE'
])
>
1
def
maybe_print
(
msg
,
rank0
=
False
):
distributed
=
torch
.
distributed
.
is_initialized
()
and
\
torch
.
distributed
.
get_world_size
()
>
1
if
_amp_state
.
verbosity
>
0
:
if
rank0
:
if
distributed
:
...
...
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