Use a portable job count for -j in the Arm build docs and notebooks - #22585
Use a portable job count for -j in the Arm build docs and notebooks#22585ShamSaleem wants to merge 1 commit into
Conversation
The Arm flow supports macOS on Apple Silicon: the Ethos-U getting-started tutorial lists it under Prerequisites, backends/arm/scripts/utils.sh accepts only Linux and Darwin on arm64, and toolchain_utils.sh fetches a darwin-arm64 bare-metal toolchain. macOS has no nproc, so every documented build command in this flow loses its -j argument there and falls back to an unbounded parallel build. Replace the bare -j$(nproc) with the portable form already used elsewhere in the tree after pytorch#20436, which prefers nproc and falls back to sysctl on Darwin. Follow-up to pytorch#21455, which covered the hardcoded -jN sites; raised by @synath in review there. Partial fix for pytorch#10887.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/22585
Note: Links to docs will display an error until the docs builds have been completed.
|
|
The following ciflow label(s) have been added but CI has not been triggered yet because the workflows are awaiting approval:
Once a maintainer approves the workflows (scroll to the bottom of the PR page), the corresponding CI jobs will be triggered automatically. Please ping one of the reviewers if you do not have access to approve and run workflows. |
This PR needs a
|
Summary
The Arm flow is supported on macOS, but every build command in its docs and notebooks uses
-j$(nproc), which does not exist there.macOS support is not incidental to this flow. The Ethos-U getting-started tutorial states it under Prerequisites — "a Linux machine with aarch64 or x86_64 processor architecture, or a macOS™ machine with Apple® Silicon" —
backends/arm/scripts/utils.sh:186rejects anything but Linux and Darwin on arm64, andbackends/arm/scripts/toolchain_utils.sh:31downloads adarwin-arm64bare-metal toolchain.On macOS the documented command loses its
-jargument entirely:That is a bare
-j, so the build runs unbounded rather than at the intended core count.This replaces those 16 sites with the portable form already established in the tree by #20436:
Scope is deliberately limited to the Arm flow, where macOS is a documented host. The remaining bare
-j$(nproc)sites live in backends with no stated macOS support (QNN, CUDA, Samsung, OpenVINO, Espressif) and are left alone.Follow-up to #21455, which converted the hardcoded
-jNsites; @synath raised this pattern in review there and I said it would be a separate PR. Partial fix for #10887.The Ethos-U tutorial is generated, so
backends/arm/scripts/docgen/ethos-u/ethos-u-getting-started-tutorial.md.inand its outputdocs/source/backends/arm-ethos-u/tutorials/ethos-u-getting-started.mdare both updated; the edited line is in the template's static text, not the$MINIMAL_EXAMPLEsubstitution, so re-runningdocgen.pyreproduces the committed file.Test plan
Docs and notebooks only — no build or runtime code changes.
Verified the replacement expression on both branches. With
nprocavailable (16 cores):With
nprocabsent andsysctl -n hw.ncpureporting 8, as on macOS:Confirmed no bare
-j$(nproc)remains in the touched files, that the four notebooks still parse as JSON, and that the generated tutorial still matches its template with the placeholder substituted.This PR was authored with AI assistance (Claude Code).
cc @digantdesai @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell @rascani