mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-18 14:41:18 +00:00
[Backport staging-next-26.05] openmpCheckPhaseHook: init (#539501)
This commit is contained in:
@@ -34,6 +34,7 @@ nodejs-install-manuals.section.md
|
||||
npm-build-hook.section.md
|
||||
npm-config-hook.section.md
|
||||
npm-install-hook.section.md
|
||||
openmp-check-hook.section.md
|
||||
patch-rc-path-hooks.section.md
|
||||
perl.section.md
|
||||
pkg-config.section.md
|
||||
|
||||
10
doc/hooks/openmp-check-hook.section.md
Normal file
10
doc/hooks/openmp-check-hook.section.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# openmpCheckPhaseHook {#setup-hook-omp-check}
|
||||
|
||||
|
||||
This hook can be used to setup a check phase that
|
||||
requires running a OpenMP application. It mostly
|
||||
serves to limit `OMP_NUM_THREADS` to avoid overloading
|
||||
build machines.
|
||||
|
||||
This hook will not attempt to override an already existing
|
||||
definition of `OMP_NUM_THREADS` in the environment.
|
||||
@@ -2809,6 +2809,9 @@
|
||||
"setup-hook-mpi-check": [
|
||||
"index.html#setup-hook-mpi-check"
|
||||
],
|
||||
"setup-hook-omp-check": [
|
||||
"index.html#setup-hook-omp-check"
|
||||
],
|
||||
"ninja": [
|
||||
"index.html#ninja"
|
||||
],
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
stdenv,
|
||||
lapack-reference,
|
||||
openblas,
|
||||
openmpCheckPhaseHook,
|
||||
isILP64 ? false,
|
||||
blasProvider ? openblas,
|
||||
}:
|
||||
@@ -186,6 +187,10 @@ stdenv.mkDerivation {
|
||||
"dev"
|
||||
];
|
||||
|
||||
propagatedNativeBuildInputs = [
|
||||
openmpCheckPhaseHook
|
||||
];
|
||||
|
||||
meta = (blasProvider'.meta or { }) // {
|
||||
description = "${lib.getName blasProvider} with just the BLAS C and FORTRAN ABI";
|
||||
};
|
||||
|
||||
@@ -82,10 +82,6 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
app/tester.py
|
||||
'';
|
||||
|
||||
preCheck = ''
|
||||
export OMP_NUM_THREADS=2
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Generally Applicable Atomic-Charge Dependent London Dispersion Correction";
|
||||
mainProgram = "dftd4";
|
||||
|
||||
@@ -116,9 +116,6 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
preCheck = ''
|
||||
#patchShebangs ./
|
||||
|
||||
# Run dual threaded
|
||||
export OMP_NUM_THREADS=2
|
||||
|
||||
# Reduce test problem sizes
|
||||
export TEST_FLAGS="1500 50 16"
|
||||
'';
|
||||
|
||||
@@ -39,7 +39,6 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
"-lblas"
|
||||
"-llapack"
|
||||
];
|
||||
OMP_NUM_THREADS = 2; # required for check phase
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
@@ -34,10 +34,6 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
# Uses a hacky python setup run by cmake, which is hard to get running
|
||||
doCheck = false;
|
||||
|
||||
preCheck = ''
|
||||
export OMP_NUM_THREADS=2
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Library for Green’s function based electronic structure theory calculations";
|
||||
license = [ lib.licenses.asl20 ];
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
pkg-config,
|
||||
python3,
|
||||
jonquil,
|
||||
openmpCheckPhaseHook,
|
||||
}:
|
||||
|
||||
assert (
|
||||
@@ -43,6 +44,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
gfortran
|
||||
pkg-config
|
||||
python3
|
||||
openmpCheckPhaseHook
|
||||
]
|
||||
++ lib.optionals (buildType == "meson") [
|
||||
meson
|
||||
@@ -61,10 +63,6 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
|
||||
doCheck = true;
|
||||
|
||||
preCheck = ''
|
||||
export OMP_NUM_THREADS=2
|
||||
'';
|
||||
|
||||
postPatch = ''
|
||||
patchShebangs --build config/install-mod.py
|
||||
'';
|
||||
|
||||
@@ -39,10 +39,6 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
|
||||
doCheck = true;
|
||||
|
||||
preCheck = ''
|
||||
export OMP_NUM_THREADS=2
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Semiempirical quantum chemistry";
|
||||
homepage = "https://github.com/openmopac/mopac";
|
||||
|
||||
@@ -59,8 +59,6 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
|
||||
doCheck = true;
|
||||
|
||||
preCheck = "export OMP_NUM_THREADS=2";
|
||||
|
||||
meta = {
|
||||
description = "MIT Photonic-Bands: computation of photonic band structures in periodic media";
|
||||
homepage = "https://mpb.readthedocs.io/en/latest/";
|
||||
|
||||
@@ -72,8 +72,5 @@ setupMpiCheck() {
|
||||
export HWLOC_XMLFILE="@topology@"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Limit number of OpenMP threads. Default is "all cores".
|
||||
export OMP_NUM_THREADS=1
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
callPackage,
|
||||
makeSetupHook,
|
||||
stdenv,
|
||||
openmpCheckPhaseHook,
|
||||
}:
|
||||
|
||||
makeSetupHook {
|
||||
@@ -11,4 +11,8 @@ makeSetupHook {
|
||||
iface = if stdenv.hostPlatform.isDarwin then "lo0" else "lo";
|
||||
topology = ./topology.xml;
|
||||
};
|
||||
|
||||
propagatedNativeBuildInputs = [
|
||||
openmpCheckPhaseHook
|
||||
];
|
||||
} ./mpi-check-hook.sh
|
||||
|
||||
@@ -71,10 +71,6 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
patchShebangs --build config/install-mod.py
|
||||
'';
|
||||
|
||||
preCheck = ''
|
||||
export OMP_NUM_THREADS=2
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Electronegativity equilibration model for atomic partial charges";
|
||||
mainProgram = "multicharge";
|
||||
|
||||
11
pkgs/by-name/op/openmpCheckPhaseHook/omp-check-hook.sh
Normal file
11
pkgs/by-name/op/openmpCheckPhaseHook/omp-check-hook.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
preCheckHooks+=('setupOmpCheck')
|
||||
preInstallCheckHooks+=('setupOmpCheck')
|
||||
|
||||
|
||||
setupOmpCheck() {
|
||||
# Limit number of OpenMP threads. Default is "all cores".
|
||||
# Using all cores causes high load on builders if checks are executed with NIX_BUILD_CORE parallelism.
|
||||
# This gets even worse if multiple builds are scheduled on the same machine, potentially growing O(n^3) without explicit core limits.
|
||||
export OMP_NUM_THREADS="${OMP_NUM_THREADS:-1}"
|
||||
}
|
||||
|
||||
12
pkgs/by-name/op/openmpCheckPhaseHook/package.nix
Normal file
12
pkgs/by-name/op/openmpCheckPhaseHook/package.nix
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
lib,
|
||||
makeSetupHook,
|
||||
}:
|
||||
|
||||
makeSetupHook {
|
||||
name = "omp-checkPhase-hook";
|
||||
|
||||
__structuredAttrs = true;
|
||||
|
||||
meta.license = lib.licenses.mit;
|
||||
} ./omp-check-hook.sh
|
||||
@@ -6,6 +6,7 @@
|
||||
ninja,
|
||||
pkg-config,
|
||||
libpng,
|
||||
openmpCheckPhaseHook,
|
||||
glib, # just passthru
|
||||
|
||||
# for passthru.tests
|
||||
@@ -46,6 +47,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
meson
|
||||
ninja
|
||||
pkg-config
|
||||
openmpCheckPhaseHook
|
||||
__flattenIncludeHackHook
|
||||
];
|
||||
|
||||
@@ -61,11 +63,6 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
"-Dneon=disabled"
|
||||
];
|
||||
|
||||
preConfigure = ''
|
||||
# https://gitlab.freedesktop.org/pixman/pixman/-/issues/62
|
||||
export OMP_NUM_THREADS=$((NIX_BUILD_CORES > 184 ? 184 : NIX_BUILD_CORES))
|
||||
'';
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
doCheck = !stdenv.hostPlatform.isDarwin;
|
||||
|
||||
@@ -73,9 +73,6 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
doCheck = true;
|
||||
checkInputs = [ python3 ];
|
||||
checkTarget = [ "test-serial" ];
|
||||
preCheck = ''
|
||||
export OMP_NUM_THREADS=4
|
||||
'';
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
ompdSupport ? true,
|
||||
ompdGdbSupport ? ompdSupport,
|
||||
getVersionFile,
|
||||
fetchpatch,
|
||||
openmpCheckPhaseHook,
|
||||
}:
|
||||
|
||||
assert lib.assertMsg (ompdGdbSupport -> ompdSupport) "OMPD GDB support requires OMPD support!";
|
||||
@@ -60,6 +60,10 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
lit
|
||||
];
|
||||
|
||||
propagatedNativeBuildInputs = [
|
||||
openmpCheckPhaseHook
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
llvm
|
||||
]
|
||||
|
||||
@@ -64,9 +64,6 @@ stdenv.mkDerivation rec {
|
||||
];
|
||||
|
||||
doCheck = true;
|
||||
preCheck = ''
|
||||
export OMP_NUM_THREADS=2
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Reimplementation of the DFT-D3 program";
|
||||
|
||||
@@ -88,10 +88,6 @@ stdenv.mkDerivation rec {
|
||||
|
||||
doCheck = buildType == "meson";
|
||||
|
||||
preCheck = ''
|
||||
export OMP_NUM_THREADS=2
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Light-weight tight-binding framework";
|
||||
mainProgram = "tblite";
|
||||
|
||||
@@ -143,10 +143,6 @@ buildPythonPackage rec {
|
||||
|
||||
preCheck = ''
|
||||
export HOME="$(mktemp -d)"
|
||||
export OMP_NUM_THREADS=$(( $NIX_BUILD_CORES / 4 ))
|
||||
if [ $OMP_NUM_THREADS -eq 0 ]; then
|
||||
export OMP_NUM_THREADS=1
|
||||
fi
|
||||
|
||||
# See https://github.com/astropy/astropy/issues/17649 and see
|
||||
# --hypothesis-profile=ci pytest flag below.
|
||||
|
||||
@@ -28,10 +28,6 @@ buildPythonPackage rec {
|
||||
six
|
||||
];
|
||||
|
||||
preCheck = ''
|
||||
export OMP_NUM_THREADS=2
|
||||
'';
|
||||
|
||||
nativeCheckInputs = [ pytestCheckHook ];
|
||||
|
||||
meta = {
|
||||
|
||||
@@ -49,7 +49,6 @@ buildPythonPackage rec {
|
||||
preCheck = ''
|
||||
cd $TMPDIR
|
||||
export HOME=$TMPDIR
|
||||
export OMP_NUM_THREADS=1
|
||||
'';
|
||||
|
||||
meta = {
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
blas,
|
||||
lapack,
|
||||
|
||||
openmpCheckPhaseHook,
|
||||
|
||||
# Reverse dependency
|
||||
sage,
|
||||
|
||||
@@ -93,7 +95,6 @@ buildPythonPackage (finalAttrs: {
|
||||
# see https://github.com/OpenMathLib/OpenBLAS/issues/2993
|
||||
preConfigure = ''
|
||||
sed -i 's/-faltivec//' numpy/distutils/system_info.py
|
||||
export OMP_NUM_THREADS=$((NIX_BUILD_CORES > 64 ? 64 : NIX_BUILD_CORES))
|
||||
'';
|
||||
|
||||
preBuild = ''
|
||||
@@ -110,6 +111,10 @@ buildPythonPackage (finalAttrs: {
|
||||
typing-extensions
|
||||
];
|
||||
|
||||
propagatedNativeBuildInputs = [
|
||||
openmpCheckPhaseHook
|
||||
];
|
||||
|
||||
preCheck = ''
|
||||
cd "$out"
|
||||
'';
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
coreutils,
|
||||
lapack,
|
||||
|
||||
openmpCheckPhaseHook,
|
||||
|
||||
# Reverse dependency
|
||||
sage,
|
||||
|
||||
@@ -86,12 +88,8 @@ buildPythonPackage (finalAttrs: {
|
||||
]
|
||||
++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ mesonEmulatorHook ];
|
||||
|
||||
# we default openblas to build with 64 threads
|
||||
# if a machine has more than 64 threads, it will segfault
|
||||
# see https://github.com/OpenMathLib/OpenBLAS/issues/2993
|
||||
preConfigure = ''
|
||||
sed -i 's/-faltivec//' numpy/distutils/system_info.py
|
||||
export OMP_NUM_THREADS=$((NIX_BUILD_CORES > 64 ? 64 : NIX_BUILD_CORES))
|
||||
'';
|
||||
|
||||
buildInputs = [
|
||||
@@ -113,6 +111,10 @@ buildPythonPackage (finalAttrs: {
|
||||
typing-extensions
|
||||
];
|
||||
|
||||
propagatedNativeBuildInputs = [
|
||||
openmpCheckPhaseHook
|
||||
];
|
||||
|
||||
preCheck = ''
|
||||
pushd $out
|
||||
# For numpy-config executable to be available during tests
|
||||
|
||||
@@ -61,7 +61,6 @@ buildPythonPackage {
|
||||
preCheck = ''
|
||||
# Set config used by tests to ensure reproducibility
|
||||
echo 'pbc_tools_pbc_fft_engine = "NUMPY"' > pyscf/pyscf_config.py
|
||||
export OMP_NUM_THREADS=1
|
||||
ulimit -s 20000
|
||||
export PYSCF_CONFIG_FILE=$(pwd)/pyscf/pyscf_config.py
|
||||
'';
|
||||
|
||||
@@ -62,7 +62,6 @@ buildPythonPackage (finalAttrs: {
|
||||
# This is due to the Cython-compiled modules not being in the correct location
|
||||
# of the source tree.
|
||||
preCheck = ''
|
||||
export OMP_NUM_THREADS=$NIX_BUILD_CORES
|
||||
mkdir -p test && cd test
|
||||
'';
|
||||
|
||||
|
||||
@@ -116,7 +116,6 @@ buildPythonPackage rec {
|
||||
preCheck = ''
|
||||
cd $TMPDIR
|
||||
export HOME=$TMPDIR
|
||||
export OMP_NUM_THREADS=1
|
||||
'';
|
||||
|
||||
pythonImportsCheck = [ "sklearn" ];
|
||||
|
||||
@@ -190,11 +190,6 @@ buildPythonPackage (finalAttrs: {
|
||||
'';
|
||||
|
||||
preCheck = ''
|
||||
export OMP_NUM_THREADS=$(( $NIX_BUILD_CORES / 4 ))
|
||||
if [ $OMP_NUM_THREADS -eq 0 ]; then
|
||||
export OMP_NUM_THREADS=1
|
||||
fi
|
||||
|
||||
cd $out
|
||||
'';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user