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
2 changes: 1 addition & 1 deletion deepspeed/utils/comms_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def start_profiling_comms(self):
self.prof_all = True

def stop_profiling_comms(self):
self.prof_all = True
self.prof_all = False

# E.g. start_profiling_op('all_reduce')
def start_profiling_op(self, op_name_list):
Expand Down
19 changes: 19 additions & 0 deletions tests/unit/comm/test_comms_logger.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (c) DeepSpeed Team.
# SPDX-License-Identifier: Apache-2.0

# DeepSpeed Team

from deepspeed.utils.comms_logging import CommsLogger


def test_stop_profiling_comms_disables_prof_all():
# start_profiling_comms()/stop_profiling_comms() toggle the global comm
# profiling flag prof_all. stop_profiling_comms() must clear it; otherwise
# global comm profiling can never be turned off once it has been started.
comms_logger = CommsLogger()

comms_logger.start_profiling_comms()
assert comms_logger.prof_all is True

comms_logger.stop_profiling_comms()
assert comms_logger.prof_all is False
Loading