Skip to content

Commit

Permalink
pythonPackages.numpy: refactor adding mkl support
Browse files Browse the repository at this point in the history
  • Loading branch information
costrouc committed Oct 18, 2018
1 parent 84890ac commit e4c51e5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pkgs/development/python-modules/numpy/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{ stdenv, lib, fetchPypi, python, buildPythonPackage, isPyPy, gfortran, pytest, blas }:

let blasImplementation = stdenv.lib.nameFromURL blas.name "-";
in
buildPythonPackage rec {
pname = "numpy";
version = "1.15.1";
Expand Down Expand Up @@ -38,7 +40,16 @@ buildPythonPackage rec {
export NPY_NUM_BUILD_JOBS=$NIX_BUILD_CORES
'';

preBuild = ''
preBuild = if blasImplementation == "mkl" then ''
echo "Creating site.cfg file..."
cat << EOF > site.cfg
[mkl]
include_dirs = ${blas}/include
library_dirs = ${blas}/lib
mkl_libs = mkl_rt
lapack_libs =
EOF
'' else ''
echo "Creating site.cfg file..."
cat << EOF > site.cfg
[openblas]
Expand Down
4 changes: 4 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8111,6 +8111,10 @@ in {
blas = pkgs.openblasCompat;
};

numpy-mkl = callPackage ../development/python-modules/numpy {
blas = pkgs.mkl;
};

numpydoc = callPackage ../development/python-modules/numpydoc { };

numpy-stl = callPackage ../development/python-modules/numpy-stl { };
Expand Down

0 comments on commit e4c51e5

Please sign in to comment.