2020-06-29 20:46:30 +02:00
|
|
|
{ stdenv
|
|
|
|
, rpmextract
|
2020-07-01 17:57:31 +02:00
|
|
|
, gcc
|
|
|
|
, zlib
|
2020-08-17 18:51:51 +02:00
|
|
|
, ucx
|
|
|
|
, numactl
|
|
|
|
, rdma-core
|
|
|
|
, libpsm2
|
|
|
|
, patchelf
|
2020-07-01 17:57:31 +02:00
|
|
|
, autoPatchelfHook
|
2020-06-29 20:46:30 +02:00
|
|
|
, enableDebug ? false
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "intel-mpi-${version}";
|
2020-08-17 18:51:51 +02:00
|
|
|
version = "2019.8.254";
|
|
|
|
dir_nr = "16814";
|
|
|
|
internal-ver = "2020.2.254";
|
2020-06-29 20:46:30 +02:00
|
|
|
|
|
|
|
lib_variant = (if enableDebug then "debug" else "release");
|
|
|
|
|
2020-07-23 18:47:20 +02:00
|
|
|
src = builtins.fetchTarball {
|
2020-08-17 18:51:51 +02:00
|
|
|
url = "http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/${dir_nr}/l_mpi_${version}.tgz";
|
|
|
|
sha256 = "1za4zyvxm5bfkrca843na6sxq2gq7qb87s0zysa7dnyqjwa11n45";
|
2020-06-29 20:46:30 +02:00
|
|
|
};
|
|
|
|
|
2020-06-30 15:41:18 +02:00
|
|
|
buildInputs = [
|
|
|
|
rpmextract
|
2020-07-01 17:57:31 +02:00
|
|
|
autoPatchelfHook
|
|
|
|
gcc.cc.lib
|
|
|
|
zlib
|
2020-08-17 18:51:51 +02:00
|
|
|
ucx
|
|
|
|
numactl
|
|
|
|
rdma-core
|
|
|
|
libpsm2
|
|
|
|
patchelf
|
2020-06-30 15:41:18 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
postUnpack = ''
|
|
|
|
pushd $sourceRoot
|
|
|
|
rpmextract rpm/intel-mpi-*.rpm
|
|
|
|
popd
|
|
|
|
'';
|
2020-06-29 20:46:30 +02:00
|
|
|
|
2020-06-30 15:41:18 +02:00
|
|
|
patches = [
|
|
|
|
./mpicc.patch
|
|
|
|
./mpicxx.patch
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
2020-08-17 18:51:51 +02:00
|
|
|
pushd opt/intel/compilers_and_libraries_${internal-ver}/linux/mpi/intel64/bin
|
2020-07-20 16:05:00 +02:00
|
|
|
for i in mpi* ; do
|
|
|
|
echo "Fixing paths in $i"
|
|
|
|
sed -i "s:I_MPI_SUBSTITUTE_INSTALLDIR:$out:g" "$i"
|
|
|
|
done
|
|
|
|
popd
|
2020-06-30 15:41:18 +02:00
|
|
|
'';
|
2020-06-29 20:46:30 +02:00
|
|
|
|
2020-06-30 15:41:18 +02:00
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
2020-08-17 18:51:51 +02:00
|
|
|
cd opt/intel/compilers_and_libraries_${internal-ver}/linux/mpi/intel64
|
2020-06-30 15:41:18 +02:00
|
|
|
mkdir -p $out
|
2020-06-29 20:46:30 +02:00
|
|
|
mv etc $out
|
|
|
|
mv bin $out
|
|
|
|
mv include $out
|
|
|
|
mkdir $out/lib
|
|
|
|
cp -a lib/lib* $out/lib
|
|
|
|
cp -a lib/${lib_variant}_mt/lib* $out/lib
|
2020-08-17 18:51:51 +02:00
|
|
|
cp -a libfabric/lib/* $out/lib
|
|
|
|
cp -a libfabric/lib/prov/* $out/lib
|
|
|
|
cp -a libfabric/bin/* $out/bin
|
2020-07-20 16:05:00 +02:00
|
|
|
ln -s . $out/intel64
|
2020-07-01 17:57:31 +02:00
|
|
|
rm $out/lib/libmpi.dbg
|
2020-08-17 18:51:51 +02:00
|
|
|
|
|
|
|
# Fixup Intel PSM2 library missing (now located at PSMX2)
|
|
|
|
ln -s $out/lib/libpsmx2-fi.so $out/lib/libpsm2-fi.so
|
|
|
|
'';
|
|
|
|
|
|
|
|
dontAutoPatchelf = true;
|
|
|
|
|
|
|
|
# The rpath of libfabric.so bundled with Intel MPI is patched to include the
|
|
|
|
# rdma-core lib path, as is required for dlopen to find the rdma components.
|
|
|
|
# TODO: Try the upstream libfabric library with rdma support, so we can avoid
|
|
|
|
# this hack.
|
|
|
|
postFixup = ''
|
|
|
|
autoPatchelf -- $out
|
|
|
|
patchelf --set-rpath "$out/lib:${rdma-core}/lib:${libpsm2}/lib" $out/lib/libfabric.so
|
|
|
|
echo "Patched RPATH in libfabric.so to: $(patchelf --print-rpath $out/lib/libfabric.so)"
|
2020-06-29 20:46:30 +02:00
|
|
|
'';
|
|
|
|
}
|