boost_build: derive b2's -j from resource_size - #1577
Open
kwlzn wants to merge 1 commit into
Open
Conversation
kwlzn
force-pushed
the
kwlzn/boost_b2_jobs
branch
from
July 28, 2026 04:12
7efba52 to
88dec15
Compare
b2 reads none of the parallelism environment variables the framework sets (CMAKE_BUILD_PARALLEL_LEVEL, GNUMAKEFLAGS, MESON_NUM_PROCESSES, NINJA_JOBS), and modern b2 defaults -j to every detected CPU thread. So a boost_build target with a resource_size reserved N cpus from the Bazel scheduler and then forked as many compilers as the machine had cores -- the reservation bought nothing, and Bazel kept scheduling other actions alongside it. Derive the job count from the same resource_size that produces the resource_set, and put it on the b2 command line ahead of user_options so an explicit user -j still wins. Targets without a resource_size are unchanged. The arithmetic moves into parallelism_for/get_resource_parallelism so the env vars and the command line flag come from one place and cannot drift. boost_build.bzl had no stardoc target, so its attributes were not rendered anywhere; add one.
kwlzn
force-pushed
the
kwlzn/boost_b2_jobs
branch
from
July 29, 2026 00:07
88dec15 to
1934e98
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.
b2 reads none of the parallelism environment variables the framework sets (CMAKE_BUILD_PARALLEL_LEVEL, GNUMAKEFLAGS, MESON_NUM_PROCESSES, NINJA_JOBS), and modern b2 defaults -j to every detected CPU thread. So a boost_build target with a resource_size reserved N cpus from the Bazel scheduler and then forked as many compilers as the machine had cores -- the reservation bought nothing, and Bazel kept scheduling other actions alongside it.
Derive the job count from the same resource_size that produces the resource_set, and put it on the b2 command line ahead of user_options so an explicit user -j still wins. Targets without a resource_size are unchanged.
The arithmetic moves into parallelism_for/get_resource_parallelism so the env vars and the command line flag come from one place and cannot drift.
boost_build.bzl had no stardoc target, so its attributes were not rendered anywhere; add one.