Start spawn workers concurrently (#1553) - #1553
Open
psaikaushik wants to merge 1 commit into
Open
Conversation
|
@psaikaushik has exported this pull request. If you are a Meta employee, you can view the originating Diff in D118848297. |
psaikaushik
added a commit
to psaikaushik/data
that referenced
this pull request
Sep 5, 2026
Summary: Add an opt-in `spawn_worker_start_parallelism` argument to `StatefulDataLoader`. For the `spawn` multiprocessing context, worker `Process.start()` calls can run concurrently up to this bound. Other contexts and the default value of `1` preserve serial startup. Build all spawn workers before parallel startup, keep registration order deterministic, and clean up every partially started process and queue if a start fails. Add a reproducible EuroSAT benchmark modeled on the public PyTorch DataLoader benchmark from pytorch/pytorch#159432, including raw trial data and a publication-ready plotter. Differential Revision: D118848297 Signed-off-by: Sai Kaushik Ponnekanti <kaushikp@meta.com>
psaikaushik
force-pushed
the
export-D118848297
branch
from
September 5, 2026 01:10
9cbb70e to
d32bec7
Compare
Summary: Add an opt-in `spawn_worker_start_parallelism` argument to `StatefulDataLoader`. For the `spawn` multiprocessing context, worker `Process.start()` calls can run concurrently up to this bound. Other contexts and the default value of `1` preserve serial startup. Build all spawn workers before parallel startup, keep registration order deterministic, and clean up every partially started process and queue if a start fails. Add a reproducible EuroSAT benchmark modeled on the public PyTorch DataLoader benchmark from pytorch/pytorch#159432, including raw trial data and a publication-ready plotter. Differential Revision: D118848297 Signed-off-by: Sai Kaushik Ponnekanti <kaushikp@meta.com>
psaikaushik
force-pushed
the
export-D118848297
branch
from
September 5, 2026 01:12
d32bec7 to
d2524f8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Add an opt-in
spawn_worker_start_parallelismargument toStatefulDataLoader. For thespawnmultiprocessing context, workerProcess.start()calls can run concurrently up to this bound. Other contexts and the default value of1preserve serial startup.Build all spawn workers before parallel startup, keep registration order deterministic, and clean up every partially started process and queue if a start fails.
Public EuroSAT benchmark
Dataset: TorchVision EuroSAT, 27,000 real JPEG images across 10 classes. It is credential-free, auto-downloadable from a checksum-pinned URL, and its dataset class subclasses
ImageFolder. No dataset content is included in this change.Transforms:
ToDtype(torch.float32, scale=True),Resize(256, antialias=True),CenterCrop(224), and ImageNet normalization, usingtorchvision.io.decode_image.Public reproduction from the TorchData repository root:
Primary comparison: five matched trials in fresh Python processes, alternating p1/p8 ordering. Dataset download/extraction occurred before timing; filesystem cache was warm. Host: Linux, Python 3.12.14, PyTorch 2.15.0a0+fb, TorchVision 0.29.0a0+fb, AMD EPYC 9D64 (88 physical/176 logical cores), 251 GiB RAM, CPU-only.
The deterministic first-batch SHA-256 digest was identical in every run. Steady-state throughput is a no-regression control; the optimization targets startup only.
Visualization
Both series use
StatefulDataLoader; this is not Regular DataLoader versus StatefulDataLoader. Blue is the default serial worker startup (spawn_worker_start_parallelism=1), and orange changes only that value tonum_workers.The grouped bars are medians, whiskers are p10–p90, and outlined circles are every raw trial. The primary 8-worker slope panel connects the five matched p1/p8 runs. The 6.85x headline is the ratio of the two medians; the 6.79x value in the paired panel is the median of the five per-pair ratios. The checked-in
eurosat_spawn_results.jsoncontains every value used in the figure.Regenerate the plot from the public checkout with:
Worker-count scaling, median time to first batch:
Differential Revision: D118848297