Skip to content

Commit

Permalink
[benchmark_litgpt] always destroy_process_group with `try-except-fi…
Browse files Browse the repository at this point in the history
…nally` (#1108)
  • Loading branch information
crcrpar authored Sep 5, 2024
1 parent d70b10e commit f915c3c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions thunder/benchmarks/benchmark_litgpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,8 +875,11 @@ def benchmark_main(return_metrics_as_json=False, json_path="", **kwargs) -> None

from jsonargparse import CLI

CLI(benchmark_main)

# ref: https://github.com/pytorch/pytorch/blob/3af12447/torch/csrc/distributed/c10d/ProcessGroupNCCL.cpp#L1110-L1116
if world_size > 1:
torch_dist.destroy_process_group()
try:
CLI(benchmark_main)
except Exception:
raise
finally:
# ref: https://github.com/pytorch/pytorch/blob/3af12447/torch/csrc/distributed/c10d/ProcessGroupNCCL.cpp#L1110-L1116
if world_size > 1:
torch_dist.destroy_process_group()

0 comments on commit f915c3c

Please sign in to comment.