Move MPICH to pkgs/mpich and set as default

Reviewed-by: Aleix Boné <abonerib@bsc.es>
This commit is contained in:
Rodrigo Arias 2025-10-03 14:14:20 +02:00
parent 01986c376b
commit ae6b0ae161
3 changed files with 25 additions and 85 deletions

View File

@ -20,6 +20,8 @@ let
jemallocNanos6 = callPackage ./pkgs/nanos6/jemalloc.nix { };
lmbench = callPackage ./pkgs/lmbench/default.nix { };
mcxx = callPackage ./pkgs/mcxx/default.nix { };
mpi = final.mpich; # Set MPICH as default
mpich = callPackage ./pkgs/mpich/default.nix { mpich = prev.mpich; };
nanos6 = callPackage ./pkgs/nanos6/default.nix { };
nanos6Debug = final.nanos6.override { enableDebug = true; };
nixtools = callPackage ./pkgs/nixtools/default.nix { };

View File

@ -1,68 +1,36 @@
{
stdenv
, lib
, fetchurl
, perl
, gfortran
, openssh
, hwloc
, libfabric
, enableDebug ? false
, mpich
, pmix
, gfortran
, symlinkJoin
}:
with lib;
stdenv.mkDerivation rec {
pname = "mpich";
version = "3.3.2";
src = fetchurl {
url = "https://www.mpich.org/static/downloads/${version}/mpich-${version}.tar.gz";
sha256 = "1farz5zfx4cd0c3a0wb9pgfypzw0xxql1j1294z1sxslga1ziyjb";
let
# pmix comes with the libraries in .out and headers in .dev
pmixAll = symlinkJoin {
name = "pmix-all";
paths = [ pmix.dev pmix.out ];
};
in mpich.overrideAttrs (old: {
buildInput = old.buildInputs ++ [
libfabric
pmixAll
];
configureFlags = [
"--enable-shared"
"--enable-sharedlib"
"--with-pm=no"
"--with-device=ch4:ofi"
"--with-pmi=pmix"
"--with-pmix=${pmixAll}"
"--with-libfabric=${libfabric}"
]
++ optional enableDebug "--enable-g=dbg,log";
enableParallelBuilding = true;
buildInputs = [ perl gfortran openssh hwloc libfabric ];
"--enable-g=log"
] ++ lib.optionals (lib.versionAtLeast gfortran.version "10") [
"FFLAGS=-fallow-argument-mismatch" # https://github.com/pmodels/mpich/issues/4300
"FCFLAGS=-fallow-argument-mismatch"
];
hardeningDisable = [ "all" ];
# doCheck = true; # Fails
preFixup = ''
# 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
''
+ 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";
longDescription = ''
MPICH is a high-performance and widely portable implementation of
the Message Passing Interface (MPI) standard (MPI-1, MPI-2 and MPI-3).
'';
homepage = "http://www.mpich.org";
license = {
url = "https://github.com/pmodels/mpich/blob/v${version}/COPYRIGHT";
fullName = "MPICH license (permissive)";
};
maintainers = [ ];
platforms = platforms.linux ++ platforms.darwin;
};
}
})

View File

@ -1,35 +1,5 @@
final: prev:
{
# Set MPICH as default
mpi = final.mpich;
# Configure the network for MPICH
mpich = with final; let
# pmix comes with the libraries in .out and headers in .dev
pmixAll = symlinkJoin {
name = "pmix-all";
paths = [ pmix.dev pmix.out ];
};
in prev.mpich.overrideAttrs (old: {
buildInput = old.buildInputs ++ [
libfabric
pmixAll
];
configureFlags = [
"--enable-shared"
"--enable-sharedlib"
"--with-pm=no"
"--with-device=ch4:ofi"
"--with-pmi=pmix"
"--with-pmix=${pmixAll}"
"--with-libfabric=${libfabric}"
"--enable-g=log"
] ++ lib.optionals (lib.versionAtLeast gfortran.version "10") [
"FFLAGS=-fallow-argument-mismatch" # https://github.com/pmodels/mpich/issues/4300
"FCFLAGS=-fallow-argument-mismatch"
];
});
slurm = prev.slurm.overrideAttrs (old: {
patches = (old.patches or []) ++ [
# See https://bugs.schedmd.com/show_bug.cgi?id=19324