2021-01-07 22:40:42 +00:00
|
|
|
{ stdenv, lib, fetchurl, perl, gfortran
|
2022-01-23 12:32:29 +00:00
|
|
|
, openssh, hwloc, python3
|
2021-05-07 04:08:19 +00:00
|
|
|
# either libfabric or ucx work for ch4backend on linux. On darwin, neither of
|
|
|
|
# these libraries currently build so this argument is ignored on Darwin.
|
|
|
|
, ch4backend
|
2023-12-25 12:39:38 +00:00
|
|
|
# Process managers to build (`--with-pm`),
|
2023-12-18 16:05:31 +00:00
|
|
|
# cf. https://github.com/pmodels/mpich/blob/b80a6d7c24defe7cdf6c57c52430f8075a0a41d6/README.vin#L562-L586
|
|
|
|
, withPm ? [ "hydra" "gforker" ]
|
2023-12-16 18:38:20 +00:00
|
|
|
, pmix
|
2023-12-25 12:39:38 +00:00
|
|
|
# PMIX support is likely incompatible with process managers (`--with-pm`)
|
|
|
|
# https://github.com/NixOS/nixpkgs/pull/274804#discussion_r1432601476
|
2023-12-18 16:05:31 +00:00
|
|
|
, pmixSupport ? false
|
2018-02-02 18:35:42 +00:00
|
|
|
} :
|
2010-01-27 22:13:19 +00:00
|
|
|
|
2023-12-18 16:05:31 +00:00
|
|
|
let
|
2024-01-16 02:24:05 +00:00
|
|
|
withPmStr = if withPm != [ ] then builtins.concatStringsSep ":" withPm else "no";
|
2023-12-18 16:05:31 +00:00
|
|
|
in
|
|
|
|
|
2021-05-07 04:08:19 +00:00
|
|
|
assert (ch4backend.pname == "ucx" || ch4backend.pname == "libfabric");
|
2021-01-07 22:40:42 +00:00
|
|
|
|
2017-09-10 11:43:32 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "mpich";
|
2024-02-12 16:43:17 +00:00
|
|
|
version = "4.2.0";
|
2008-02-21 16:17:43 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2018-06-28 18:43:35 +00:00
|
|
|
url = "https://www.mpich.org/static/downloads/${version}/mpich-${version}.tar.gz";
|
2024-02-12 16:43:17 +00:00
|
|
|
sha256 = "sha256-pkpmeBueUxKtBS0yaJ4jJS90WyfuiBisKsDIIJvAuQ4=";
|
2008-02-21 16:17:43 +00:00
|
|
|
};
|
|
|
|
|
2023-10-08 09:09:21 +00:00
|
|
|
outputs = [ "out" "doc" "man" ];
|
|
|
|
|
2018-02-02 18:35:42 +00:00
|
|
|
configureFlags = [
|
|
|
|
"--enable-shared"
|
2024-01-16 02:24:05 +00:00
|
|
|
"--with-pm=${withPmStr}"
|
2021-12-05 20:55:56 +00:00
|
|
|
] ++ lib.optionals (lib.versionAtLeast gfortran.version "10") [
|
|
|
|
"FFLAGS=-fallow-argument-mismatch" # https://github.com/pmodels/mpich/issues/4300
|
|
|
|
"FCFLAGS=-fallow-argument-mismatch"
|
2023-12-16 18:38:20 +00:00
|
|
|
] ++ lib.optionals pmixSupport [
|
2024-01-17 15:00:02 +00:00
|
|
|
"--with-pmix"
|
2018-02-02 18:35:42 +00:00
|
|
|
];
|
|
|
|
|
2018-08-06 12:44:46 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2022-01-23 12:32:29 +00:00
|
|
|
nativeBuildInputs = [ gfortran python3 ];
|
2021-09-03 11:33:32 +00:00
|
|
|
buildInputs = [ perl openssh hwloc ]
|
2024-01-17 15:00:02 +00:00
|
|
|
++ lib.optional (!stdenv.isDarwin) ch4backend
|
|
|
|
++ lib.optional pmixSupport pmix;
|
|
|
|
|
2018-02-02 18:35:42 +00:00
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
preFixup = ''
|
2018-12-19 00:53:18 +00:00
|
|
|
# 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
|
2021-01-07 22:40:42 +00:00
|
|
|
'';
|
2008-02-21 16:17:43 +00:00
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2023-12-25 12:39:38 +00:00
|
|
|
# As far as we know, --with-pmix silently disables all of `--with-pm`
|
2024-01-16 02:24:05 +00:00
|
|
|
broken = pmixSupport && withPm != [ ];
|
2023-12-18 16:05:31 +00:00
|
|
|
|
2014-08-24 14:21:08 +00:00
|
|
|
description = "Implementation of the Message Passing Interface (MPI) standard";
|
2010-01-27 22:13:19 +00:00
|
|
|
|
2009-03-03 13:27:40 +00:00
|
|
|
longDescription = ''
|
|
|
|
MPICH2 is a free high-performance and portable implementation of
|
|
|
|
the Message Passing Interface (MPI) standard, both version 1 and
|
|
|
|
version 2.
|
|
|
|
'';
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "http://www.mcs.anl.gov/mpi/mpich2/";
|
2018-02-02 20:08:47 +00:00
|
|
|
license = {
|
2020-04-01 01:11:51 +00:00
|
|
|
url = "http://git.mpich.org/mpich.git/blob/a385d6d0d55e83c3709ae851967ce613e892cd21:/COPYRIGHT";
|
2018-02-02 20:08:47 +00:00
|
|
|
fullName = "MPICH license (permissive)";
|
|
|
|
};
|
|
|
|
maintainers = [ maintainers.markuskowa ];
|
2018-12-19 00:53:18 +00:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
2008-02-21 16:17:43 +00:00
|
|
|
};
|
|
|
|
}
|