about summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
authorBenjamin Hipple <bhipple@protonmail.com>2018-10-23 17:33:49 -0400
committerFrederik Rietdijk <freddyrietdijk@fridh.nl>2018-12-19 22:05:22 +0100
commit6206a342e0c409de25d3573f7f444434ab75d0ed (patch)
tree17b3f2fcf1f53a995789917861e5df993bb4b2d6 /pkgs/development
parent65dfc2b272819760f7c7adf848ccff36390c0425 (diff)
downloadnixlib-6206a342e0c409de25d3573f7f444434ab75d0ed.tar
nixlib-6206a342e0c409de25d3573f7f444434ab75d0ed.tar.gz
nixlib-6206a342e0c409de25d3573f7f444434ab75d0ed.tar.bz2
nixlib-6206a342e0c409de25d3573f7f444434ab75d0ed.tar.lz
nixlib-6206a342e0c409de25d3573f7f444434ab75d0ed.tar.xz
nixlib-6206a342e0c409de25d3573f7f444434ab75d0ed.tar.zst
nixlib-6206a342e0c409de25d3573f7f444434ab75d0ed.zip
mkl: include Intel's libiomp.so in the MKL RPM unpack
Since Intel's default openmp implementation is available in the same src
tarball, we can just include it in the package. This means that `mkl` now "just
works" without any environment variables, fragile setup-hooks, or forced
propagation.

Since the openmp implementation is only needed at runtime (and for test cases),
users can substitute a different one if they prefer by exporting it with
`LD_PRELOAD`, which is how Intel recommends handling this. If they do not do so,
`libiomp.so` lives next to `libmkl_rt.so` and thus will be in the RPATH as a
sane default.

