treewide: use blas and lapack
This makes packages use lapack and blas, which can wrap different BLAS/LAPACK implementations. treewide: cleanup from blas/lapack changes A few issues in the original treewide: - can’t assume blas64 is a bool - unused commented code
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{ stdenv, fetchurl, gfortran, openblas }:
|
||||
{ stdenv, fetchurl, gfortran, blas, lapack }:
|
||||
|
||||
let
|
||||
int_t = if openblas.blas64 then "int64_t" else "int32_t";
|
||||
int_t = if blas.is64bit then "int64_t" else "int32_t";
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
version = "4.2.1";
|
||||
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ gfortran ];
|
||||
buildInputs = [ openblas ];
|
||||
buildInputs = [ blas lapack ];
|
||||
|
||||
preConfigure = ''
|
||||
mkdir -p $out/lib
|
||||
@@ -29,8 +29,8 @@ stdenv.mkDerivation rec {
|
||||
"PREFIX=\"$(out)\""
|
||||
"INSTALL_LIB=$(out)/lib"
|
||||
"INSTALL_INCLUDE=$(out)/include"
|
||||
"BLAS=-lopenblas"
|
||||
"LAPACK="
|
||||
"BLAS=-lblas"
|
||||
"LAPACK=-llapack"
|
||||
];
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{ stdenv, fetchurl, gfortran, openblas
|
||||
, enableCuda ? false, cudatoolkit
|
||||
{ stdenv, fetchurl, gfortran, blas, lapack
|
||||
, enableCuda ? false, cudatoolkit
|
||||
}:
|
||||
|
||||
let
|
||||
version = "4.4.4";
|
||||
name = "suitesparse-${version}";
|
||||
|
||||
int_t = if openblas.blas64 then "int64_t" else "int32_t";
|
||||
int_t = if blas.is64bit then "int64_t" else "int32_t";
|
||||
SHLIB_EXT = stdenv.hostPlatform.extensions.sharedLibrary;
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
@@ -51,8 +51,8 @@ stdenv.mkDerivation {
|
||||
"PREFIX=\"$(out)\""
|
||||
"INSTALL_LIB=$(out)/lib"
|
||||
"INSTALL_INCLUDE=$(out)/include"
|
||||
"BLAS=-lopenblas"
|
||||
"LAPACK="
|
||||
"BLAS=-lblas"
|
||||
"LAPACK=-llapack"
|
||||
];
|
||||
|
||||
NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin " -DNTIMER";
|
||||
@@ -64,7 +64,7 @@ stdenv.mkDerivation {
|
||||
for i in "$out"/lib/lib*.a; do
|
||||
ar -x $i
|
||||
done
|
||||
${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"}
|
||||
${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}" -lblas ${stdenv.lib.optionalString enableCuda "-lcublas"}
|
||||
)
|
||||
for i in umfpack cholmod amd camd colamd spqr; do
|
||||
ln -s libsuitesparse${SHLIB_EXT} "$out"/lib/lib$i${SHLIB_EXT}
|
||||
@@ -88,7 +88,7 @@ stdenv.mkDerivation {
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ gfortran ];
|
||||
buildInputs = [ openblas ];
|
||||
buildInputs = [ blas lapack ];
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
homepage = "http://faculty.cse.tamu.edu/davis/suitesparse.html";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{ stdenv
|
||||
, fetchFromGitHub
|
||||
, gfortran
|
||||
, openblas
|
||||
, blas, lapack
|
||||
, metis
|
||||
, fixDarwinDylibNames
|
||||
, gnum4
|
||||
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
|
||||
] ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
|
||||
|
||||
buildInputs = [
|
||||
openblas
|
||||
blas lapack
|
||||
metis
|
||||
gfortran.cc.lib
|
||||
] ++ stdenv.lib.optional enableCuda cudatoolkit;
|
||||
@@ -41,10 +41,10 @@ stdenv.mkDerivation rec {
|
||||
"INSTALL=${placeholder "out"}"
|
||||
"INSTALL_INCLUDE=${placeholder "dev"}/include"
|
||||
"JOBS=$(NIX_BUILD_CORES)"
|
||||
"BLAS=-lopenblas"
|
||||
"BLAS=-lblas"
|
||||
"LAPACK=-llapack"
|
||||
"MY_METIS_LIB=-lmetis"
|
||||
"LAPACK="
|
||||
] ++ stdenv.lib.optionals openblas.blas64 [
|
||||
] ++ stdenv.lib.optionals blas.is64bit [
|
||||
"CFLAGS=-DBLAS64"
|
||||
] ++ stdenv.lib.optionals enableCuda [
|
||||
"CUDA_PATH=${cudatoolkit}"
|
||||
|
||||
Reference in New Issue
Block a user