Unverified Commit 2d8560ba authored by Nick Cao's avatar Nick Cao Committed by GitHub
Browse files

superlu_dist: add support for darwin platform (#390328)

parents 620dfa76 1ff0d164
Loading
Loading
Loading
Loading
+26 −9
Original line number Diff line number Diff line
@@ -2,6 +2,8 @@
  lib,
  stdenv,
  fetchFromGitHub,
  fetchurl,
  llvmPackages,
  cmake,
  gfortran,
  blas,
@@ -10,7 +12,9 @@
  mpiCheckPhaseHook,
  metis,
  parmetis,

  withExamples ? false,
  fortranSupport ? stdenv.hostPlatform.isLinux,
  enableOpenMP ? true,
  # Todo: ask for permission of unfree parmetis
  withParmetis ? false,
}:
@@ -34,6 +38,10 @@ stdenv.mkDerivation (finalAttrs: {

  patches = [
    ./mc64ad_dist-stub.patch
    (fetchurl {
      url = "https://github.com/xiaoyeli/superlu_dist/commit/8ef3f7fda091529d7e7f16087864fee66c4834c9.patch";
      hash = "sha256-kCSqojYKpk75m+FwhS0hXHSybm+GZzOYikePcf2U3Fw=";
    })
  ];

  postPatch = ''
@@ -41,13 +49,20 @@ stdenv.mkDerivation (finalAttrs: {
      --replace-fail "LargeDiag_MC64" "NOROWPERM"
  '';

  nativeBuildInputs = [
  nativeBuildInputs =
    [
      cmake
    ]
    ++ lib.optionals fortranSupport [
      gfortran
    ];

  buildInputs =
    [
    lib.optionals (enableOpenMP && stdenv.cc.isClang) [
      # cmake can not find mpi if openmp is placed after mpi
      llvmPackages.openmp
    ]
    ++ [
      mpi
      lapack
    ]
@@ -60,9 +75,11 @@ stdenv.mkDerivation (finalAttrs: {

  cmakeFlags =
    [
      (lib.cmakeBool "enable_examples" withExamples)
      (lib.cmakeBool "enable_openmp" enableOpenMP)
      (lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic))
      (lib.cmakeBool "enable_fortran" true)
      (lib.cmakeBool "enable_complex16" true)
      (lib.cmakeBool "BUILD_STATIC_LIBS" stdenv.hostPlatform.isStatic)
      (lib.cmakeBool "XSDK_ENABLE_Fortran" fortranSupport)
      (lib.cmakeBool "TPL_ENABLE_INTERNAL_BLASLIB" false)
      (lib.cmakeBool "TPL_ENABLE_LAPACKLIB" true)
      (lib.cmakeBool "TPL_ENABLE_PARMETISLIB" withParmetis)
@@ -96,7 +113,7 @@ stdenv.mkDerivation (finalAttrs: {
      asl20
    ];
    description = "Library for the solution of large, sparse, nonsymmetric systems of linear equations";
    platforms = lib.platforms.linux;
    platforms = lib.platforms.unix;
    maintainers = with lib.maintainers; [ qbisi ];
  };
})