From 852b7b4c995148239bafa21398bd9dae711bae1d Mon Sep 17 00:00:00 2001 From: Sam Larsen Date: Wed, 5 Jun 2024 17:04:21 -0700 Subject: [PATCH] [inductor] Enable subprocess-based parallel compile as the default (#126817) Differential Revision: [D58239826](https://our.internmc.facebook.com/intern/diff/D58239826) Pull Request resolved: https://github.com/pytorch/pytorch/pull/126817 Approved by: https://github.com/eellison ghstack dependencies: #128037, #128086 --- torch/_inductor/config.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/torch/_inductor/config.py b/torch/_inductor/config.py index b8ff5ae5a6c..dbaa528cd3e 100644 --- a/torch/_inductor/config.py +++ b/torch/_inductor/config.py @@ -387,7 +387,9 @@ developer_warnings = is_fbcode() or is_nightly_or_source # The multiprocessing start method to use for inductor workers in the codecache. # "subprocess", "fork", or "spawn" def decide_worker_start_method(): - start_method = os.environ.get("TORCHINDUCTOR_WORKER_START", "fork") + start_method = os.environ.get( + "TORCHINDUCTOR_WORKER_START", "fork" if is_fbcode() else "subprocess" + ) assert start_method in [ "subprocess", "fork",