Set CPUs for soltest.sh
based on the number of available cores
#14478
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.
Recently, while discussing our soltest parallelisation with @blishko I realized that we always run 3 processes inside each image, regardless of how many cores are available. As a result the available cores are underutilized and soltest jobs do not finish as fast as they potentially could. This PR makes an attempt to fix that.
Results
Memory
One of our concerns was that this might have been set to 3 to avoid exceeding available memory. In my test runs this does not seem to be the case though. Even with this change applied, for most of soltest jobs memory usage peaks at 25%. In some cases it reaches 50%. It's nowhere near 100%.
Timing
Here's the timing comparison between a run on my experimental
circleci-config-commands
branch (should have the same timing asdevelop
) and an earlier run from this PR:t_ubu_clang_soltest
t_archlinux_soltest
t_ubu_soltest_all
t_ubu_force_release_soltest_all
t_osx_soltest
t_win_soltest
Note that on Windows we use a PowerShell script that is not parallelized, so we have just one process in the container. On macOS the job is not parallelized (
parallelism = 1
), but the script is.Oddly, the change did not significantly affect
t_ubu_soltest_all
. I checked and it did spawn 3 processes with 75% CPU use before and does spawn 5 now with 100% utilization. I did not do a precise comparison, but just by eyeballing the resource graph on CircleCI it looks like there's no change in performance. The total running time is influenced by a few slower runs among the 50 while most finish after 3-4 min, and after the change the stragglers are still there and the majority still finishes around the same time (or maybe even a bit later). At least it does not seem to make things worse. In any case, it's hard to tell just from the graph, but hopefully the total running time is actually shorter and saves us some credits.On macOS there's a big improvement and for that alone this seems worth it.