superlu_dist: init at 9.1.0

This commit is contained in:
qbisi 2025-03-03 01:28:13 +08:00
parent 76c8a8631c
commit a441473164
2 changed files with 134 additions and 0 deletions

View File

@ -0,0 +1,31 @@
mc64ad_dist.c was removed (DFSG nonfree), create stubs
--- /dev/null
+++ b/SRC/prec-independent/mc64ad_dist.c
@@ -0,0 +1,27 @@
+/* The original mc64ad_dist.c is nonfree and has been removed.
+ We provide a stub interface here instead.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "superlu_ddefs.h"
+
+/* only mc64id_dist and mc64ad_dist are referenced by SuperLU-Dist code */
+
+/* Subroutine */ int_t mc64id_dist(int_t *icntl)
+{
+ fprintf(stderr, "SuperLU-Dist: MC64 functionality not available.\n(It uses code under a non-free HSL licence which does not permit redistribution).\nAborting mc64id_dist.\n");
+ abort();
+ return 0;
+}
+
+int_t mc64ad_dist(int_t *job, int_t *n, int_t *ne, int_t *
+ ip, int_t *irn, double *a, int_t *num, int_t *cperm,
+ int_t *liw, int_t *iw, int_t *ldw, double *dw, int_t *
+ icntl, int_t *info)
+{
+ fprintf(stderr, "SuperLU-Dist: MC64 functionality not available.\n(It uses code under a non-free HSL licence which does not permit redistribution).\nAborting mc64ad_dist.\n");
+ abort();
+ return 0;
+}

View File

@ -0,0 +1,103 @@
{
lib,
stdenv,
fetchFromGitHub,
fetchDebianPatch,
cmake,
gfortran,
blas,
lapack,
mpi,
mpiCheckPhaseHook,
metis,
parmetis,
# Todo: ask for permission of unfree parmetis
withParmetis ? false,
}:
assert (!blas.isILP64) && (!lapack.isILP64);
stdenv.mkDerivation (finalAttrs: {
pname = "superlu_dist";
version = "9.1.0";
__structuredAttrs = true;
src = fetchFromGitHub {
owner = "xiaoyeli";
repo = "superlu_dist";
tag = "v${finalAttrs.version}";
# Remove nonfree files.
postFetch = "rm $out/SRC/prec-independent/mc64ad_dist.c";
hash = "sha256-NMAEtTmTY189p8BlmsTugwMuxKZh+Bs1GyuwUHkLA1U=";
};
patches = [
./mc64ad_dist-stub.patch
];
postPatch = ''
substituteInPlace SRC/prec-independent/util.c \
--replace-fail "LargeDiag_MC64" "NOROWPERM"
'';
nativeBuildInputs = [
cmake
gfortran
];
buildInputs =
[
mpi
lapack
]
++ lib.optionals withParmetis [
metis
parmetis
];
propagatedBuildInputs = [ blas ];
cmakeFlags =
[
(lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic))
(lib.cmakeBool "enable_fortran" true)
(lib.cmakeBool "enable_complex16" true)
(lib.cmakeBool "TPL_ENABLE_INTERNAL_BLASLIB" false)
(lib.cmakeBool "TPL_ENABLE_LAPACKLIB" true)
(lib.cmakeBool "TPL_ENABLE_PARMETISLIB" withParmetis)
]
++ lib.optionals withParmetis [
(lib.cmakeFeature "TPL_PARMETIS_LIBRARIES" "-lmetis -lparmetis")
(lib.cmakeFeature "TPL_PARMETIS_INCLUDE_DIRS" "${lib.getDev parmetis}/include")
];
doCheck = true;
nativeCheckInputs = [ mpiCheckPhaseHook ];
meta = {
homepage = "https://portal.nersc.gov/project/sparse/superlu/";
license = with lib.licenses; [
# Files: *
# Lawrence Berkeley National Labs BSD variant license
bsd3Lbnl
# Files: SRC/prec-independent/symbfact.c
# Xerox code; actually `Boehm-GC` variant.
mit
# Files: SRC/include/*colamd.h
# University of Florida code; permissive COLAMD licence.
free
# Files: SRC/include/wingetopt.*
# Microsoft code; Obtained from https://github.com/iotivity/iotivity/tree/master/resource/c_common/windows.
asl20
];
description = "Library for the solution of large, sparse, nonsymmetric systems of linear equations";
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [ qbisi ];
};
})