Skip to content
Open
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
6 changes: 6 additions & 0 deletions fbgemm_gpu/fbgemm_gpu/tbe/bench/bench_runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ def benchmark_cpu_requests_mp(
float: The average runtime per iteration in seconds.

"""
import os
strategy = os.environ.get('PYTORCH_SHARE_STRATEGY')
current_strategy = torch.multiprocessing.get_sharing_strategy()
if strategy is not None and current_strategy != strategy:
torch.multiprocessing.set_sharing_strategy(strategy)

cpu_bm_barrier.create_barrier(num_copies)
worker_pool = torch.multiprocessing.Pool(num_copies)

Expand Down