From 5b64cf6fc67aa4602667edeba903f3480577d128 Mon Sep 17 00:00:00 2001 From: Markus Kowalewski Date: Wed, 17 Jan 2024 16:45:23 +0100 Subject: [PATCH 01/10] tests/slurm: use getDev for mpi test --- nixos/tests/slurm.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/tests/slurm.nix b/nixos/tests/slurm.nix index a6b02e970b0c..ad516b6e8d2b 100644 --- a/nixos/tests/slurm.nix +++ b/nixos/tests/slurm.nix @@ -45,7 +45,7 @@ let ''; in pkgs.runCommand "mpitest" {} '' mkdir -p $out/bin - ${pkgs.openmpi}/bin/mpicc ${mpitestC} -o $out/bin/mpitest + ${lib.getDev pkgs.mpi}/bin/mpicc ${mpitestC} -o $out/bin/mpitest ''; in { name = "slurm"; From 75e06d42700a7da5cf2e9eb016f17f4f91168b1f Mon Sep 17 00:00:00 2001 From: Markus Kowalewski Date: Wed, 17 Jan 2024 16:46:35 +0100 Subject: [PATCH 02/10] boost: use getDev for mpi input --- pkgs/development/libraries/boost/generic.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/boost/generic.nix b/pkgs/development/libraries/boost/generic.nix index ad67806398f9..3db9b77bf05d 100644 --- a/pkgs/development/libraries/boost/generic.nix +++ b/pkgs/development/libraries/boost/generic.nix @@ -168,7 +168,7 @@ stdenv.mkDerivation { preConfigure = lib.optionalString useMpi '' cat << EOF >> user-config.jam - using mpi : ${mpi}/bin/mpiCC ; + using mpi : ${lib.getDev mpi}/bin/mpiCC ; EOF '' # On darwin we need to add the `$out/lib` to the libraries' rpath explicitly, From 61d8b53c4181a2957b098f945fa5cd025b112295 Mon Sep 17 00:00:00 2001 From: Markus Kowalewski Date: Wed, 17 Jan 2024 16:47:05 +0100 Subject: [PATCH 03/10] libvdwxc: use getDev for mpi --- .../libraries/science/chemistry/libvdwxc/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/science/chemistry/libvdwxc/default.nix b/pkgs/development/libraries/science/chemistry/libvdwxc/default.nix index f90cad4a099f..c0da65e7c788 100644 --- a/pkgs/development/libraries/science/chemistry/libvdwxc/default.nix +++ b/pkgs/development/libraries/science/chemistry/libvdwxc/default.nix @@ -28,7 +28,7 @@ stdenv.mkDerivation rec { export PATH=$PATH:${mpi}/bin configureFlagsArray+=( - --with-mpi=${mpi} + --with-mpi=${lib.getDev mpi} CC=mpicc FC=mpif90 MPICC=mpicc From 71035c19eded5dcb9645d0d3943cec2aa3d605d4 Mon Sep 17 00:00:00 2001 From: Markus Kowalewski Date: Wed, 17 Jan 2024 16:48:20 +0100 Subject: [PATCH 04/10] python3Packages.mpi4py: remove unneeded mpicc definiton --- pkgs/development/python-modules/mpi4py/default.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkgs/development/python-modules/mpi4py/default.nix b/pkgs/development/python-modules/mpi4py/default.nix index deb54ab149be..b5f4e403ab38 100644 --- a/pkgs/development/python-modules/mpi4py/default.nix +++ b/pkgs/development/python-modules/mpi4py/default.nix @@ -38,8 +38,6 @@ buildPythonPackage rec { # work as expected ''; - setupPyBuildFlags = ["--mpicc=${mpi}/bin/mpicc"]; - nativeBuildInputs = [ mpi ]; __darwinAllowLocalNetworking = true; From 4a12877882e4e6de227ca5af617502ef4ae01cfb Mon Sep 17 00:00:00 2001 From: Markus Kowalewski Date: Wed, 17 Jan 2024 16:49:11 +0100 Subject: [PATCH 05/10] python3Packages: use getDev for mpi --- pkgs/development/python-modules/h5py/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/h5py/default.nix b/pkgs/development/python-modules/h5py/default.nix index fc30a7536a33..a11578f832ba 100644 --- a/pkgs/development/python-modules/h5py/default.nix +++ b/pkgs/development/python-modules/h5py/default.nix @@ -47,7 +47,7 @@ in buildPythonPackage rec { ${lib.optionalString mpiSupport "export OMPI_MCA_rmaps_base_oversubscribe=yes"} ''; - preBuild = lib.optionalString mpiSupport "export CC=${mpi}/bin/mpicc"; + preBuild = lib.optionalString mpiSupport "export CC=${lib.getDev mpi}/bin/mpicc"; nativeBuildInputs = [ cython From 3600fc8d47151ff6a66438529ffedbd2c4cfddab Mon Sep 17 00:00:00 2001 From: Markus Kowalewski Date: Wed, 17 Jan 2024 16:49:38 +0100 Subject: [PATCH 06/10] python3Packages.gpaw: use getDev for mpi --- pkgs/development/python-modules/gpaw/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/gpaw/default.nix b/pkgs/development/python-modules/gpaw/default.nix index be43eb55857d..37b12c6f5ed4 100644 --- a/pkgs/development/python-modules/gpaw/default.nix +++ b/pkgs/development/python-modules/gpaw/default.nix @@ -29,8 +29,8 @@ let text = '' # Compiler compiler = 'gcc' - mpicompiler = '${mpi}/bin/mpicc' - mpilinker = '${mpi}/bin/mpicc' + mpicompiler = '${lib.getDev mpi}/bin/mpicc' + mpilinker = '${lib.getDev mpi}/bin/mpicc' # BLAS libraries += ['blas'] From 71f23d938d2f6f60c17e61a66399816d7837a618 Mon Sep 17 00:00:00 2001 From: Markus Kowalewski Date: Wed, 17 Jan 2024 16:50:38 +0100 Subject: [PATCH 07/10] scalapack: use getDev for mpi --- pkgs/development/libraries/science/math/scalapack/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/science/math/scalapack/default.nix b/pkgs/development/libraries/science/math/scalapack/default.nix index 81bcec504473..85aa5c4a8736 100644 --- a/pkgs/development/libraries/science/math/scalapack/default.nix +++ b/pkgs/development/libraries/science/math/scalapack/default.nix @@ -51,7 +51,7 @@ stdenv.mkDerivation rec { -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=OFF -DLAPACK_LIBRARIES="-llapack" -DBLAS_LIBRARIES="-lblas" - -DCMAKE_Fortran_COMPILER=${mpi}/bin/mpif90 + -DCMAKE_Fortran_COMPILER=${lib.getDev mpi}/bin/mpif90 ${lib.optionalString passthru.isILP64 '' -DCMAKE_Fortran_FLAGS="-fdefault-integer-8" -DCMAKE_C_FLAGS="-DInt=long" From 5bfb906fc27b86a21872b522ff64963074336ee5 Mon Sep 17 00:00:00 2001 From: Markus Kowalewski Date: Thu, 18 Jan 2024 10:32:02 +0100 Subject: [PATCH 08/10] netcdf-mpi: use getDev for mpi --- pkgs/development/libraries/netcdf/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/netcdf/default.nix b/pkgs/development/libraries/netcdf/default.nix index 8fde7050b97a..0796e7997d50 100644 --- a/pkgs/development/libraries/netcdf/default.nix +++ b/pkgs/development/libraries/netcdf/default.nix @@ -59,7 +59,7 @@ in stdenv.mkDerivation rec { "--disable-dap-remote-tests" "--with-plugin-dir=${placeholder "out"}/lib/hdf5-plugins" ] - ++ (lib.optionals mpiSupport [ "--enable-parallel-tests" "CC=${mpi}/bin/mpicc" ]); + ++ (lib.optionals mpiSupport [ "--enable-parallel-tests" "CC=${lib.getDev mpi}/bin/mpicc" ]); enableParallelBuilding = true; From 2f44799d84e439781657d4de2a3dd0a794ec479e Mon Sep 17 00:00:00 2001 From: Markus Kowalewski Date: Wed, 17 Jan 2024 16:51:45 +0100 Subject: [PATCH 09/10] hdf5: remove unneded path to mpi compiler --- pkgs/tools/misc/hdf5/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/tools/misc/hdf5/default.nix b/pkgs/tools/misc/hdf5/default.nix index 89702cfd1a7f..ba00746c08f9 100644 --- a/pkgs/tools/misc/hdf5/default.nix +++ b/pkgs/tools/misc/hdf5/default.nix @@ -76,7 +76,7 @@ stdenv.mkDerivation rec { ++ lib.optional cppSupport "-DHDF5_BUILD_CPP_LIB=ON" ++ lib.optional fortranSupport "-DHDF5_BUILD_FORTRAN=ON" ++ lib.optional szipSupport "-DHDF5_ENABLE_SZIP_SUPPORT=ON" - ++ lib.optionals mpiSupport [ "-DHDF5_ENABLE_PARALLEL=ON" "CC=${mpi}/bin/mpicc" ] + ++ lib.optionals mpiSupport [ "-DHDF5_ENABLE_PARALLEL=ON" ] ++ lib.optional enableShared "-DBUILD_SHARED_LIBS=ON" ++ lib.optional javaSupport "-DHDF5_BUILD_JAVA=ON" ++ lib.optional usev110Api "-DDEFAULT_API_VERSION=v110" From a52f790a4c980c60a877fdef581927a0b8c74c63 Mon Sep 17 00:00:00 2001 From: Markus Kowalewski Date: Wed, 17 Jan 2024 16:51:15 +0100 Subject: [PATCH 10/10] openmpi: use extra output for dev --- .../development/libraries/openmpi/default.nix | 43 +++++++++++++++---- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/pkgs/development/libraries/openmpi/default.nix b/pkgs/development/libraries/openmpi/default.nix index a8bd8acacd59..8c54c13c9139 100644 --- a/pkgs/development/libraries/openmpi/default.nix +++ b/pkgs/development/libraries/openmpi/default.nix @@ -1,6 +1,6 @@ -{ lib, stdenv, fetchurl, gfortran, perl, libnl +{ lib, stdenv, fetchurl, removeReferencesTo, gfortran, perl, libnl , rdma-core, zlib, numactl, libevent, hwloc, targetPackages, symlinkJoin -, libpsm2, libfabric, pmix, ucx, ucc +, libpsm2, libfabric, pmix, ucx, ucc, makeWrapper , config # Enable CUDA support , cudaSupport ? config.cudaSupport, cudaPackages @@ -38,7 +38,7 @@ stdenv.mkDerivation rec { find -name "Makefile.in" -exec sed -i "s/\`date\`/$ts/" \{} \; ''; - outputs = [ "out" "man" ]; + outputs = [ "out" "man" "dev" ]; buildInputs = [ zlib ] ++ lib.optionals stdenv.isLinux [ libnl numactl pmix ucx ucc ] @@ -47,7 +47,7 @@ stdenv.mkDerivation rec { ++ lib.optional (stdenv.isLinux || stdenv.isFreeBSD) rdma-core ++ lib.optionals fabricSupport [ libpsm2 libfabric ]; - nativeBuildInputs = [ perl ] + nativeBuildInputs = [ perl removeReferencesTo makeWrapper ] ++ lib.optionals cudaSupport [ cudaPackages.cuda_nvcc ] ++ lib.optionals fortranSupport [ gfortran ]; @@ -71,24 +71,51 @@ stdenv.mkDerivation rec { postInstall = '' find $out/lib/ -name "*.la" -exec rm -f \{} \; + + for f in mpi shmem osh; do + for i in f77 f90 CC c++ cxx cc fort; do + moveToOutput "bin/$f$i" "''${!outputDev}" + echo "move $fi$i" + moveToOutput "share/openmpi/$f$i-wrapper-data.txt" "''${!outputDev}" + done + done + + for i in ortecc orte-info ompi_info oshmem_info opal_wrapper; do + moveToOutput "bin/$i" "''${!outputDev}" + done + + moveToOutput "share/openmpi/ortecc-wrapper-data.txt" "''${!outputDev}" ''; postFixup = '' + remove-references-to -t $dev $(readlink -f $out/lib/libopen-pal${stdenv.hostPlatform.extensions.sharedLibrary}) + remove-references-to -t $man $(readlink -f $out/lib/libopen-pal${stdenv.hostPlatform.extensions.sharedLibrary}) + + # The path to the wrapper is hard coded in libopen-pal.so, which we just cleared. + wrapProgram $dev/bin/opal_wrapper \ + --set OPAL_INCLUDEDIR $dev/include \ + --set OPAL_PKGDATADIR $dev/share/openmpi + # default compilers should be indentical to the # compilers at build time + echo "$dev/share/openmpi/mpicc-wrapper-data.txt" sed -i 's:compiler=.*:compiler=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc:' \ - $out/share/openmpi/mpicc-wrapper-data.txt + $dev/share/openmpi/mpicc-wrapper-data.txt + echo "$dev/share/openmpi/ortecc-wrapper-data.txt" sed -i 's:compiler=.*:compiler=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc:' \ - $out/share/openmpi/ortecc-wrapper-data.txt + $dev/share/openmpi/ortecc-wrapper-data.txt + echo "$dev/share/openmpi/mpic++-wrapper-data.txt" sed -i 's:compiler=.*:compiler=${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}c++:' \ - $out/share/openmpi/mpic++-wrapper-data.txt + $dev/share/openmpi/mpic++-wrapper-data.txt '' + lib.optionalString fortranSupport '' + echo "$dev/share/openmpi/mpifort-wrapper-data.txt" sed -i 's:compiler=.*:compiler=${gfortran}/bin/${gfortran.targetPrefix}gfortran:' \ - $out/share/openmpi/mpifort-wrapper-data.txt + $dev/share/openmpi/mpifort-wrapper-data.txt + ''; doCheck = true;