10 withParmetis ? false, # default to false due to unfree license
12 withPtScotch ? mpiSupport,
20 assert withParmetis -> mpiSupport;
21 assert withPtScotch -> mpiSupport;
23 profile = if mpiSupport then "debian.PAR" else "debian.SEQ";
24 LMETIS = toString ([ "-lmetis" ] ++ lib.optional withParmetis "-lparmetis");
39 ORDERINGSF = toString (
45 ++ lib.optional withParmetis "-Dparmetis"
46 ++ lib.optional withPtScotch "-Dptscotch"
49 stdenv.mkDerivation (finalAttrs: {
52 # makeFlags contain space and one should use makeFlagsArray+
53 # Setting this magic var is an optional solution
54 __structuredAttrs = true;
57 url = "https://mumps-solver.org/MUMPS_${finalAttrs.version}.tar.gz";
58 hash = "sha256-ZnIfAuvOBJDYqCtKGlWs0r39nG6X2lAVRuUmeIJenZw=";
61 postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
62 substituteInPlace src/Makefile --replace-fail \
63 "-Wl,\''$(SONAME),libmumps_common" \
64 "-Wl,-install_name,$out/lib/libmumps_common"
68 cp Make.inc/Makefile.${profile} ./Makefile.inc
71 enableParallelBuilding = true;
74 lib.optionals stdenv.hostPlatform.isDarwin [
76 "LIBEXT_SHARED=.dylib"
79 "ISCOTCH=-I${scotch.dev}/include"
82 "ORDERINGSF=${ORDERINGSF}"
83 "OPTF=-O3 -fallow-argument-mismatch"
93 cp -r include lib $out
95 + lib.optionalString (!mpiSupport) ''
96 # Install mumps_seq headers
97 install -Dm 444 -t $out/include/mumps_seq libseq/*.h
99 # Add some compatibility with coin-or-mumps
100 ln -s $out/include/mumps_seq/mpi.h $out/include/mumps_mpi.h
103 nativeBuildInputs = [
105 ] ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
107 # Parmetis should be placed before scotch to avoid conflict of header file "parmetis.h"
109 lib.optional withParmetis parmetis
110 ++ lib.optional mpiSupport scalapack
118 doInstallCheck = true;
119 nativeInstallCheckInputs = lib.optional mpiSupport mpiCheckPhaseHook;
120 installCheckPhase = ''
121 runHook preInstallCheck
122 ${lib.optionalString stdenv.hostPlatform.isDarwin "export DYLD_LIBRARY_PATH=$out/lib\n"}
123 ${lib.optionalString mpiSupport "export MPIRUN='mpirun -n 2'\n"}
125 $MPIRUN ./ssimpletest <input_simpletest_real
126 $MPIRUN ./dsimpletest <input_simpletest_real
127 $MPIRUN ./csimpletest <input_simpletest_cmplx
128 $MPIRUN ./zsimpletest <input_simpletest_cmplx
130 $MPIRUN ./multiple_arithmetics_example
131 $MPIRUN ./ssimpletest_save_restore <input_simpletest_real
132 $MPIRUN ./dsimpletest_save_restore <input_simpletest_real
133 $MPIRUN ./csimpletest_save_restore <input_simpletest_cmplx
134 $MPIRUN ./zsimpletest_save_restore <input_simpletest_cmplx
135 $MPIRUN ./c_example_save_restore
136 runHook postInstallCheck
140 inherit withParmetis withPtScotch mpiSupport;
144 description = "MUltifrontal Massively Parallel sparse direct Solver";
145 homepage = "http://mumps-solver.org/";
146 license = lib.licenses.cecill-c;
147 maintainers = with lib.maintainers; [
151 platforms = lib.platforms.unix;
152 # Dependency of scalapack for mpiSupport is broken on darwin platform
153 broken = mpiSupport && stdenv.hostPlatform.isDarwin;