Skip to content

Limit concurrent link steps to keep load average down during wheel builds #311

Done

Description

@hjmjohnson

Wheel builds on a shared 72-core Linux machine (ITK_BUILD_JOBS=48) push the load average to about 250 during the link phase, then drop back to under 20 within minutes. The job cap does not bound link steps, so other work on the machine (for example a CI runner) stalls. Investigate whether the build should pass link-limiting options to CMake and the linker.

Options to evaluate
  1. Ninja job pools (CMake, Ninja generator only; no ITK change needed):
    -DCMAKE_JOB_POOLS="compile=<N>;link=<M>"
    -DCMAKE_JOB_POOL_COMPILE=compile
    -DCMAKE_JOB_POOL_LINK=link
    
    Compiles stay wide while at most M link steps run at once. ITK itself sets no job pools today.
  2. Threads inside each link step. If the toolchain links with lld, mold, or gold, each link can start a thread per core, so a few concurrent links still saturate the machine. Candidates: -Wl,--threads=<k> (lld), -Wl,--thread-count=<k> (mold), -Wl,--no-threads (gold). If LTO is enabled with -flto=auto, cap it (-flto=<k>). First step: confirm which linker and LTO settings the manylinux and macOS builds actually use.
  3. Ninja load limit (ninja -l). ITK_BUILD_LOAD_LIMIT already exists in scripts/build_jobs.py; check that it reaches the Ninja invocation in every build path. It only prevents new jobs from starting, so it complements 1 and 2.
What to measure

For one manylinux_2_28 x86_64 build, with and without each option: peak and mean load average, peak memory, and total wall time. A reasonable default might derive the link pool size from available memory the way compute_build_jobs derives the job count, with an environment override (for example ITK_BUILD_LINK_JOBS).

AI assistance
  • Tool: Claude Code
  • Role: observed the load spike during a private wheel build, surveyed the options, and drafted this issue at the author's request.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions