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:
Matthew Bauer
2020-03-31 10:47:18 -04:00
parent 43873351ff
commit 1c8aba8334
68 changed files with 272 additions and 311 deletions

View File

@@ -4,7 +4,7 @@
, fetchPypi
, isPyPy
, python
, openblasCompat # build segfaults with regular openblas
, blas, lapack # build segfaults with 64-bit blas
, suitesparse
, glpk ? null
, gsl ? null
@@ -14,6 +14,8 @@
, withFftw ? true
}:
assert (!blas.is64bit) && (!lapack.is64bit);
buildPythonPackage rec {
pname = "cvxopt";
version = "1.2.4";
@@ -25,12 +27,13 @@ buildPythonPackage rec {
sha256 = "1h9g79gxpgpy6xciqyypihw5q4ngp322lpkka1nkwk0ysybfsp7s";
};
buildInputs = [ blas lapack ];
# similar to Gsl, glpk, fftw there is also a dsdp interface
# but dsdp is not yet packaged in nixpkgs
preConfigure = ''
export CVXOPT_BLAS_LIB_DIR=${openblasCompat}/lib
export CVXOPT_BLAS_LIB=openblas
export CVXOPT_LAPACK_LIB=openblas
export CVXOPT_BLAS_LIB=blas
export CVXOPT_LAPACK_LIB=lapack
export CVXOPT_SUITESPARSE_LIB_DIR=${lib.getLib suitesparse}/lib
export CVXOPT_SUITESPARSE_INC_DIR=${lib.getDev suitesparse}/include
'' + lib.optionalString withGsl ''

View File

@@ -5,21 +5,23 @@
, gfortran
, pytest
, blas
, lapack
, writeTextFile
, isPyPy
, cython
, setuptoolsBuildHook
}:
assert (!blas.is64bit) && (!lapack.is64bit);
let
blasImplementation = lib.nameFromURL blas.name "-";
cfg = writeTextFile {
name = "site.cfg";
text = (lib.generators.toINI {} {
${blasImplementation} = {
include_dirs = "${blas}/include";
library_dirs = "${blas}/lib";
} // lib.optionalAttrs (blasImplementation == "mkl") {
${blas.implementation} = {
include_dirs = "${blas}/include:${lapack}/include";
library_dirs = "${blas}/lib:${lapack}/lib";
} // lib.optionalAttrs (blas.implementation == "mkl") {
mkl_libs = "mkl_rt";
lapack_libs = "";
};
@@ -37,7 +39,7 @@ in buildPythonPackage rec {
};
nativeBuildInputs = [ gfortran pytest cython setuptoolsBuildHook ];
buildInputs = [ blas ];
buildInputs = [ blas lapack ];
patches = lib.optionals python.hasDistutilsCxxPatch [
# We patch cpython/distutils to fix https://bugs.python.org/issue1222585
@@ -68,8 +70,10 @@ in buildPythonPackage rec {
'';
passthru = {
blas = blas;
inherit blasImplementation cfg;
# just for backwards compatibility
blas = blas.provider;
blasImplementation = blas.implementation;
inherit cfg;
};
# Disable test

View File

@@ -1,13 +1,11 @@
{ lib
, blas
, lapack
, buildPythonPackage
, cffi
, fetchFromGitHub
, liblapack
, nose
, numpy
, openblas
, useOpenblas ? true
}:
buildPythonPackage {
@@ -21,8 +19,6 @@ buildPythonPackage {
sha256 = "0mlrjbb5rw78dgijkr3bspmsskk6jqs9y7xpsgs35i46dvb327q5";
};
patches = lib.optional useOpenblas ./use-openblas.patch;
checkInputs = [
nose
];
@@ -32,12 +28,7 @@ buildPythonPackage {
cffi
];
buildInputs = (
if useOpenblas then
[ openblas ]
else
[ blas liblapack ]
);
buildInputs = [ blas lapack ];
enableParallelBuilding = true;

View File

@@ -1,11 +0,0 @@
index f100b35..448bbaf 100644
--- a/prox_tv/prox_tv_build.py
+++ b/prox_tv/prox_tv_build.py
@@ -109,6 +109,6 @@ ffi.set_source(
define_macros=[('NOMATLAB', 1)],
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args,
- libraries=['blas', 'lapack'],
+ libraries=['openblas'],
include_dirs=['/usr/include']
)

View File

@@ -3,7 +3,8 @@
, fetchFromGitHub
, numpy
, setuptools
, liblapack
, blas
, lapack
, isPy27
, python
}:
@@ -24,8 +25,8 @@ buildPythonPackage {
propagatedBuildInputs = [
numpy
numpy.blas
liblapack
blas
lapack
];
# Include patches from working version of PySparse 1.3-dev in

View File

@@ -2,7 +2,7 @@
, buildPythonPackage
, fetchFromGitHub
, blas
, liblapack
, lapack
, numpy
, scipy
, scs
@@ -26,7 +26,7 @@ buildPythonPackage rec {
'';
buildInputs = [
liblapack
lapack
blas
];