mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-17 01:24:47 +00:00
mumps: add variant mumps_par with mpi support
This commit is contained in:
parent
4df3489270
commit
0b324cc371
@ -6,10 +6,55 @@
|
|||||||
lapack,
|
lapack,
|
||||||
lib,
|
lib,
|
||||||
metis,
|
metis,
|
||||||
|
parmetis,
|
||||||
|
withParmetis ? false, # default to false due to unfree license
|
||||||
scotch,
|
scotch,
|
||||||
|
withPtScotch ? mpiSupport,
|
||||||
stdenv,
|
stdenv,
|
||||||
fixDarwinDylibNames,
|
fixDarwinDylibNames,
|
||||||
|
mpi,
|
||||||
|
mpiSupport ? false,
|
||||||
|
mpiCheckPhaseHook,
|
||||||
|
scalapack,
|
||||||
}:
|
}:
|
||||||
|
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 =
|
||||||
|
if withPtScotch then
|
||||||
|
''
|
||||||
|
ISCOTCH=-I${scotch.dev}/include \
|
||||||
|
LSCOTCH="-L${scotch}/lib -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"
|
||||||
|
'';
|
||||||
|
in
|
||||||
stdenv.mkDerivation (finalAttrs: {
|
stdenv.mkDerivation (finalAttrs: {
|
||||||
name = "mumps";
|
name = "mumps";
|
||||||
version = "5.7.3";
|
version = "5.7.3";
|
||||||
@ -26,75 +71,89 @@ stdenv.mkDerivation (finalAttrs: {
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
configurePhase = ''
|
configurePhase = ''
|
||||||
cp Make.inc/Makefile.debian.SEQ ./Makefile.inc
|
cp Make.inc/Makefile.${profile} ./Makefile.inc
|
||||||
'';
|
'';
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
preBuild = ''
|
||||||
|
makeFlagsArray+=(${metisFlags} ${scotchFlags} ORDERINGSF="${macroFlags}" ${optFlags})
|
||||||
|
'';
|
||||||
|
|
||||||
makeFlags =
|
makeFlags =
|
||||||
lib.optionals stdenv.hostPlatform.isDarwin [
|
lib.optionals stdenv.hostPlatform.isDarwin [
|
||||||
"SONAME="
|
"SONAME="
|
||||||
"LIBEXT_SHARED=.dylib"
|
"LIBEXT_SHARED=.dylib"
|
||||||
]
|
]
|
||||||
++ [
|
++ [
|
||||||
"LSCOTCHDIR=${scotch}/lib"
|
"SCALAP=-lscalapack"
|
||||||
"ISCOTCH=-I${scotch.dev}/include"
|
|
||||||
"LMETISDIR=${metis}/lib"
|
|
||||||
"IMETIS=-I${metis}/include"
|
|
||||||
"allshared"
|
"allshared"
|
||||||
];
|
];
|
||||||
|
|
||||||
installPhase = ''
|
installPhase =
|
||||||
mkdir $out
|
''
|
||||||
cp -r include lib $out
|
mkdir $out
|
||||||
|
cp -r include lib $out
|
||||||
|
''
|
||||||
|
+ lib.optionalString (!mpiSupport) ''
|
||||||
|
# Install mumps_seq headers
|
||||||
|
install -Dm 444 -t $out/include/mumps_seq libseq/*.h
|
||||||
|
|
||||||
# Install mumps_seq headers
|
# Add some compatibility with coin-or-mumps
|
||||||
install -Dm 444 -t $out/include/mumps_seq libseq/*.h
|
ln -s $out/include/mumps_seq/mpi.h $out/include/mumps_mpi.h
|
||||||
|
'';
|
||||||
|
|
||||||
# Add some compatibility with coin-or-mumps
|
nativeBuildInputs = [
|
||||||
ln -s $out/include/mumps_seq/mpi.h $out/include/mumps_mpi.h
|
gfortran
|
||||||
'';
|
] ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames ++ lib.optional mpiSupport mpi;
|
||||||
|
|
||||||
nativeBuildInputs =
|
# Parmetis should be placed before scotch to avoid conflict of header file "parmetis.h"
|
||||||
lib.optionals stdenv.hostPlatform.isDarwin [
|
buildInputs =
|
||||||
fixDarwinDylibNames
|
lib.optional withParmetis parmetis
|
||||||
]
|
++ lib.optional mpiSupport scalapack
|
||||||
++ [
|
++ [
|
||||||
gfortran
|
blas
|
||||||
|
lapack
|
||||||
|
metis
|
||||||
|
scotch
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = [
|
|
||||||
blas
|
|
||||||
lapack
|
|
||||||
metis
|
|
||||||
scotch
|
|
||||||
];
|
|
||||||
|
|
||||||
doInstallCheck = true;
|
doInstallCheck = true;
|
||||||
installCheckPhase =
|
nativeInstallCheckInputs = lib.optional mpiSupport mpiCheckPhaseHook;
|
||||||
lib.optionalString stdenv.hostPlatform.isDarwin ''
|
installCheckPhase = ''
|
||||||
export DYLD_LIBRARY_PATH=$out/lib
|
runHook preInstallCheck
|
||||||
''
|
${lib.optionalString stdenv.hostPlatform.isDarwin "export DYLD_LIBRARY_PATH=$out/lib\n"}
|
||||||
+ ''
|
${lib.optionalString mpiSupport "export MPIRUN='mpirun -n 2'\n"}
|
||||||
cd examples
|
cd examples
|
||||||
make all
|
make all
|
||||||
./ssimpletest <input_simpletest_real
|
$MPIRUN ./ssimpletest <input_simpletest_real
|
||||||
./dsimpletest <input_simpletest_real
|
$MPIRUN ./dsimpletest <input_simpletest_real
|
||||||
./csimpletest <input_simpletest_cmplx
|
$MPIRUN ./csimpletest <input_simpletest_cmplx
|
||||||
./zsimpletest <input_simpletest_cmplx
|
$MPIRUN ./zsimpletest <input_simpletest_cmplx
|
||||||
./c_example
|
$MPIRUN ./c_example
|
||||||
./multiple_arithmetics_example
|
$MPIRUN ./multiple_arithmetics_example
|
||||||
./ssimpletest_save_restore <input_simpletest_real
|
$MPIRUN ./ssimpletest_save_restore <input_simpletest_real
|
||||||
./dsimpletest_save_restore <input_simpletest_real
|
$MPIRUN ./dsimpletest_save_restore <input_simpletest_real
|
||||||
./csimpletest_save_restore <input_simpletest_cmplx
|
$MPIRUN ./csimpletest_save_restore <input_simpletest_cmplx
|
||||||
./zsimpletest_save_restore <input_simpletest_cmplx
|
$MPIRUN ./zsimpletest_save_restore <input_simpletest_cmplx
|
||||||
./c_example_save_restore
|
$MPIRUN ./c_example_save_restore
|
||||||
'';
|
runHook postInstallCheck
|
||||||
|
'';
|
||||||
|
|
||||||
|
passthru = {
|
||||||
|
inherit withParmetis withPtScotch mpiSupport;
|
||||||
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "MUltifrontal Massively Parallel sparse direct Solver";
|
description = "MUltifrontal Massively Parallel sparse direct Solver";
|
||||||
homepage = "http://mumps-solver.org/";
|
homepage = "http://mumps-solver.org/";
|
||||||
license = lib.licenses.cecill-c;
|
license = lib.licenses.cecill-c;
|
||||||
maintainers = with lib.maintainers; [ nim65s ];
|
maintainers = with lib.maintainers; [
|
||||||
|
nim65s
|
||||||
|
qbisi
|
||||||
|
];
|
||||||
|
platforms = lib.platforms.unix;
|
||||||
|
# Dependency of scalapack for mpiSupport is broken on darwin platform
|
||||||
|
broken = mpiSupport && stdenv.hostPlatform.isDarwin;
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
@ -681,6 +681,8 @@ with pkgs;
|
|||||||
inherit (darwin) DarwinTools;
|
inherit (darwin) DarwinTools;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mumps_par = callPackage ../by-name/mu/mumps/package.nix { mpiSupport = true; };
|
||||||
|
|
||||||
mix2nix = callPackage ../development/tools/mix2nix { };
|
mix2nix = callPackage ../development/tools/mix2nix { };
|
||||||
|
|
||||||
n98-magerun = callPackage ../development/tools/misc/n98-magerun { };
|
n98-magerun = callPackage ../development/tools/misc/n98-magerun { };
|
||||||
|
Loading…
Reference in New Issue
Block a user