From a52f790a4c980c60a877fdef581927a0b8c74c63 Mon Sep 17 00:00:00 2001 From: Markus Kowalewski Date: Wed, 17 Jan 2024 16:51:15 +0100 Subject: [PATCH] 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;