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
ae7f0def
Commit
ae7f0def
authored
Jun 13, 2019
by
Michael Carilli
Browse files
disable_allreduce -> _disable_allreduce
parent
1c2ba890
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
apex/parallel/distributed.py
apex/parallel/distributed.py
+7
-7
No files found.
apex/parallel/distributed.py
View file @
ae7f0def
...
...
@@ -216,7 +216,7 @@ class DistributedDataParallel(Module):
self
.
module
=
module
self
.
disable_allreduce
=
False
self
.
_
disable_allreduce
=
False
if
self
.
_backend
==
self
.
backend_enum_holder
.
NCCL
:
for
param
in
self
.
module
.
parameters
():
...
...
@@ -252,11 +252,11 @@ class DistributedDataParallel(Module):
del
attrs
[
'self.reduction_event'
]
return
attrs
def
turn_on
_allreduce
(
self
):
self
.
disable_allreduce
=
False
def
enable
_allreduce
(
self
):
self
.
_
disable_allreduce
=
False
def
turn_off
_allreduce
(
self
):
self
.
disable_allreduce
=
True
def
disable
_allreduce
(
self
):
self
.
_
disable_allreduce
=
True
# Broadcast rank 0's bucket structure across all processes, and have all processes
# regenerate their bucket structures to match.
...
...
@@ -335,7 +335,7 @@ class DistributedDataParallel(Module):
grad_acc
=
param_tmp
.
grad_fn
.
next_functions
[
0
][
0
]
def
allreduce_hook
(
*
unused
):
if
not
self
.
disable_allreduce
:
if
not
self
.
_
disable_allreduce
:
if
self
.
delay_allreduce
or
self
.
needs_refresh
:
# TODO: How do we want to handle multiple backward passes between
# each forward, e.g., backward passes with retain_graph=True?
...
...
@@ -479,7 +479,7 @@ class DistributedDataParallel(Module):
def
forward
(
self
,
*
inputs
,
**
kwargs
):
result
=
self
.
module
(
*
inputs
,
**
kwargs
)
if
not
self
.
disable_allreduce
:
if
not
self
.
_
disable_allreduce
:
if
not
self
.
delay_allreduce
:
param_list
=
[
param
for
param
in
self
.
module
.
parameters
()
if
param
.
requires_grad
]
...
...
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