tangled
alpha
login
or
join now
tjh.dev
/
nixpkgs
Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
0
fork
atom
overview
issues
pulls
pipelines
suitesparse: 4.4.4 -> 5.3.0
Jaakko Luttinen
7 years ago
8fb27604
46651b82
+153
-43
3 changed files
expand all
collapse all
unified
split
pkgs
development
libraries
science
math
suitesparse
4.4.nix
default.nix
top-level
all-packages.nix
+100
pkgs/development/libraries/science/math/suitesparse/4.4.nix
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
{ stdenv, fetchurl, gfortran, openblas
2
+
, enableCuda ? false, cudatoolkit
3
+
}:
4
+
5
+
let
6
+
version = "4.4.4";
7
+
name = "suitesparse-${version}";
8
+
9
+
int_t = if openblas.blas64 then "int64_t" else "int32_t";
10
+
SHLIB_EXT = stdenv.hostPlatform.extensions.sharedLibrary;
11
+
in
12
+
stdenv.mkDerivation {
13
+
inherit name;
14
+
15
+
src = fetchurl {
16
+
url = "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-${version}.tar.gz";
17
+
sha256 = "1zdn1y0ij6amj7smmcslkqgbqv9yy5cwmbyzqc9v6drzdzllgbpj";
18
+
};
19
+
20
+
preConfigure = ''
21
+
mkdir -p $out/lib
22
+
mkdir -p $out/include
23
+
24
+
sed -i "SuiteSparse_config/SuiteSparse_config.mk" \
25
+
-e 's/METIS .*$/METIS =/' \
26
+
-e 's/METIS_PATH .*$/METIS_PATH =/' \
27
+
-e '/CHOLMOD_CONFIG/ s/$/-DNPARTITION -DLONGBLAS=${int_t}/' \
28
+
-e '/UMFPACK_CONFIG/ s/$/-DLONGBLAS=${int_t}/'
29
+
''
30
+
+ stdenv.lib.optionalString stdenv.isDarwin ''
31
+
sed -i "SuiteSparse_config/SuiteSparse_config.mk" \
32
+
-e 's/^[[:space:]]*\(LIB = -lm\) -lrt/\1/'
33
+
''
34
+
+ stdenv.lib.optionalString enableCuda ''
35
+
sed -i "SuiteSparse_config/SuiteSparse_config.mk" \
36
+
-e 's|^[[:space:]]*\(CUDA_ROOT =\)|CUDA_ROOT = ${cudatoolkit}|' \
37
+
-e 's|^[[:space:]]*\(GPU_BLAS_PATH =\)|GPU_BLAS_PATH = $(CUDA_ROOT)|' \
38
+
-e 's|^[[:space:]]*\(GPU_CONFIG =\)|GPU_CONFIG = -I$(CUDA_ROOT)/include -DGPU_BLAS -DCHOLMOD_OMP_NUM_THREADS=$(NIX_BUILD_CORES) |' \
39
+
-e 's|^[[:space:]]*\(CUDA_PATH =\)|CUDA_PATH = $(CUDA_ROOT)|' \
40
+
-e 's|^[[:space:]]*\(CUDART_LIB =\)|CUDART_LIB = $(CUDA_ROOT)/lib64/libcudart.so|' \
41
+
-e 's|^[[:space:]]*\(CUBLAS_LIB =\)|CUBLAS_LIB = $(CUDA_ROOT)/lib64/libcublas.so|' \
42
+
-e 's|^[[:space:]]*\(CUDA_INC_PATH =\)|CUDA_INC_PATH = $(CUDA_ROOT)/include/|' \
43
+
-e 's|^[[:space:]]*\(NV20 =\)|NV20 = -arch=sm_20 -Xcompiler -fPIC|' \
44
+
-e 's|^[[:space:]]*\(NV30 =\)|NV30 = -arch=sm_30 -Xcompiler -fPIC|' \
45
+
-e 's|^[[:space:]]*\(NV35 =\)|NV35 = -arch=sm_35 -Xcompiler -fPIC|' \
46
+
-e 's|^[[:space:]]*\(NVCC =\) echo|NVCC = $(CUDA_ROOT)/bin/nvcc|' \
47
+
-e 's|^[[:space:]]*\(NVCCFLAGS =\)|NVCCFLAGS = $(NV20) -O3 -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_60,code=sm_60|'
48
+
'';
49
+
50
+
makeFlags = [
51
+
"PREFIX=\"$(out)\""
52
+
"INSTALL_LIB=$(out)/lib"
53
+
"INSTALL_INCLUDE=$(out)/include"
54
+
"BLAS=-lopenblas"
55
+
"LAPACK="
56
+
];
57
+
58
+
NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin " -DNTIMER";
59
+
60
+
postInstall = ''
61
+
# Build and install shared library
62
+
(
63
+
cd "$(mktemp -d)"
64
+
for i in "$out"/lib/lib*.a; do
65
+
ar -x $i
66
+
done
67
+
${if enableCuda then cudatoolkit else stdenv.cc.outPath}/bin/${if enableCuda then "nvcc" else "cc"} *.o ${if stdenv.isDarwin then "-dynamiclib" else "--shared"} -o "$out/lib/libsuitesparse${SHLIB_EXT}" -lopenblas ${stdenv.lib.optionalString enableCuda "-lcublas"}
68
+
)
69
+
for i in umfpack cholmod amd camd colamd spqr; do
70
+
ln -s libsuitesparse${SHLIB_EXT} "$out"/lib/lib$i${SHLIB_EXT}
71
+
done
72
+
73
+
# Install documentation
74
+
outdoc=$out/share/doc/${name}
75
+
mkdir -p $outdoc
76
+
cp -r AMD/Doc $outdoc/amd
77
+
cp -r BTF/Doc $outdoc/bft
78
+
cp -r CAMD/Doc $outdoc/camd
79
+
cp -r CCOLAMD/Doc $outdoc/ccolamd
80
+
cp -r CHOLMOD/Doc $outdoc/cholmod
81
+
cp -r COLAMD/Doc $outdoc/colamd
82
+
cp -r CXSparse/Doc $outdoc/cxsparse
83
+
cp -r KLU/Doc $outdoc/klu
84
+
cp -r LDL/Doc $outdoc/ldl
85
+
cp -r RBio/Doc $outdoc/rbio
86
+
cp -r SPQR/Doc $outdoc/spqr
87
+
cp -r UMFPACK/Doc $outdoc/umfpack
88
+
'';
89
+
90
+
nativeBuildInputs = [ gfortran ];
91
+
buildInputs = [ openblas ];
92
+
93
+
meta = with stdenv.lib; {
94
+
homepage = http://faculty.cse.tamu.edu/davis/suitesparse.html;
95
+
description = "A suite of sparse matrix algorithms";
96
+
license = with licenses; [ bsd2 gpl2Plus lgpl21Plus ];
97
+
maintainers = with maintainers; [ ttuegel ];
98
+
platforms = with platforms; unix;
99
+
};
100
+
}
+49
-40
pkgs/development/libraries/science/math/suitesparse/default.nix
···
1
-
{ stdenv, fetchurl, gfortran, openblas
2
, enableCuda ? false, cudatoolkit
3
}:
4
5
let
6
-
version = "4.4.4";
7
name = "suitesparse-${version}";
8
9
-
int_t = if openblas.blas64 then "int64_t" else "int32_t";
10
SHLIB_EXT = stdenv.hostPlatform.extensions.sharedLibrary;
11
in
12
-
stdenv.mkDerivation {
13
inherit name;
14
15
src = fetchurl {
16
url = "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-${version}.tar.gz";
17
-
sha256 = "1zdn1y0ij6amj7smmcslkqgbqv9yy5cwmbyzqc9v6drzdzllgbpj";
18
};
19
0
0
20
preConfigure = ''
21
mkdir -p $out/lib
22
mkdir -p $out/include
0
23
24
sed -i "SuiteSparse_config/SuiteSparse_config.mk" \
25
-e 's/METIS .*$/METIS =/' \
26
-e 's/METIS_PATH .*$/METIS_PATH =/' \
27
-
-e '/CHOLMOD_CONFIG/ s/$/-DNPARTITION -DLONGBLAS=${int_t}/' \
28
-
-e '/UMFPACK_CONFIG/ s/$/-DLONGBLAS=${int_t}/'
29
''
30
+ stdenv.lib.optionalString stdenv.isDarwin ''
31
sed -i "SuiteSparse_config/SuiteSparse_config.mk" \
···
47
-e 's|^[[:space:]]*\(NVCCFLAGS =\)|NVCCFLAGS = $(NV20) -O3 -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_60,code=sm_60|'
48
'';
49
50
-
makeFlags = [
51
-
"PREFIX=\"$(out)\""
52
-
"INSTALL_LIB=$(out)/lib"
53
-
"INSTALL_INCLUDE=$(out)/include"
54
-
"BLAS=-lopenblas"
55
-
"LAPACK="
56
-
];
57
58
-
NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin " -DNTIMER";
0
0
0
0
59
60
-
postInstall = ''
61
-
# Build and install shared library
0
0
0
62
(
63
-
cd "$(mktemp -d)"
64
-
for i in "$out"/lib/lib*.a; do
65
ar -x $i
66
done
67
-
${if enableCuda then cudatoolkit else stdenv.cc.outPath}/bin/${if enableCuda then "nvcc" else "cc"} *.o ${if stdenv.isDarwin then "-dynamiclib" else "--shared"} -o "$out/lib/libsuitesparse${SHLIB_EXT}" -lopenblas ${stdenv.lib.optionalString enableCuda "-lcublas"}
68
)
69
-
for i in umfpack cholmod amd camd colamd spqr; do
70
-
ln -s libsuitesparse${SHLIB_EXT} "$out"/lib/lib$i${SHLIB_EXT}
71
-
done
0
0
0
72
73
-
# Install documentation
74
-
outdoc=$out/share/doc/${name}
75
-
mkdir -p $outdoc
76
-
cp -r AMD/Doc $outdoc/amd
77
-
cp -r BTF/Doc $outdoc/bft
78
-
cp -r CAMD/Doc $outdoc/camd
79
-
cp -r CCOLAMD/Doc $outdoc/ccolamd
80
-
cp -r CHOLMOD/Doc $outdoc/cholmod
81
-
cp -r COLAMD/Doc $outdoc/colamd
82
-
cp -r CXSparse/Doc $outdoc/cxsparse
83
-
cp -r KLU/Doc $outdoc/klu
84
-
cp -r LDL/Doc $outdoc/ldl
85
-
cp -r RBio/Doc $outdoc/rbio
86
-
cp -r SPQR/Doc $outdoc/spqr
87
-
cp -r UMFPACK/Doc $outdoc/umfpack
88
'';
89
90
-
nativeBuildInputs = [ gfortran ];
91
-
buildInputs = [ openblas ];
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
92
93
meta = with stdenv.lib; {
94
homepage = http://faculty.cse.tamu.edu/davis/suitesparse.html;
···
1
+
{ stdenv, fetchurl, gfortran, openblas, cmake
2
, enableCuda ? false, cudatoolkit
3
}:
4
5
let
6
+
version = "5.3.0";
7
name = "suitesparse-${version}";
8
0
9
SHLIB_EXT = stdenv.hostPlatform.extensions.sharedLibrary;
10
in
11
+
stdenv.mkDerivation rec {
12
inherit name;
13
14
src = fetchurl {
15
url = "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-${version}.tar.gz";
16
+
sha256 = "0gcn1xj3z87wpp26gxn11k8073bxv6jswfd8jmddlm64v09rgrlh";
17
};
18
19
+
dontUseCmakeConfigure = true;
20
+
21
preConfigure = ''
22
mkdir -p $out/lib
23
mkdir -p $out/include
24
+
mkdir -p $out/share/doc/${name}
25
26
sed -i "SuiteSparse_config/SuiteSparse_config.mk" \
27
-e 's/METIS .*$/METIS =/' \
28
-e 's/METIS_PATH .*$/METIS_PATH =/' \
29
+
-e '/CHOLMOD_CONFIG/ s/$/-DNPARTITION/'
0
30
''
31
+ stdenv.lib.optionalString stdenv.isDarwin ''
32
sed -i "SuiteSparse_config/SuiteSparse_config.mk" \
···
48
-e 's|^[[:space:]]*\(NVCCFLAGS =\)|NVCCFLAGS = $(NV20) -O3 -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_60,code=sm_60|'
49
'';
50
51
+
NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin " -DNTIMER";
52
+
53
+
buildPhase = ''
54
+
runHook preBuild
0
0
0
55
56
+
# Build individual shared libraries
57
+
make library \
58
+
BLAS=-lopenblas \
59
+
LAPACK="" \
60
+
${stdenv.lib.optionalString openblas.blas64 "CFLAGS=-DBLAS64"}
61
62
+
# Build libsuitesparse.so which bundles all the individual libraries.
63
+
# Bundling is done by building the static libraries, extracting objects from
64
+
# them and combining the objects into one shared library.
65
+
mkdir -p static
66
+
make static AR_TARGET=$(pwd)/static/'$(LIBRARY).a'
67
(
68
+
cd static
69
+
for i in lib*.a; do
70
ar -x $i
71
done
0
72
)
73
+
${if enableCuda then "${cudatoolkit}/bin/nvcc" else "${stdenv.cc.outPath}/bin/cc"} \
74
+
static/*.o \
75
+
${if stdenv.isDarwin then "-dynamiclib" else "--shared"} \
76
+
-o "lib/libsuitesparse${SHLIB_EXT}" \
77
+
-lopenblas \
78
+
${stdenv.lib.optionalString enableCuda "-lcublas"}
79
80
+
runHook postBuild
0
0
0
0
0
0
0
0
0
0
0
0
0
0
81
'';
82
83
+
installPhase = ''
84
+
runHook preInstall
85
+
86
+
mkdir -p $out
87
+
cp -r lib $out/
88
+
cp -r include $out/
89
+
cp -r share $out/
90
+
91
+
# Fix rpaths
92
+
cd $out
93
+
find -name \*.so\* -type f -exec \
94
+
patchelf --set-rpath "$out/lib:${stdenv.lib.makeLibraryPath buildInputs}" {} \;
95
+
96
+
runHook postInstall
97
+
'';
98
+
99
+
nativeBuildInputs = [ cmake ];
100
+
buildInputs = [ openblas gfortran.cc.lib ] ++ stdenv.lib.optionals enableCuda [cudatoolkit];
101
102
meta = with stdenv.lib; {
103
homepage = http://faculty.cse.tamu.edu/davis/suitesparse.html;
+4
-3
pkgs/top-level/all-packages.nix
···
1537
riot-web = callPackage ../applications/networking/instant-messengers/riot/riot-web.nix {
1538
conf = config.riot-web.conf or null;
1539
};
1540
-
1541
roundcube = callPackage ../servers/roundcube { };
1542
1543
rsbep = callPackage ../tools/backup/rsbep { };
···
20953
sageWithDoc = sage.override { withDoc = true; };
20954
20955
suitesparse_4_2 = callPackage ../development/libraries/science/math/suitesparse/4.2.nix { };
20956
-
suitesparse_4_4 = callPackage ../development/libraries/science/math/suitesparse {};
20957
-
suitesparse = suitesparse_4_4;
0
20958
20959
superlu = callPackage ../development/libraries/science/math/superlu {};
20960
···
1537
riot-web = callPackage ../applications/networking/instant-messengers/riot/riot-web.nix {
1538
conf = config.riot-web.conf or null;
1539
};
1540
+
1541
roundcube = callPackage ../servers/roundcube { };
1542
1543
rsbep = callPackage ../tools/backup/rsbep { };
···
20953
sageWithDoc = sage.override { withDoc = true; };
20954
20955
suitesparse_4_2 = callPackage ../development/libraries/science/math/suitesparse/4.2.nix { };
20956
+
suitesparse_4_4 = callPackage ../development/libraries/science/math/suitesparse/4.4.nix {};
20957
+
suitesparse_5_3 = callPackage ../development/libraries/science/math/suitesparse {};
20958
+
suitesparse = suitesparse_5_3;
20959
20960
superlu = callPackage ../development/libraries/science/math/superlu {};
20961