Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion deepspeed/comm/comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ def log_wrapper(*args, **kwargs):
finally:
if comms_logger.enabled:
# Need to make op blocking for accurate logging
get_accelerator().synchronize()
if should_profile:
get_accelerator().synchronize()
# If we're using MPI, we can't simply sync the stream
if cdb.using_mpi:
cdb.barrier()
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/comm/test_comms_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ def test_collective_profiling(monkeypatch, op_name, positional, debug, profile_m
backend = SimpleNamespace(using_mpi=False, is_initialized=lambda: True, get_world_size=lambda group=None: 2)
setattr(backend, op_name, backend_op)
monkeypatch.setattr(comm, 'cdb', backend)
monkeypatch.setattr(comm, 'get_accelerator', lambda: SimpleNamespace(synchronize=lambda: None))
synchronize = Mock()
monkeypatch.setattr(comm, 'get_accelerator', lambda: SimpleNamespace(synchronize=synchronize))
op_timer = Mock()
op_timer.elapsed.return_value = 1.0
timers = Mock(return_value=op_timer)
Expand Down Expand Up @@ -151,7 +152,9 @@ def test_collective_profiling(monkeypatch, op_name, positional, debug, profile_m
if profile_mode == 'unselected':
assert comm.comms_logger.comms_dict == {}
timers.assert_not_called()
synchronize.assert_not_called()
else:
synchronize.assert_called_once_with()
record_name, = comm.comms_logger.comms_dict
if debug:
assert record_name.startswith(log_name + ' | [Caller Func: ')
Expand Down
Loading