Skip to content

Conversation

@bthomee
Copy link
Collaborator

@bthomee bthomee commented Oct 24, 2025

High Level Overview of Change

This change reduces the number of cores used to build and test by one.

Context of Change

Using all cores may be contributing to occasional build failures. Only the Conan profile currently specifies that the number of cores minus one should be used for the level of parallelism, but that does not affect the building and testing as those are currently set to $(nproc).

Although it would be nice to determine the number of cores to use in a single location, and then pass that value to all places that need it, it is very unwieldy to do so. Therefore this PR replaces $(nproc) by $(( $(nproc) - 1 )) in the three locations where it is used; note that the ctest invocation will soon be changed in #5932).

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Performance (increase or change in throughput and/or latency)
  • Tests (you added tests for code that already exists, or your new feature included in this PR)
  • Documentation update
  • Chore (no impact to binary, e.g. .gitignore, formatting, dropping support for older tooling)
  • Release

cd "${BUILD_DIR}"
cmake -Donly_docs=ON ..
cmake --build . --target docs --parallel $(nproc)
cmake --build . --target docs --parallel $(( $(nproc) - 1 ))
Copy link
Collaborator

@legleux legleux Oct 24, 2025

Choose a reason for hiding this comment

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

You can let nproc do the math.
Probably use 2 to be safe.
nproc --ignore 2

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I love it!

@legleux
Copy link
Collaborator

legleux commented Oct 24, 2025

Although it would be nice to determine the number of cores to use in a single location, and then pass that value to all places that need it, it is very unwieldy to do so.

https://github.com/XRPLF/clio/blob/develop/.github/actions/get-threads-number/action.yml

@bthomee
Copy link
Collaborator Author

bthomee commented Oct 24, 2025

Although it would be nice to determine the number of cores to use in a single location, and then pass that value to all places that need it, it is very unwieldy to do so.

https://github.com/XRPLF/clio/blob/develop/.github/actions/get-threads-number/action.yml

I like that too, although it doesn't account for Windows. In our case all runners have nproc installed. I can create something similar.

@codecov
Copy link

codecov bot commented Oct 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.5%. Comparing base (e192ffe) to head (f5ef1fb).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           develop   #5939   +/-   ##
=======================================
  Coverage     78.5%   78.5%           
=======================================
  Files          817     817           
  Lines        69017   69017           
  Branches      8276    8276           
=======================================
  Hits         54197   54197           
  Misses       14820   14820           

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bthomee
Copy link
Collaborator Author

bthomee commented Oct 24, 2025

Although it would be nice to determine the number of cores to use in a single location, and then pass that value to all places that need it, it is very unwieldy to do so.

https://github.com/XRPLF/clio/blob/develop/.github/actions/get-threads-number/action.yml

I like that too, although it doesn't account for Windows. In our case all runners have nproc installed. I can create something similar.

@legleux I created XRPLF/actions#17.

@legleux
Copy link
Collaborator

legleux commented Oct 24, 2025

Windoooooooooows! 👊

I can't believe all the years I've spent messing around shell math with nproc this was there the whole time? All it needs is a short flag.

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