Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve build efficiency by building library subprojects in parallel #630

Merged
merged 1 commit into from
Jan 23, 2025

Conversation

dcandler
Copy link
Collaborator

Each library variant build consists of three subprojects, which require sequential configuring and building. While the build steps can be parallelized by using multiple processes to compile the sources, the configuration step is largely single threaded.

The multilib project has to build many variants now, and so a significant amount of time is spent waiting for the configuration of various projects to finish.

This patch attempts to make the build process more efficient by running all the configuration steps for every variant subproject in parallel. The configuration/build steps in the underlying runtimes project are exposed, so that the higher level multilib project can invoke them as a single target. So instead of building each variant in turn, all the versions of compiler-rt are configured, then all versions are built, then all the C libraries are configured, and so on. This maximizes the amount of work that can be done at any given time.

The build steps already benefit from parallelization: although built in series, each has the full number of available processes to use. However, at higher CPU counts there is an observable limit on how many processes each build can effectively use. So it may also be more efficient to instead run the build steps in parallel with a smaller number of proceses available to each. The option to control it (ENABLE_PARALLEL_LIB_BUILD) is OFF by default as which strategy is faster may come down to your available hardware, whereas ENABLE_PARALLEL_LIB_CONFIG should always be beneficial, so I've defaulted that to ON.

Each library variant build consists of three subprojects, which
require sequential configuring and building. While the build steps
can be parallelized by using multiple processes to compile the
sources, the configuration step is largely single threaded.

The multilib project has to build many variants now, and so a
significant amount of time is spent waiting for the configuration
of various projects to finish.

This patch attempts to make the build process more efficient by
running all the configuration steps for every variant subproject in
parallel. The configuration/build steps in the underlying runtimes
project are exposed, so that the higher level multilib project can
invoke them as a single target. So instead of building each variant
in turn, all the versions of compiler-rt are configured, then all
versions are built, then all the C libraries are configured, and
so on. This maximizes the amount of work that can be done at any
given time.

The build steps already benefit from parallelization: although
built in series, each has the full number of available processes
to use. However, at higher CPU counts there is an observable
limit on how many processes each build can effectively use. So
it may also be more efficient to instead run the build steps in
parallel with a smaller number of proceses available to each. The
option to control it (ENABLE_PARALLEL_LIB_BUILD) is OFF by default as
which strategy is faster may come down to your available hardware,
whereas ENABLE_PARALLEL_LIB_CONFIG should always be beneficial,
so I've defaulted that to ON.
Copy link
Collaborator

@pratlucas pratlucas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@dcandler dcandler merged commit 49bfb9d into ARM-software:main Jan 23, 2025
1 check passed
@dcandler dcandler deleted the parallel_config branch January 27, 2025 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants