openmpi: use extra output for dev

This commit is contained in:
Markus Kowalewski 2024-01-17 16:51:15 +01:00
parent 2f44799d84
commit a52f790a4c

View file

@ -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;