From 4b9865028895c84295f624788d06a0e851028cf4 Mon Sep 17 00:00:00 2001 From: qbisi Date: Thu, 14 Nov 2024 22:18:10 +0800 Subject: [PATCH 1/3] mumps: remove mpi from nativeBuildInputs mpi should be buildInputs when mpiSupport is true. since mpi is propogated by scalapack, there is no need to add mpi to buildInputs. --- pkgs/by-name/mu/mumps/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/by-name/mu/mumps/package.nix b/pkgs/by-name/mu/mumps/package.nix index 2620d5b602b5..9376fe54ea61 100644 --- a/pkgs/by-name/mu/mumps/package.nix +++ b/pkgs/by-name/mu/mumps/package.nix @@ -105,7 +105,7 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ gfortran - ] ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames ++ lib.optional mpiSupport mpi; + ] ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames; # Parmetis should be placed before scotch to avoid conflict of header file "parmetis.h" buildInputs = From 30af19eddcf943062a84e927c9aad95114938faf Mon Sep 17 00:00:00 2001 From: qbisi Date: Mon, 4 Nov 2024 17:19:20 +0800 Subject: [PATCH 2/3] mumps: remove redundent make all in installCheckPhase --- pkgs/by-name/mu/mumps/package.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/by-name/mu/mumps/package.nix b/pkgs/by-name/mu/mumps/package.nix index 9376fe54ea61..cd92f079c9c9 100644 --- a/pkgs/by-name/mu/mumps/package.nix +++ b/pkgs/by-name/mu/mumps/package.nix @@ -125,7 +125,6 @@ stdenv.mkDerivation (finalAttrs: { ${lib.optionalString stdenv.hostPlatform.isDarwin "export DYLD_LIBRARY_PATH=$out/lib\n"} ${lib.optionalString mpiSupport "export MPIRUN='mpirun -n 2'\n"} cd examples - make all $MPIRUN ./ssimpletest Date: Mon, 4 Nov 2024 14:53:42 +0800 Subject: [PATCH 3/3] mumps: use magic __structuredAttrs to handle space in makeFlags --- pkgs/by-name/mu/mumps/package.nix | 67 +++++++++++++++---------------- 1 file changed, 32 insertions(+), 35 deletions(-) diff --git a/pkgs/by-name/mu/mumps/package.nix b/pkgs/by-name/mu/mumps/package.nix index cd92f079c9c9..d27f8b5e3a3c 100644 --- a/pkgs/by-name/mu/mumps/package.nix +++ b/pkgs/by-name/mu/mumps/package.nix @@ -21,43 +21,37 @@ assert withParmetis -> mpiSupport; assert withPtScotch -> mpiSupport; let profile = if mpiSupport then "debian.PAR" else "debian.SEQ"; - metisFlags = - if withParmetis then - '' - IMETIS="-I${parmetis}/include -I${metis}/include" \ - LMETIS="-L${parmetis}/lib -lparmetis -L${metis}/lib -lmetis" - '' - else - '' - IMETIS=-I${metis}/include \ - LMETIS="-L${metis}/lib -lmetis" - ''; - scotchFlags = + LMETIS = toString ([ "-lmetis" ] ++ lib.optional withParmetis "-lparmetis"); + LSCOTCH = toString ( if withPtScotch then - '' - ISCOTCH=-I${scotch.dev}/include \ - LSCOTCH="-L${scotch}/lib -lptscotch -lptesmumps -lptscotcherr" - '' + [ + "-lptscotch" + "-lptesmumps" + "-lptscotcherr" + ] else - '' - ISCOTCH=-I${scotch.dev}/include \ - LSCOTCH="-L${scotch}/lib -lesmumps -lscotch -lscotcherr" - ''; - macroFlags = - "-Dmetis -Dpord -Dscotch" - + lib.optionalString withParmetis " -Dparmetis" - + lib.optionalString withPtScotch " -Dptscotch"; - # Optimized options - # Disable -fopenmp in lines below to benefit from OpenMP - optFlags = '' - OPTF="-O3 -fallow-argument-mismatch" \ - OPTL="-O3" \ - OPTC="-O3" - ''; + [ + "-lesmumps" + "-lscotch" + "-lscotcherr" + ] + ); + ORDERINGSF = toString ( + [ + "-Dmetis" + "-Dpord" + "-Dscotch" + ] + ++ lib.optional withParmetis "-Dparmetis" + ++ lib.optional withPtScotch "-Dptscotch" + ); in stdenv.mkDerivation (finalAttrs: { name = "mumps"; version = "5.7.3"; + # makeFlags contain space and one should use makeFlagsArray+ + # Setting this magic var is an optional solution + __structuredAttrs = true; src = fetchzip { url = "https://mumps-solver.org/MUMPS_${finalAttrs.version}.tar.gz"; @@ -76,16 +70,19 @@ stdenv.mkDerivation (finalAttrs: { enableParallelBuilding = true; - preBuild = '' - makeFlagsArray+=(${metisFlags} ${scotchFlags} ORDERINGSF="${macroFlags}" ${optFlags}) - ''; - makeFlags = lib.optionals stdenv.hostPlatform.isDarwin [ "SONAME=" "LIBEXT_SHARED=.dylib" ] ++ [ + "ISCOTCH=-I${scotch.dev}/include" + "LMETIS=${LMETIS}" + "LSCOTCH=${LSCOTCH}" + "ORDERINGSF=${ORDERINGSF}" + "OPTF=-O3 -fallow-argument-mismatch" + "OPTC=-O3" + "OPTL=-O3" "SCALAP=-lscalapack" "allshared" ];