From c70d35cd50a7ec05f9b6a1b736ca5c81e6b9132a Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Wed, 19 Aug 2020 11:06:23 +0200 Subject: [PATCH] Add MPICH with libfabric enabled --- bsc/mpich/default.nix | 62 +++++++++++++++++++++++++++++++++++++++++++ default.nix | 2 +- 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 bsc/mpich/default.nix diff --git a/bsc/mpich/default.nix b/bsc/mpich/default.nix new file mode 100644 index 0000000..bf406c1 --- /dev/null +++ b/bsc/mpich/default.nix @@ -0,0 +1,62 @@ +{ + stdenv, + fetchurl, + perl, + gfortran, + openssh, + hwloc, + libfabric +}: + +stdenv.mkDerivation rec { + pname = "mpich"; + version = "3.3.2"; + + src = fetchurl { + url = "https://www.mpich.org/static/downloads/${version}/mpich-${version}.tar.gz"; + sha256 = "1farz5zfx4cd0c3a0wb9pgfypzw0xxql1j1294z1sxslga1ziyjb"; + }; + + configureFlags = [ + "--enable-shared" + "--enable-sharedlib" + "--with-device=ch4:ofi" + "--with-libfabric=${libfabric}" + ]; + + enableParallelBuilding = true; + + buildInputs = [ perl gfortran openssh hwloc libfabric ]; + + # doCheck = true; # Fails + + preFixup = '' + # Ensure the default compilers are the ones mpich was built with + sed -i 's:CC="gcc":CC=${stdenv.cc}/bin/gcc:' $out/bin/mpicc + sed -i 's:CXX="g++":CXX=${stdenv.cc}/bin/g++:' $out/bin/mpicxx + sed -i 's:FC="gfortran":FC=${gfortran}/bin/gfortran:' $out/bin/mpifort + '' + + stdenv.lib.optionalString (!stdenv.isDarwin) '' + # /tmp/nix-build... ends up in the RPATH, fix it manually + for entry in $out/bin/mpichversion $out/bin/mpivars; do + echo "fix rpath: $entry" + patchelf --set-rpath "$out/lib" $entry + done + ''; + + meta = with stdenv.lib; { + description = "Implementation of the Message Passing Interface (MPI) standard"; + + longDescription = '' + MPICH is a high-performance and widely portable implementation of + the Message Passing Interface (MPI) standard (MPI-1, MPI-2 and MPI-3). + ''; + homepage = "http://www.mpich.org"; + license = { + url = "https://github.com/pmodels/mpich/blob/v${version}/COPYRIGHT"; + fullName = "MPICH license (permissive)"; + }; + maintainers = [ ]; + platforms = platforms.linux ++ platforms.darwin; + }; +} diff --git a/default.nix b/default.nix index 44e919e..3abc476 100644 --- a/default.nix +++ b/default.nix @@ -38,7 +38,7 @@ let osumb = callPackage ./bsc/osu/default.nix { }; - mpich = pkgs.mpich; + mpich = callPackage ./bsc/mpich/default.nix { }; # Default Intel MPI version is 2019 (the last one) impi = intel-mpi;