13 # either libfabric or ucx work for ch4backend on linux. On darwin, neither of
14 # these libraries currently build so this argument is ignored on Darwin.
16 # Process managers to build (`--with-pm`),
17 # cf. https://github.com/pmodels/mpich/blob/b80a6d7c24defe7cdf6c57c52430f8075a0a41d6/README.vin#L562-L586
23 # PMIX support is likely incompatible with process managers (`--with-pm`)
24 # https://github.com/NixOS/nixpkgs/pull/274804#discussion_r1432601476
29 withPmStr = if withPm != [ ] then builtins.concatStringsSep ":" withPm else "no";
32 assert (ch4backend.pname == "ucx" || ch4backend.pname == "libfabric");
34 stdenv.mkDerivation rec {
39 url = "https://www.mpich.org/static/downloads/${version}/mpich-${version}.tar.gz";
40 hash = "sha256-egGRgMUdFzitnF2NRSMU3mXoKO4kC8stH4DemmW+iKg=";
44 # Disables ROMIO test which was enabled in
45 # https://github.com/pmodels/mpich/commit/09686f45d77b7739f7aef4c2c6ef4c3060946595
46 # The test searches for mpicc in $out/bin, which is not yet present in the checkPhase
47 # Moreover it fails one test.
48 ./disable-romio-tests.patch
60 "--with-pm=${withPmStr}"
62 ++ lib.optionals (lib.versionAtLeast gfortran.version "10") [
63 "FFLAGS=-fallow-argument-mismatch" # https://github.com/pmodels/mpich/issues/4300
64 "FCFLAGS=-fallow-argument-mismatch"
66 ++ lib.optionals pmixSupport [
70 enableParallelBuilding = true;
84 ++ lib.optional (!stdenv.hostPlatform.isDarwin) ch4backend
85 ++ lib.optional pmixSupport pmix
86 ++ lib.optional stdenv.hostPlatform.isDarwin darwin.apple_sdk.frameworks.Foundation;
88 # test_double_serializer.test fails on darwin
89 doCheck = !stdenv.hostPlatform.isDarwin;
92 # Ensure the default compilers are the ones mpich was built with
93 sed -i 's:CC="gcc":CC=${stdenv.cc}/bin/gcc:' $out/bin/mpicc
94 sed -i 's:CXX="g++":CXX=${stdenv.cc}/bin/g++:' $out/bin/mpicxx
95 sed -i 's:FC="gfortran":FC=${gfortran}/bin/gfortran:' $out/bin/mpifort
99 # As far as we know, --with-pmix silently disables all of `--with-pm`
100 broken = pmixSupport && withPm != [ ];
102 description = "Implementation of the Message Passing Interface (MPI) standard";
105 MPICH2 is a free high-performance and portable implementation of
106 the Message Passing Interface (MPI) standard, both version 1 and
109 homepage = "http://www.mcs.anl.gov/mpi/mpich2/";
111 url = "http://git.mpich.org/mpich.git/blob/a385d6d0d55e83c3709ae851967ce613e892cd21:/COPYRIGHT";
112 fullName = "MPICH license (permissive)";
114 maintainers = [ lib.maintainers.markuskowa ];
115 platforms = lib.platforms.linux ++ lib.platforms.darwin;