From ae6b0ae161663d3c911d6dcabf61643146586fcd Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 3 Oct 2025 14:14:20 +0200 Subject: [PATCH] Move MPICH to pkgs/mpich and set as default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Aleix Boné --- overlay.nix | 2 ++ pkgs/mpich/default.nix | 78 +++++++++++++----------------------------- pkgs/overlay.nix | 30 ---------------- 3 files changed, 25 insertions(+), 85 deletions(-) diff --git a/overlay.nix b/overlay.nix index 4831c555..08f51901 100644 --- a/overlay.nix +++ b/overlay.nix @@ -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 { }; diff --git a/pkgs/mpich/default.nix b/pkgs/mpich/default.nix index 36bee859..4b5307ab 100644 --- a/pkgs/mpich/default.nix +++ b/pkgs/mpich/default.nix @@ -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; - }; -} +}) diff --git a/pkgs/overlay.nix b/pkgs/overlay.nix index 4198cd30..d3be38d6 100644 --- a/pkgs/overlay.nix +++ b/pkgs/overlay.nix @@ -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