Since this still comes from the same src tarball, we can ship it without losing
the fixed-output derivation; likewise, since Hydra is not building or caching
these, shipping these proprietary packages costs no bandwidth for the nix
community.
Diffstat (limited to 'pkgs/development')
-rw-r--r--pkgs/development/libraries/science/math/mkl/default.nix34
-rw-r--r--pkgs/development/python-modules/numexpr/default.nix8
-rw-r--r--pkgs/development/python-modules/numpy/default.nix2
3 files changed, 15 insertions, 29 deletions
diff --git a/pkgs/development/libraries/science/math/mkl/default.nix b/pkgs/development/libraries/science/math/mkl/default.nix
index 37814047f975..0eecb2012f1e 100644
--- a/pkgs/development/libraries/science/math/mkl/default.nix
+++ b/pkgs/development/libraries/science/math/mkl/default.nix
@@ -1,21 +1,8 @@
 { stdenvNoCC, writeText, fetchurl, rpmextract, undmg }:
 /*
-  Some (but not all) mkl functions require openmp, but Intel does not add these
-  to SO_NEEDED and instructs users to put openmp on their LD_LIBRARY_PATH. If
-  you are using mkl and your library/application is using some of the functions
-  that require openmp, add a setupHook like this to your package:
-
-  setupHook = writeText "setup-hook.sh" ''
-    addOpenmp() {
-        addToSearchPath LD_LIBRARY_PATH ${openmp}/lib
-    }
-    addEnvHooks "$targetOffset" addOpenmp
-  '';
-
-  We do not add the setup hook here, because avoiding it allows this large
-  package to be a fixed-output derivation with better cache efficiency.
- */
-
+  For details on using mkl as a blas provider for python packages such as numpy,
+  numexpr, scipy, etc., see the Python section of the NixPkgs manual.
+*/
 stdenvNoCC.mkDerivation rec {
   name = "mkl-${version}";
   version = "${date}.${rel}";
@@ -43,16 +30,23 @@ stdenvNoCC.mkDerivation rec {
   '' else ''
     rpmextract rpm/intel-mkl-common-c-${date}-${rel}-${date}-${rel}.noarch.rpm
     rpmextract rpm/intel-mkl-core-rt-${date}-${rel}-${date}-${rel}.x86_64.rpm
+    rpmextract rpm/intel-openmp-19.0.0-${rel}-19.0.0-${rel}.x86_64.rpm
   '';
 
   installPhase = if stdenvNoCC.isDarwin then ''
       mkdir -p $out/lib
+
       cp -r compilers_and_libraries_${version}/mac/mkl/include $out/
-      cp -r compilers_and_libraries_${version}/mac/mkl/lib/* $out/lib/
+
       cp -r compilers_and_libraries_${version}/licensing/mkl/en/license.txt $out/lib/
+      cp -r compilers_and_libraries_${version}/mac/compiler/lib/* $out/lib/
+      cp -r compilers_and_libraries_${version}/mac/mkl/lib/* $out/lib/
   '' else ''
       mkdir -p $out/lib
+
       cp -r opt/intel/compilers_and_libraries_${version}/linux/mkl/include $out/
+
+      cp -r opt/intel/compilers_and_libraries_${version}/linux/compiler/lib/intel64_lin/* $out/lib/
       cp -r opt/intel/compilers_and_libraries_${version}/linux/mkl/lib/intel64_lin/* $out/lib/
       cp license.txt $out/lib/
   '';
@@ -66,8 +60,8 @@ stdenvNoCC.mkDerivation rec {
   outputHashAlgo = "sha256";
   outputHashMode = "recursive";
   outputHash = if stdenvNoCC.isDarwin
-    then "1224dln7n8px1rk8biiggf77wjhxh8mzw0hd8zlyjm8i6j8w7i12"
-    else "0d8ai0wi8drp071acqkm1wv6vyg12010y843y56zzi1pql81xqvx";
+    then "0000000000000000000000000000000000000000000000000000"
+    else "1amagcaan0hk3x9v7gg03gkw02n066v4kmjb32yyzsy5rfrivb1a";
 
   meta = with stdenvNoCC.lib; {
     description = "Intel Math Kernel Library";
@@ -78,7 +72,7 @@ stdenvNoCC.mkDerivation rec {
       threading models.
     '';
     homepage = https://software.intel.com/en-us/mkl;
-    license = [ licenses.issl licenses.unfreeRedistributable ];
+    license = licenses.issl;
     platforms = [ "x86_64-linux" "x86_64-darwin" ];
     maintainers = [ maintainers.bhipple ];
   };
diff --git a/pkgs/development/python-modules/numexpr/default.nix b/pkgs/development/python-modules/numexpr/default.nix
index acf41fb539e3..280b11706a17 100644
--- a/pkgs/development/python-modules/numexpr/default.nix
+++ b/pkgs/development/python-modules/numexpr/default.nix
@@ -3,7 +3,6 @@
 , fetchPypi
 , python
 , numpy
-, llvmPackages ? null
 }:
 
 buildPythonPackage rec {
@@ -16,16 +15,11 @@ buildPythonPackage rec {
   };
 
   # Remove existing site.cfg, use the one we built for numpy.
-  # Somehow openmp needs to be added to LD_LIBRARY_PATH
-  # https://software.intel.com/en-us/forums/intel-system-studio/topic/611682
   preBuild = ''
     rm site.cfg
     ln -s ${numpy.cfg} site.cfg
-    export LD_LIBRARY_PATH=${llvmPackages.openmp}/lib
   '';
 
-  buildInputs = [] ++ lib.optional (numpy.blasImplementation == "mkl") llvmPackages.openmp;
-
   propagatedBuildInputs = [ numpy ];
 
   # Run the test suite.
@@ -47,4 +41,4 @@ buildPythonPackage rec {
     homepage = "https://github.com/pydata/numexpr";
     license = lib.licenses.mit;
   };
-}
\ No newline at end of file
+}
diff --git a/pkgs/development/python-modules/numpy/default.nix b/pkgs/development/python-modules/numpy/default.nix
index 8a3879f19822..d66cbd77bbc5 100644
--- a/pkgs/development/python-modules/numpy/default.nix
+++ b/pkgs/development/python-modules/numpy/default.nix
@@ -71,8 +71,6 @@ in buildPythonPackage rec {
     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