summary refs log tree commit diff
path: root/pkgs/development/libraries/science/math/mkl/default.nix
diff options
context:
space:
mode:
authorBenjamin Hipple <bhipple@protonmail.com>2018-08-17 20:48:40 -0400
committerBenjamin Hipple <bhipple@protonmail.com>2018-09-22 15:28:39 -0400
commitd7c1d04af4085e0ae6fecbffdb0a19299de598e8 (patch)
tree8e908a8bbd17d20cdb5df5c3b2a5ec82f32e0d70 /pkgs/development/libraries/science/math/mkl/default.nix
parent13e738f1e89869f158035ac6c0b0c118ae5eaf04 (diff)
downloadnixpkgs-d7c1d04af4085e0ae6fecbffdb0a19299de598e8.tar
nixpkgs-d7c1d04af4085e0ae6fecbffdb0a19299de598e8.tar.gz
nixpkgs-d7c1d04af4085e0ae6fecbffdb0a19299de598e8.tar.bz2
nixpkgs-d7c1d04af4085e0ae6fecbffdb0a19299de598e8.tar.lz
nixpkgs-d7c1d04af4085e0ae6fecbffdb0a19299de598e8.tar.xz
nixpkgs-d7c1d04af4085e0ae6fecbffdb0a19299de598e8.tar.zst
nixpkgs-d7c1d04af4085e0ae6fecbffdb0a19299de598e8.zip
mkl: init at 2019.0.117
This packags the Intel Math Kernel library on x86-64 platforms, which is a
dependency for many data science and machine learning packages.

Upstream, Intel provides proprietary binary RPMs with a permissive
redistribution license. These have been repackaged in both Debian and Anaconda,
so we are not the first distribution to redistribute.
Diffstat (limited to 'pkgs/development/libraries/science/math/mkl/default.nix')
-rw-r--r--pkgs/development/libraries/science/math/mkl/default.nix55
1 files changed, 55 insertions, 0 deletions
diff --git a/pkgs/development/libraries/science/math/mkl/default.nix b/pkgs/development/libraries/science/math/mkl/default.nix
new file mode 100644
index 00000000000..7412ecdba21
--- /dev/null
+++ b/pkgs/development/libraries/science/math/mkl/default.nix
@@ -0,0 +1,55 @@
+{ stdenvNoCC, writeText, fetchurl, rpm, cpio, openmp }:
+
+stdenvNoCC.mkDerivation rec {
+  name = "mkl-${version}";
+  version = "${date}.${rel}";
+  date = "2019.0";
+  rel = "117";
+
+  src = fetchurl {
+    url = "http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/13575/l_mkl_${version}.tgz";
+    sha256 = "1bf7i54iqlf7x7fn8kqwmi06g30sxr6nq3ac0r871i6g0p3y47sf";
+  };
+
+  buildInputs = [ rpm cpio ];
+  propagatedBuildInputs = [ openmp ];
+
+  buildPhase = ''
+    rpm2cpio rpm/intel-mkl-common-c-${date}-${rel}-${date}-${rel}.noarch.rpm | cpio -idmv
+    rpm2cpio rpm/intel-mkl-core-rt-${date}-${rel}-${date}-${rel}.x86_64.rpm | cpio -idmv
+  '';
+
+  installPhase = ''
+    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/mkl/lib/intel64_lin/* $out/lib/
+    cp license.txt $out/lib/
+  '';
+
+  # Per license agreement, do not modify the binary
+  dontStrip = true;
+  dontPatchELF = true;
+
+  # Some mkl calls require openmp, but Intel does not add these to SO_NEEDED and
+  # instructs users to put openmp on their LD_LIBRARY_PATH.
+  setupHook = writeText "setup-hook.sh" ''
+    addOpenmp() {
+        addToSearchPath LD_LIBRARY_PATH ${openmp}/lib
+    }
+    addEnvHooks "$targetOffset" addOpenmp
+  '';
+
+  meta = with stdenvNoCC.lib; {
+    description = "Intel Math Kernel Library";
+    longDescription = ''
+      Intel Math Kernel Library (Intel MKL) optimizes code with minimal effort
+      for future generations of Intel processors. It is compatible with your
+      choice of compilers, languages, operating systems, and linking and
+      threading models.
+    '';
+    homepage = https://software.intel.com/en-us/mkl;
+    license = licenses.issl;
+    platforms = [ "x86_64-linux" ];
+    maintainers = [ maintainers.bhipple ];
+  };
+}