fix: add k8s and hpc modules to main repo
This commit is contained in:
69
modules/hpc/intel-mpi.nix
Normal file
69
modules/hpc/intel-mpi.nix
Normal file
@@ -0,0 +1,69 @@
|
||||
{ stdenv, lib, glibc, gcc, file , patchelf , makeWrapper }:
|
||||
|
||||
let
|
||||
|
||||
preinstDir = "opt/intel/oneapi/mpi/${version}";
|
||||
version = "2021.1.1";
|
||||
|
||||
self = stdenv.mkDerivation rec {
|
||||
inherit version;
|
||||
name = "intelmpi-${version}";
|
||||
src = ./intel-mpi.tgz;
|
||||
|
||||
nativeBuildInputs= [ file patchelf makeWrapper ];
|
||||
|
||||
dontPatchELF = true;
|
||||
dontStrip = true;
|
||||
|
||||
installPhase = ''
|
||||
mpi=$out/opt/intel/oneapi/mpi
|
||||
mkdir -p $mpi
|
||||
cp -r * $mpi
|
||||
cp -rs $mpi/${version}/bin $out
|
||||
'';
|
||||
|
||||
postFixup = ''
|
||||
echo "Patching rpath and interpreter..."
|
||||
for f in $(find $out -type f -executable); do
|
||||
type="$(file -b --mime-type $f)"
|
||||
case "$type" in
|
||||
"application/executable"|"application/x-executable")
|
||||
echo "Patching executable: $f"
|
||||
patchelf --set-interpreter $(echo ${glibc}/lib/ld-linux*.so.2) --set-rpath ${glibc}/lib:\$ORIGIN:\$ORIGIN/../lib $f || true
|
||||
;;
|
||||
"application/x-sharedlib"|"application/x-pie-executable")
|
||||
echo "Patching library: $f"
|
||||
patchelf --set-rpath ${glibc}/lib:\$ORIGIN:\$ORIGIN/../lib:\$ORIGIN/../../libfabric/lib $f || true
|
||||
;;
|
||||
*)
|
||||
echo "$f ($type) not patched"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
echo "Fixing path into scripts..."
|
||||
for file in `grep -l -r "/${preinstDir}" $out`; do
|
||||
sed -e "s,/${preinstDir},$out,g" -i $file
|
||||
done
|
||||
for file in `grep -l -r "I_MPI_SUBSTITUTE_INSTALLDIR" $out`; do
|
||||
sed -e "s,I_MPI_SUBSTITUTE_INSTALLDIR,$out,g" -i $file
|
||||
done
|
||||
|
||||
wrapProgram $out/${preinstDir}/bin/mpiexec.hydra \
|
||||
--set UCX_TLS ud,sm,self \
|
||||
--set I_MPI_FABRICS shm:ofi \
|
||||
--set FI_PROVIDER_PATH $out/${preinstDir}/libfabric/lib/prov \
|
||||
--set FI_PROVIDER mlx
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
isIntel = true;
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "Intel MPI ${version} library";
|
||||
maintainers = [ lib.maintainers.dguibert ];
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
};
|
||||
in self
|
||||
|
||||
Reference in New Issue
Block a user