Skip to content

Commit a441473

Browse files
committed
superlu_dist: init at 9.1.0
1 parent 76c8a86 commit a441473

File tree

2 files changed

+134
-0
lines changed

2 files changed

+134
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
mc64ad_dist.c was removed (DFSG nonfree), create stubs
2+
--- /dev/null
3+
+++ b/SRC/prec-independent/mc64ad_dist.c
4+
@@ -0,0 +1,27 @@
5+
+/* The original mc64ad_dist.c is nonfree and has been removed.
6+
+ We provide a stub interface here instead.
7+
+*/
8+
+
9+
+#include <stdio.h>
10+
+#include <stdlib.h>
11+
+
12+
+#include "superlu_ddefs.h"
13+
+
14+
+/* only mc64id_dist and mc64ad_dist are referenced by SuperLU-Dist code */
15+
+
16+
+/* Subroutine */ int_t mc64id_dist(int_t *icntl)
17+
+{
18+
+ 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");
19+
+ abort();
20+
+ return 0;
21+
+}
22+
+
23+
+int_t mc64ad_dist(int_t *job, int_t *n, int_t *ne, int_t *
24+
+ ip, int_t *irn, double *a, int_t *num, int_t *cperm,
25+
+ int_t *liw, int_t *iw, int_t *ldw, double *dw, int_t *
26+
+ icntl, int_t *info)
27+
+{
28+
+ 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");
29+
+ abort();
30+
+ return 0;
31+
+}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
{
2+
lib,
3+
stdenv,
4+
fetchFromGitHub,
5+
fetchDebianPatch,
6+
cmake,
7+
gfortran,
8+
blas,
9+
lapack,
10+
mpi,
11+
mpiCheckPhaseHook,
12+
metis,
13+
parmetis,
14+
15+
# Todo: ask for permission of unfree parmetis
16+
withParmetis ? false,
17+
}:
18+
19+
assert (!blas.isILP64) && (!lapack.isILP64);
20+
21+
stdenv.mkDerivation (finalAttrs: {
22+
pname = "superlu_dist";
23+
version = "9.1.0";
24+
25+
__structuredAttrs = true;
26+
27+
src = fetchFromGitHub {
28+
owner = "xiaoyeli";
29+
repo = "superlu_dist";
30+
tag = "v${finalAttrs.version}";
31+
# Remove non‐free files.
32+
postFetch = "rm $out/SRC/prec-independent/mc64ad_dist.c";
33+
hash = "sha256-NMAEtTmTY189p8BlmsTugwMuxKZh+Bs1GyuwUHkLA1U=";
34+
};
35+
36+
patches = [
37+
./mc64ad_dist-stub.patch
38+
];
39+
40+
postPatch = ''
41+
substituteInPlace SRC/prec-independent/util.c \
42+
--replace-fail "LargeDiag_MC64" "NOROWPERM"
43+
'';
44+
45+
nativeBuildInputs = [
46+
cmake
47+
gfortran
48+
];
49+
50+
buildInputs =
51+
[
52+
mpi
53+
lapack
54+
]
55+
++ lib.optionals withParmetis [
56+
metis
57+
parmetis
58+
];
59+
60+
propagatedBuildInputs = [ blas ];
61+
62+
cmakeFlags =
63+
[
64+
(lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic))
65+
(lib.cmakeBool "enable_fortran" true)
66+
(lib.cmakeBool "enable_complex16" true)
67+
(lib.cmakeBool "TPL_ENABLE_INTERNAL_BLASLIB" false)
68+
(lib.cmakeBool "TPL_ENABLE_LAPACKLIB" true)
69+
(lib.cmakeBool "TPL_ENABLE_PARMETISLIB" withParmetis)
70+
]
71+
++ lib.optionals withParmetis [
72+
(lib.cmakeFeature "TPL_PARMETIS_LIBRARIES" "-lmetis -lparmetis")
73+
(lib.cmakeFeature "TPL_PARMETIS_INCLUDE_DIRS" "${lib.getDev parmetis}/include")
74+
];
75+
76+
doCheck = true;
77+
78+
nativeCheckInputs = [ mpiCheckPhaseHook ];
79+
80+
meta = {
81+
homepage = "https://portal.nersc.gov/project/sparse/superlu/";
82+
license = with lib.licenses; [
83+
# Files: *
84+
# Lawrence Berkeley National Labs BSD variant license
85+
bsd3Lbnl
86+
87+
# Files: SRC/prec-independent/symbfact.c
88+
# Xerox code; actually `Boehm-GC` variant.
89+
mit
90+
91+
# Files: SRC/include/*colamd.h
92+
# University of Florida code; permissive COLAMD licence.
93+
free
94+
95+
# Files: SRC/include/wingetopt.*
96+
# Microsoft code; Obtained from https://github.com/iotivity/iotivity/tree/master/resource/c_common/windows.
97+
asl20
98+
];
99+
description = "Library for the solution of large, sparse, nonsymmetric systems of linear equations";
100+
platforms = lib.platforms.linux;
101+
maintainers = with lib.maintainers; [ qbisi ];
102+
};
103+
})

0 commit comments

Comments
 (0)