Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@ def attach_grad_to_optimizer_state(self):
"""
self.param_and_grad_buffer.update_main_grads()

def finish_grad_sync(self):
def finish_grad_sync(self, force_all_reduce: Optional[bool] = False):
"""
Finishes grad sync (all-reduce or reduce-scatter) communication operations
for all model gradients. Call prior to the optimization step to resolve
Expand All @@ -1114,6 +1114,9 @@ def finish_grad_sync(self):
When overlap_grad_reduce is set to True, waits for asynchronous communication
calls to complete. When overlap_grad_reduce is set to False, calls synchronous
communication ops.

NOTE: force_all_reduce is included as an argument to maintain API compatibility
with DDP.force_grad_sync.
"""
# Synchronize gradient reduce-scatter operations for all model gradients.
self.synchronize_gradient_reduce()
Expand Down
Loading