btrbk: add mainProgram
[NixPkgs.git] / pkgs / by-name / mp / mpiCheckPhaseHook / mpi-check-hook.sh
blob6adad2b44076a4a513ec6548f97e815493000c82
1 preCheckHooks+=('setupMpiCheck')
2 preInstallCheckHooks+=('setupMpiCheck')
5 setupMpiCheck() {
6 # Find out which MPI implementation we are using
7 # and set safe defaults that are guaranteed to run
8 # on any build machine
9 mpiType="NONE"
11 # OpenMPI signature
12 if command ompi_info &> /dev/null; then
13 mpiType="openmpi"
16 # MPICH based implementations
17 if command mpichversion &> /dev/null; then
18 if [ "$mpiType" != "NONE" ]; then
19 echo "WARNING: found OpenMPI and MPICH/MVAPICH executables"
22 version=$(mpichversion)
23 if [[ "$version" == *"MPICH"* ]]; then
24 mpiType="MPICH"
26 if [[ "$version" == *"MVAPICH"* ]]; then
27 mpiType="MVAPICH"
31 echo "Found MPI implementation: $mpiType"
33 case $mpiType in
34 openmpi)
35 # Note, that openmpi-5 switched to using PRRTE.
36 # Thus we need to set PRTE_MCA_* instead of OMPI_MCA_*.
37 # We keep the openmpi-4 parameters for backward compatability.
39 # Make sure the test starts even if we have less than the requested amount of cores
40 export OMPI_MCA_rmaps_base_oversubscribe=1
41 export PRTE_MCA_rmaps_default_mapping_policy=node:oversubscribe
43 # Make sure we do not need openssh in the checkPhase
44 export OMPI_MCA_plm_ssh_agent=false
45 export PRRTE_MCA_plm_ssh_agent=false
47 # Disable CPU pinning
48 export OMPI_MCA_hwloc_base_binding_policy=none
49 export PRTE_MCA_hwloc_default_binding_policy=none
51 # OpenMPI get confused by the sandbox environment and spew errors like this (both to stdout and stderr):
52 # [hwloc/linux] failed to find sysfs cpu topology directory, aborting linux discovery.
53 # [1729458724.473282] [localhost:78 :0] tcp_iface.c:893 UCX ERROR scandir(/sys/class/net) failed: No such file or directory
54 # These messages contaminate test output, which makes the difftest to fail.
55 # The solution is to use a preset cpu topology file and disable ucx model.
57 # Disable sysfs cpu topology directory discovery.
58 export PRTE_MCA_hwloc_use_topo_file="@topology@"
59 # Use the network model ob1 instead of ucx.
60 export OMPI_MCA_pml=ob1
62 MPICH)
63 # Fix to make mpich run in a sandbox
64 export HYDRA_IFACE=lo
65 # Disable sysfs cpu topology directory discovery.
66 export HWLOC_XMLFILE="@topology@"
68 MVAPICH)
69 # Disable CPU pinning
70 export MV2_ENABLE_AFFINITY=0
72 esac
74 # Limit number of OpenMP threads. Default is "all cores".
75 export OMP_NUM_THREADS=1