Skip to content
Closed
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 torch/_inductor/async_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@

kernel_code_log = torch._logging.getArtifactLogger(__name__, "kernel_code")

log = logging.getLogger(__name__)


def pre_fork_setup():
"""
Expand Down Expand Up @@ -160,10 +162,14 @@ def process_pool() -> AnyPool:
pool: AnyPool
if get_worker_start_method() == "subprocess":
# Wrapper around ProcessPoolExecutor forks in a new process we control
log.info("Creating subprocess pool with %d workers", get_compile_threads())
pool = SubprocPool(get_compile_threads())
else:
pre_fork_setup()
ctx = multiprocessing.get_context(get_worker_start_method())
log.info(
"Creating forked subprocess pool with %d workers", get_compile_threads()
)
pool = ProcessPoolExecutor(
get_compile_threads(),
mp_context=ctx,
Expand Down
Loading