From 74222706bf4dd5a5ee7004c2823c1206ef80f214 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Mon, 29 Jun 2020 20:46:30 +0200 Subject: [PATCH] Add Intel MPI --- bsc/intel-mpi/default.nix | 73 +++++++++++++++++++++++++++++++++++++++ default.nix | 13 ++++++- 2 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 bsc/intel-mpi/default.nix diff --git a/bsc/intel-mpi/default.nix b/bsc/intel-mpi/default.nix new file mode 100644 index 0000000..82b0f79 --- /dev/null +++ b/bsc/intel-mpi/default.nix @@ -0,0 +1,73 @@ +{ stdenv +, requireFile +, rpmextract +, libfabric +, patchelf +, enableDebug ? false +}: + + +stdenv.mkDerivation rec { + name = "intel-mpi-${version}"; + version = "2019.7.217"; + + lib_variant = (if enableDebug then "debug" else "release"); + + src = requireFile { + name = "l_mpi_2019.7.217.tgz"; + sha256 = "01wwmiqff5lad7cdi8i57bs3kiphpjfv52sxll1w0jpq4c03nf4h"; + message = '' + The package with Intel MPI cannot be redistributed freely, so you must do it + manually. Go to: + + https://software.intel.com/content/www/us/en/develop/tools/mpi-library.html + + And register in order to download Intel MPI (is free of charge). Then you will + be allowed to download it. Copy the url and use: + + nix-prefetch-url http://registrationcenter-download.intel.com/...../l_mpi_2019.7.217.tgz + + To add it to the store. Then try again building this derivation. + ''; + }; + + dontBuild = true; + installPhase = '' + mkdir -p $out + rpmextract rpm/intel-mpi-*.rpm + cd opt/intel/compilers_and_libraries_2020.1.217/linux/mpi/intel64 + + for i in bin/mpi* ; do + sed -i "s:I_MPI_SUBSTITUTE_INSTALLDIR:$out:g" $i + done + + 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 + + + ''; + + preFixup = '' + echo $out/lib contains: + ls -l $out/lib + echo ---------------------- + find $out/bin -type f -executable -exec \ + patchelf \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ + '{}' \; + + find $out/lib -name '*.so' -exec \ + patchelf --set-rpath "$out/lib:${stdenv.cc}/lib:${stdenv.glibc}/lib:${libfabric}/lib" '{}' \; + ''; + + buildInputs = [ + rpmextract + libfabric + patchelf + ]; +} diff --git a/default.nix b/default.nix index 7a998ad..daafccf 100644 --- a/default.nix +++ b/default.nix @@ -12,6 +12,7 @@ let #mpi = pkgs.mpich; #mpi = pkgs.openmpi; mpi = openmpi; # Our OpenMPI variant + #mpi = intel-mpi; # Load the default compiler #stdenv = pkgs.gcc7Stdenv; @@ -31,6 +32,15 @@ let enableCxx = true; }; + intel-mpi-2019 = callPackage ./bsc/intel-mpi/default.nix { + # Intel MPI provides a debug version of the MPI library, but + # by default we use the release variant for performance + enableDebug = false; + }; + + # Default Intel MPI version is 2019 (the last one) + intel-mpi = intel-mpi-2019; + fftw = callPackage ./bsc/fftw/default.nix { mpi = mpi; }; @@ -81,7 +91,8 @@ let # Apps for Garlic nbody = callPackage ./bsc/apps/nbody/default.nix { stdenv = pkgs.gcc9Stdenv; - inherit mpi tampi; + mpi = mpi; + tampi = tampi; nanos6 = nanos6-git; };