mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 15:03:28 +00:00
Mumps: use magic __structuredAttrs to handle space in makeFlags (#355128)
This commit is contained in:
commit
efc9da916c
@ -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"
|
||||
];
|
||||
@ -105,7 +102,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 =
|
||||
@ -125,7 +122,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 <input_simpletest_real
|
||||
$MPIRUN ./dsimpletest <input_simpletest_real
|
||||
$MPIRUN ./csimpletest <input_simpletest_cmplx
|
||||
|
Loading…
Reference in New Issue
Block a user