[profiler] add send/recv src/dst info (#111811)

Summary: There is an ask to add src/dst to nccl trace. This feels like the easiest way to do - adding it to metadata seems to require plumbing a few stacks so will be more work

Test Plan: {F1128545195}

Reviewed By: davidberard98

Differential Revision: D50560692

Pull Request resolved: https://github.com/pytorch/pytorch/pull/111811
Approved by: https://github.com/davidberard98, https://github.com/aaronenyeshi, https://github.com/fduwjj
This commit is contained in:
Xiaodong Wang
2023-10-28 02:48:21 +00:00
committed by PyTorch MergeBot
parent 2c7c2b7827
commit 3080fd8383
2 changed files with 8 additions and 4 deletions

View File

@ -185,13 +185,17 @@ DEFAULT_TIMEOUT = 300
CUSTOMIZED_TIMEOUT = {"test_DistributedDataParallel": 500}
def get_profiling_event(postfix, profiler):
def get_profiling_event(event_name, profiler):
event_list = (
profiler.events()
if isinstance(profiler, torch.profiler.profile)
else profiler.function_events
)
return [event for event in event_list if event.name.endswith(postfix)]
return [
event for event in event_list if (
event.name.endswith(event_name) or event.name.startswith(event_name)
)
]
# Base error message substring on unfinished reductions.