Skip to content

Commit 06d7ea7

Browse files
SSYernarfacebook-github-bot
authored andcommitted
Add Dynamic export_stacks Parameter to Benchmark Function (#3221)
Summary: Pull Request resolved: #3221 Introduced a dynamic `export_stacks` parameter to the benchmarking function. This allows users to control the export of stack files for profiling. Reviewed By: aliafzal Differential Revision: D78748689 fbshipit-source-id: ae285b665e40f43e6d6ed2beae46145b4f9aa3e4
1 parent 145441b commit 06d7ea7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

torchrec/distributed/benchmark/benchmark_utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,7 @@ def benchmark(
889889
enable_logging: bool = True,
890890
device_type: str = "cuda",
891891
benchmark_unsharded_module: bool = False,
892+
export_stacks: bool = False,
892893
) -> BenchmarkResult:
893894
if enable_logging:
894895
logger.info(f" BENCHMARK_MODEL[{name}]:\n{model}")
@@ -920,7 +921,7 @@ def _profile_iter_fn(prof: torch.profiler.profile) -> None:
920921
device_type=device_type,
921922
output_dir=output_dir,
922923
pre_gpu_load=0,
923-
export_stacks=True,
924+
export_stacks=export_stacks,
924925
reset_accumulated_memory_stats=False,
925926
)
926927

@@ -939,6 +940,7 @@ def benchmark_func(
939940
rank: int,
940941
device_type: str = "cuda",
941942
pre_gpu_load: int = 0,
943+
export_stacks: bool = False,
942944
) -> BenchmarkResult:
943945
if benchmark_func_kwargs is None:
944946
benchmark_func_kwargs = {}
@@ -963,7 +965,7 @@ def _profile_iter_fn(prof: torch.profiler.profile) -> None:
963965
device_type=device_type,
964966
output_dir=profile_dir,
965967
pre_gpu_load=pre_gpu_load,
966-
export_stacks=False,
968+
export_stacks=export_stacks,
967969
reset_accumulated_memory_stats=True,
968970
)
969971

0 commit comments

Comments
 (0)