mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-27 09:23:01 +00:00
suitesparse_4_4_1: build with openblas
Compared to ATLAS, OpenBLAS offers better performance, faster builds, and dynamic architecture detection.
This commit is contained in:
parent
982aabc561
commit
b02f300c44
@ -1,36 +0,0 @@
|
||||
From 456b26d0c9101adaa5876954baac0ca0e872dab6 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Tuegel <ttuegel@gmail.com>
|
||||
Date: Mon, 15 Dec 2014 10:18:01 -0600
|
||||
Subject: [PATCH 1/3] disable metis
|
||||
|
||||
---
|
||||
SuiteSparse_config/SuiteSparse_config.mk | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/SuiteSparse_config/SuiteSparse_config.mk b/SuiteSparse_config/SuiteSparse_config.mk
|
||||
index ba2da23..e1514bf 100644
|
||||
--- a/SuiteSparse_config/SuiteSparse_config.mk
|
||||
+++ b/SuiteSparse_config/SuiteSparse_config.mk
|
||||
@@ -212,8 +212,8 @@ XERBLA =
|
||||
# The path is relative to where it is used, in CHOLMOD/Lib, CHOLMOD/MATLAB, etc.
|
||||
# You may wish to use an absolute path. METIS is optional. Compile
|
||||
# CHOLMOD with -DNPARTITION if you do not wish to use METIS.
|
||||
-METIS_PATH = ../../metis-4.0
|
||||
-METIS = ../../metis-4.0/libmetis.a
|
||||
+# METIS_PATH = ../../metis-4.0
|
||||
+# METIS = ../../metis-4.0/libmetis.a
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# UMFPACK configuration:
|
||||
@@ -273,7 +273,7 @@ UMFPACK_CONFIG =
|
||||
# -DNSUNPERF for Solaris only. If defined, do not use the Sun
|
||||
# Performance Library
|
||||
|
||||
-CHOLMOD_CONFIG = $(GPU_CONFIG)
|
||||
+CHOLMOD_CONFIG = $(GPU_CONFIG) -DNPARTITION
|
||||
|
||||
# uncomment this line to compile CHOLMOD without METIS:
|
||||
# CHOLMOD_CONFIG = -DNPARTITION
|
||||
--
|
||||
2.1.3
|
||||
|
@ -1,33 +1,41 @@
|
||||
{ stdenv, fetchurl, substituteAll
|
||||
, atlasWithLapack, gfortran }:
|
||||
{ stdenv, fetchurl, gfortran, openblas }:
|
||||
|
||||
let
|
||||
name = "suitesparse-4.4.1";
|
||||
version = "4.4.1";
|
||||
name = "suitesparse-${version}";
|
||||
|
||||
int_t = if openblas.blas64 then "int64_t" else "int32_t";
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
inherit name;
|
||||
|
||||
src = fetchurl {
|
||||
url = "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-4.4.1.tar.gz";
|
||||
url = "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-${version}.tar.gz";
|
||||
sha256 = "0y8i6dizrr556xggpjyc7wijjv4jbizhssmjj4jv8n1s7zxy2z0n";
|
||||
};
|
||||
|
||||
patches = [
|
||||
./0001-disable-metis.patch
|
||||
./0002-set-install-dir.patch
|
||||
(substituteAll {
|
||||
src = ./0003-blas-lapack-flags.patch;
|
||||
blasFlags = "-lf77blas -latlas -lcblas -lgfortran";
|
||||
lapackFlags= "-llapack -latlas -lcblas";
|
||||
})
|
||||
];
|
||||
|
||||
preConfigure = ''
|
||||
substituteAllInPlace SuiteSparse_config/SuiteSparse_config.mk
|
||||
mkdir -p $out/lib
|
||||
mkdir -p $out/include
|
||||
|
||||
sed -i "SuiteSparse_config/SuiteSparse_config.mk" \
|
||||
-e 's/METIS .*$/METIS =/' \
|
||||
-e 's/METIS_PATH .*$/METIS_PATH =/' \
|
||||
-e '/CHOLMOD_CONFIG/ s/$/-DNPARTITION -DLONGBLAS=${int_t}/' \
|
||||
-e '/UMFPACK_CONFIG/ s/$/-DLONGBLAS=${int_t}/'
|
||||
'';
|
||||
|
||||
makeFlags = [
|
||||
"PREFIX=\"$(out)\""
|
||||
"INSTALL_LIB=$(out)/lib"
|
||||
"INSTALL_INCLUDE=$(out)/include"
|
||||
"BLAS=-lopenblas"
|
||||
"LAPACK="
|
||||
];
|
||||
|
||||
NIX_CFLAGS = "-fPIC";
|
||||
|
||||
postInstall = ''
|
||||
# Install documentation
|
||||
outdoc=$out/share/doc/${name}
|
||||
@ -47,7 +55,7 @@ stdenv.mkDerivation {
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ gfortran ];
|
||||
buildInputs = [ atlasWithLapack ];
|
||||
buildInputs = [ openblas ];
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
homepage = http://faculty.cse.tamu.edu/davis/suitesparse.html;
|
||||
|
Loading…
Reference in New Issue
Block a user