Repository navigation
python3Packages.scikit-bio: reduce openmp threads during tests - #534961
Conversation
The tests finish quickly enough with just a single OpenMP thread and this prevents it from becoming a scheduling nightmare on hydra.
|
Maybe we should have a similar default somewhere in stdenv? |
|
I wouldn't know where to fit it in. |
|
The dumb thing to do would be something like: diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh
index 1c5c82be25b7..5eadb8da0253 100644
--- a/pkgs/stdenv/generic/setup.sh
+++ b/pkgs/stdenv/generic/setup.sh
@@ -993,6 +993,8 @@ if ((NIX_BUILD_CORES <= 0)); then
fi
export NIX_BUILD_CORES
+OMP_NUM_THREADS = "${NIX_BUILD_CORES}"
+export OMP_NUM_THREADS
# Prevent SSL libraries from using certificates in /etc/ssl, unless set explicitly.
# Leave it in impure shells for convenience.At the cost of forcing OMP_NUM_THREADS to be whatever build cores is, with no way to opt out of that behavior. |
|
Yeah, this PR is not about doing the dumb thing. |
|
The problem is that nix (the builder) itself sets |
|
Picking the correct value is also not simple, because OMP threads are on top of NIX_BUILD_CORES. The preference would be for the number to be small, but that may not be a great experience with some package tests. |
|
grepping for pixman limits threads to a ludicrous 184, and uses numpy, like pixman, uses scipy uses a quarter of the nixpkgs/pkgs/development/python-modules/scipy/default.nix Lines 193 to 196 in b28538e It may be sensible to set a global default of 1 or 2, but allow overriding for things where that is known to be painfully slow. Still, probably an off-topic discussion for the proposed changes here as a quick fix. And global fix would be an stdenv rebuild and couldn't ever work as the quick bandaid that is needed. |
It reaps a worker and checks if it has been removed right after, but this is apparently racy.
|
Thanks for improving these 🙂 |
The tests finish quickly enough (4m36s for me) with just a single OpenMP thread and this prevents it from becoming a scheduling nightmare on hydra.
Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.