Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 stdenv, 3 lib, 4 fetchurl, 5 perl, 6 gfortran, 7 automake, 8 autoconf, 9 openssh, 10 hwloc, 11 python3, 12 # either libfabric or ucx work for ch4backend on linux. On darwin, neither of 13 # these libraries currently build so this argument is ignored on Darwin. 14 ch4backend, 15 # Process managers to build (`--with-pm`), 16 # cf. https://github.com/pmodels/mpich/blob/b80a6d7c24defe7cdf6c57c52430f8075a0a41d6/README.vin#L562-L586 17 withPm ? [ 18 "hydra" 19 "gforker" 20 ], 21 pmix, 22 # PMIX support is likely incompatible with process managers (`--with-pm`) 23 # https://github.com/NixOS/nixpkgs/pull/274804#discussion_r1432601476 24 pmixSupport ? false, 25}: 26 27let 28 withPmStr = if withPm != [ ] then builtins.concatStringsSep ":" withPm else "no"; 29in 30 31assert (ch4backend.pname == "ucx" || ch4backend.pname == "libfabric"); 32 33stdenv.mkDerivation rec { 34 pname = "mpich"; 35 version = "4.3.1"; 36 37 src = fetchurl { 38 url = "https://www.mpich.org/static/downloads/${version}/mpich-${version}.tar.gz"; 39 hash = "sha256-rMEcsr3Glnjci7p0fCSigjPFhZb4HwN4W/K3u3oO99w="; 40 }; 41 42 patches = [ 43 # Disables ROMIO test which was enabled in 44 # https://github.com/pmodels/mpich/commit/09686f45d77b7739f7aef4c2c6ef4c3060946595 45 # The test searches for mpicc in $out/bin, which is not yet present in the checkPhase 46 # Moreover it fails one test. 47 ./disable-romio-tests.patch 48 ]; 49 50 outputs = [ 51 "out" 52 "doc" 53 "man" 54 ]; 55 56 configureFlags = [ 57 "--enable-shared" 58 "--with-pm=${withPmStr}" 59 ] 60 ++ lib.optionals (lib.versionAtLeast gfortran.version "10") [ 61 "FFLAGS=-fallow-argument-mismatch" # https://github.com/pmodels/mpich/issues/4300 62 "FCFLAGS=-fallow-argument-mismatch" 63 ] 64 ++ lib.optionals pmixSupport [ 65 "--with-pmix" 66 ]; 67 68 enableParallelBuilding = true; 69 70 nativeBuildInputs = [ 71 gfortran 72 python3 73 autoconf 74 automake 75 ]; 76 buildInputs = [ 77 perl 78 openssh 79 hwloc 80 ] 81 ++ lib.optional (!stdenv.hostPlatform.isDarwin) ch4backend 82 ++ lib.optional pmixSupport pmix; 83 84 # test_double_serializer.test fails on darwin 85 doCheck = !stdenv.hostPlatform.isDarwin; 86 87 preFixup = '' 88 # Ensure the default compilers are the ones mpich was built with 89 sed -i 's:CC="gcc":CC=${stdenv.cc}/bin/gcc:' $out/bin/mpicc 90 sed -i 's:CXX="g++":CXX=${stdenv.cc}/bin/g++:' $out/bin/mpicxx 91 sed -i 's:FC="gfortran":FC=${gfortran}/bin/gfortran:' $out/bin/mpifort 92 ''; 93 94 meta = { 95 # As far as we know, --with-pmix silently disables all of `--with-pm` 96 broken = pmixSupport && withPm != [ ]; 97 98 description = "Implementation of the Message Passing Interface (MPI) standard"; 99 100 longDescription = '' 101 MPICH2 is a free high-performance and portable implementation of 102 the Message Passing Interface (MPI) standard, both version 1 and 103 version 2. 104 ''; 105 homepage = "http://www.mcs.anl.gov/mpi/mpich2/"; 106 license = { 107 url = "http://git.mpich.org/mpich.git/blob/a385d6d0d55e83c3709ae851967ce613e892cd21:/COPYRIGHT"; 108 fullName = "MPICH license (permissive)"; 109 }; 110 maintainers = [ lib.maintainers.markuskowa ]; 111 platforms = lib.platforms.linux ++ lib.platforms.darwin; 112 }; 113}