about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/mpich/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/mpich/default.nix')
-rw-r--r--nixpkgs/pkgs/development/libraries/mpich/default.nix47
1 files changed, 34 insertions, 13 deletions
diff --git a/nixpkgs/pkgs/development/libraries/mpich/default.nix b/nixpkgs/pkgs/development/libraries/mpich/default.nix
index f7cdf7f97c02..49af2593e51e 100644
--- a/nixpkgs/pkgs/development/libraries/mpich/default.nix
+++ b/nixpkgs/pkgs/development/libraries/mpich/default.nix
@@ -1,24 +1,52 @@
-{ lib, stdenv, fetchurl, perl, gfortran
-,  openssh, hwloc
+{ stdenv, lib, fetchurl, perl, gfortran
+, openssh, hwloc, autoconf, automake, libtool
+# device options are ch3 or ch4
+, device ? "ch4"
+# backend option are libfabric or ucx
+, ch4backend ? "libfabric"
+, ucx, libfabric
+# Process manager to build
+, withPm ? "hydra:gforker"
 } :
 
+assert (ch4backend == "ucx" || ch4backend == "libfabric");
+
 stdenv.mkDerivation  rec {
   pname = "mpich";
-  version = "3.3.2";
+  version = "3.4.1";
 
   src = fetchurl {
     url = "https://www.mpich.org/static/downloads/${version}/mpich-${version}.tar.gz";
-    sha256 = "1farz5zfx4cd0c3a0wb9pgfypzw0xxql1j1294z1sxslga1ziyjb";
+    sha256 = "09wpfw9lsrc84vcmfw94razd4xv4znx4mmg7rqmljvgg0jc96dl8";
   };
 
+  patches = [
+    # Reverts an upstream change that causes json-c test to fail
+    ./jsonc-test.patch
+  ];
+
+  # Required for the json-c patch
+  nativeBuildInputs = [ autoconf automake libtool ];
+
+  # Update configure after patch
+  postPatch = ''
+    cd modules/json-c
+    ./autogen.sh
+    cd ../..
+  '';
+
+
   configureFlags = [
     "--enable-shared"
     "--enable-sharedlib"
+    "--with-pm=${withPm}"
   ];
 
   enableParallelBuilding = true;
 
-  buildInputs = [ perl gfortran openssh hwloc ];
+  buildInputs = [ perl gfortran openssh hwloc ]
+    ++ lib.optional (ch4backend == "ucx") ucx
+    ++ lib.optional (ch4backend == "libfabric") libfabric;
 
   doCheck = true;
 
@@ -27,14 +55,7 @@ stdenv.mkDerivation  rec {
     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
-  ''
-  + 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 lib; {
     description = "Implementation of the Message Passing Interface (MPI) standard";