about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/mpich
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-02-16 18:32:21 +0000
committerAlyssa Ross <hi@alyssa.is>2021-02-16 18:32:21 +0000
commit9becdcc5df71b47a5da84ad670e9a7eae9e0c65a (patch)
tree2ddf0335eb393f89501e3753b50c3f7ab0552d12 /nixpkgs/pkgs/development/libraries/mpich
parent49f2a77ac9abc88c253f68952eda26557fc3b555 (diff)
parentff96a0fa5635770390b184ae74debea75c3fd534 (diff)
downloadnixlib-9becdcc5df71b47a5da84ad670e9a7eae9e0c65a.tar
nixlib-9becdcc5df71b47a5da84ad670e9a7eae9e0c65a.tar.gz
nixlib-9becdcc5df71b47a5da84ad670e9a7eae9e0c65a.tar.bz2
nixlib-9becdcc5df71b47a5da84ad670e9a7eae9e0c65a.tar.lz
nixlib-9becdcc5df71b47a5da84ad670e9a7eae9e0c65a.tar.xz
nixlib-9becdcc5df71b47a5da84ad670e9a7eae9e0c65a.tar.zst
nixlib-9becdcc5df71b47a5da84ad670e9a7eae9e0c65a.zip
nixpkgs: merge nixos-unstable
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/mpich')
-rw-r--r--nixpkgs/pkgs/development/libraries/mpich/default.nix47
-rw-r--r--nixpkgs/pkgs/development/libraries/mpich/jsonc-test.patch62
2 files changed, 96 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";
diff --git a/nixpkgs/pkgs/development/libraries/mpich/jsonc-test.patch b/nixpkgs/pkgs/development/libraries/mpich/jsonc-test.patch
new file mode 100644
index 000000000000..2f8d87b409b4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/mpich/jsonc-test.patch
@@ -0,0 +1,62 @@
+--- b/modules/json-c/configure.ac
++++ a/modules/json-c/configure.ac
+@@ -75,7 +75,7 @@
+ AC_FUNC_VPRINTF
+ AC_FUNC_MEMCMP
+ AC_CHECK_FUNCS([realloc])
++AC_CHECK_FUNCS(strcasecmp strdup strerror snprintf vsnprintf vasprintf open strncasecmp setlocale)
+-AC_CHECK_FUNCS(strcasecmp strdup strerror snprintf vsnprintf open strncasecmp setlocale)
+ AC_CHECK_DECLS([INFINITY], [], [], [[#include <math.h>]])
+ AC_CHECK_DECLS([nan], [], [], [[#include <math.h>]])
+ AC_CHECK_DECLS([isnan], [], [], [[#include <math.h>]])
+--- b/modules/json-c/json_pointer.c
++++ a/modules/json-c/json_pointer.c
+@@ -208,7 +208,7 @@
+ 	}
+
+ 	va_start(args, path_fmt);
++	rc = vasprintf(&path_copy, path_fmt, args);
+-	rc = json_vasprintf(&path_copy, path_fmt, args);
+ 	va_end(args);
+
+ 	if (rc < 0)
+@@ -287,7 +287,7 @@
+
+ 	/* pass a working copy to the recursive call */
+ 	va_start(args, path_fmt);
++	rc = vasprintf(&path_copy, path_fmt, args);
+-	rc = json_vasprintf(&path_copy, path_fmt, args);
+ 	va_end(args);
+
+ 	if (rc < 0)
+--- b/modules/json-c/printbuf.c
++++ a/modules/json-c/printbuf.c
+@@ -129,7 +129,7 @@
+      would have been written - this code handles both cases. */
+   if(size == -1 || size > 127) {
+     va_start(ap, msg);
++    if((size = vasprintf(&t, msg, ap)) < 0) { va_end(ap); return -1; }
+-    if((size = json_vasprintf(&t, msg, ap)) < 0) { va_end(ap); return -1; }
+     va_end(ap);
+     printbuf_memappend(p, t, size);
+     free(t);
+--- b/modules/json-c/vasprintf_compat.h
++++ a/modules/json-c/vasprintf_compat.h
+@@ -8,8 +8,9 @@
+
+ #include "snprintf_compat.h"
+
++#if !defined(HAVE_VASPRINTF)
+ /* CAW: compliant version of vasprintf */
++static int vasprintf(char **buf, const char *fmt, va_list ap)
+-static int json_vasprintf(char **buf, const char *fmt, va_list ap)
+ {
+ #ifndef WIN32
+ 	static char _T_emptybuffer = '\0';
+@@ -40,5 +41,6 @@
+
+ 	return chars;
+ }
++#endif /* !HAVE_VASPRINTF */
+
+ #endif /* __vasprintf_compat_h */