pythonPackages.{numpy,scipy,numexpr}: support MKL as BLAS

This adds support building with MKL.
This commit is contained in:
Chris Ostrouchov
2018-10-18 15:00:48 -04:00
committed by Frederik Rietdijk
parent eee82aee37
commit 277b73ab6f
4 changed files with 53 additions and 16 deletions

View File

@@ -1,6 +1,20 @@
{ stdenv, lib, fetchPypi, python, buildPythonPackage, isPyPy, gfortran, pytest, blas }:
{ stdenv, lib, fetchPypi, python, buildPythonPackage, isPyPy, gfortran, pytest, blas, writeTextFile }:
buildPythonPackage rec {
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") {
mkl_libs = "mkl_rt";
lapack_libs = "";
};
});
};
in buildPythonPackage rec {
pname = "numpy";
version = "1.15.2";
@@ -39,12 +53,7 @@ buildPythonPackage rec {
'';
preBuild = ''
echo "Creating site.cfg file..."
cat << EOF > site.cfg
[openblas]
include_dirs = ${blas}/include
library_dirs = ${blas}/lib
EOF
ln -s ${cfg} site.cfg
'';
enableParallelBuilding = true;
@@ -59,8 +68,11 @@ buildPythonPackage rec {
passthru = {
blas = blas;
inherit blasImplementation cfg;
};
doCheck = blasImplementation != "mkl";
# Disable two tests
# - test_f2py: f2py isn't yet on path.
# - test_large_file_support: takes a long time and can cause the machine to run out of disk space