Commit 0b2160ea authored by qbisi's avatar qbisi
Browse files

petsc: add scalapack and mumps support

parent f4bba88d
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -19,6 +19,10 @@
  withParmetis ? false,
  scotch,
  withPtscotch ? false,
  scalapack,
  withScalapack ? false,
  mumps_par,
  withMumps ? false,
  pkg-config,
  p4est,
  zlib, # propagated by p4est but required by petsc
@@ -34,6 +38,8 @@ assert petsc-withp4est -> p4est.mpiSupport;
assert withParmetis -> (withMetis && mpiSupport);

assert withPtscotch -> mpiSupport;
assert withScalapack -> mpiSupport;
assert withMumps -> withScalapack;

stdenv.mkDerivation rec {
  pname = "petsc";
@@ -59,7 +65,9 @@ stdenv.mkDerivation rec {
    ++ lib.optional petsc-withp4est p4est
    ++ lib.optional withMetis metis
    ++ lib.optional withParmetis parmetis
    ++ lib.optional withPtscotch scotch;
    ++ lib.optional withPtscotch scotch
    ++ lib.optional withScalapack scalapack
    ++ lib.optional withMumps mumps_par;

  postPatch =
    ''
@@ -96,6 +104,14 @@ stdenv.mkDerivation rec {
      "--with-ptscotch-include=${scotch.dev}/include"
      "--with-ptscotch-lib=[-L${scotch}/lib,-lptscotch,-lptesmumps,-lptscotchparmetisv3,-lptscotcherr,-lesmumps,-lscotch,-lscotcherr]"
    ]
    ++ lib.optionals withScalapack [
      "--with-scalapack=1"
      "--with-scalapack-dir=${scalapack}"
    ]
    ++ lib.optionals withMumps [
      "--with-mumps=1"
      "--with-mumps-dir=${mumps_par}"
    ]
    ++ lib.optionals petsc-withp4est [
      "--with-p4est=1"
      "--with-zlib-include=${zlib.dev}/include"