2019-06-16 20:59:06 +01:00
|
|
|
{ stdenvNoCC, fetchurl, rpmextract, undmg, darwin }:
|
2018-10-04 03:24:21 +01:00
|
|
|
/*
|
2018-10-23 22:33:49 +01:00
|
|
|
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.
|
|
|
|
*/
|
2019-09-16 16:05:54 +01:00
|
|
|
stdenvNoCC.mkDerivation rec {
|
2018-08-18 01:48:40 +01:00
|
|
|
name = "mkl-${version}";
|
|
|
|
version = "${date}.${rel}";
|
2019-04-01 16:15:22 +01:00
|
|
|
date = "2019.3";
|
|
|
|
rel = "199";
|
2018-08-18 01:48:40 +01:00
|
|
|
|
2018-10-03 03:53:48 +01:00
|
|
|
src = if stdenvNoCC.isDarwin
|
|
|
|
then
|
|
|
|
(fetchurl {
|
2019-04-01 16:15:22 +01:00
|
|
|
url = "http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/15235/m_mkl_${version}.dmg";
|
|
|
|
sha256 = "14b3ciz7995sqcd6jz7hc8g2x4zwvqxmgxgni46vrlb7n523l62f";
|
2018-10-03 03:53:48 +01:00
|
|
|
})
|
|
|
|
else
|
|
|
|
(fetchurl {
|
2019-04-01 16:15:22 +01:00
|
|
|
url = "http://registrationcenter-download.intel.com/akdlm/irc_nas/tec/15275/l_mkl_${version}.tgz";
|
|
|
|
sha256 = "13rb2v2872jmvzcqm4fqsvhry0j2r5cn4lqql4wpqbl1yia2pph6";
|
2018-10-03 03:53:48 +01:00
|
|
|
});
|
2018-08-18 01:48:40 +01:00
|
|
|
|
2019-03-20 09:45:57 +00:00
|
|
|
nativeBuildInputs = if stdenvNoCC.isDarwin
|
|
|
|
then
|
|
|
|
[ undmg
|
|
|
|
darwin.cctools
|
|
|
|
]
|
|
|
|
else
|
|
|
|
[ rpmextract ];
|
2018-08-18 01:48:40 +01:00
|
|
|
|
2018-10-03 03:53:48 +01:00
|
|
|
buildPhase = if stdenvNoCC.isDarwin then ''
|
|
|
|
for f in Contents/Resources/pkg/*.tgz; do
|
|
|
|
tar xzvf $f
|
|
|
|
done
|
|
|
|
'' else ''
|
|
|
|
rpmextract rpm/intel-mkl-common-c-${date}-${rel}-${date}-${rel}.noarch.rpm
|
2019-09-16 16:05:54 +01:00
|
|
|
rpmextract rpm/intel-mkl-core-${date}-${rel}-${date}-${rel}.x86_64.rpm
|
2018-10-03 03:53:48 +01:00
|
|
|
rpmextract rpm/intel-mkl-core-rt-${date}-${rel}-${date}-${rel}.x86_64.rpm
|
2019-04-01 16:15:22 +01:00
|
|
|
rpmextract rpm/intel-openmp-19.0.3-${rel}-19.0.3-${rel}.x86_64.rpm
|
2018-10-04 03:24:21 +01:00
|
|
|
'';
|
2018-08-18 01:48:40 +01:00
|
|
|
|
2019-09-16 16:05:54 +01:00
|
|
|
installPhase = ''
|
|
|
|
for f in $(find . -name 'mkl*.pc') ; do
|
|
|
|
bn=$(basename $f)
|
|
|
|
substituteInPlace $f \
|
|
|
|
--replace "prefix=<INSTALLDIR>/mkl" "prefix=$out" \
|
|
|
|
--replace "lib/intel64_lin" "lib"
|
|
|
|
done
|
|
|
|
|
|
|
|
for f in $(find opt/intel -name 'mkl*iomp.pc') ; do
|
|
|
|
substituteInPlace $f \
|
|
|
|
--replace "../compiler/lib" "lib"
|
|
|
|
done
|
|
|
|
'' +
|
|
|
|
(if stdenvNoCC.isDarwin then ''
|
2018-10-03 03:53:48 +01:00
|
|
|
mkdir -p $out/lib
|
2018-10-23 22:33:49 +01:00
|
|
|
|
2018-10-03 03:53:48 +01:00
|
|
|
cp -r compilers_and_libraries_${version}/mac/mkl/include $out/
|
2018-10-23 22:33:49 +01:00
|
|
|
|
2018-10-03 03:53:48 +01:00
|
|
|
cp -r compilers_and_libraries_${version}/licensing/mkl/en/license.txt $out/lib/
|
2018-10-23 22:33:49 +01:00
|
|
|
cp -r compilers_and_libraries_${version}/mac/compiler/lib/* $out/lib/
|
|
|
|
cp -r compilers_and_libraries_${version}/mac/mkl/lib/* $out/lib/
|
2019-03-20 09:45:57 +00:00
|
|
|
cp -r compilers_and_libraries_${version}/mac/tbb/lib/* $out/lib/
|
2019-09-16 16:05:54 +01:00
|
|
|
|
|
|
|
mkdir -p $out/lib/pkgconfig
|
|
|
|
cp -r compilers_and_libraries_${version}/mac/mkl/bin/pkgconfig/* $out/lib/pkgconfig
|
2018-10-03 03:53:48 +01:00
|
|
|
'' else ''
|
|
|
|
mkdir -p $out/lib
|
2018-10-23 22:33:49 +01:00
|
|
|
|
2018-10-03 03:53:48 +01:00
|
|
|
cp -r opt/intel/compilers_and_libraries_${version}/linux/mkl/include $out/
|
2018-10-23 22:33:49 +01:00
|
|
|
|
|
|
|
cp -r opt/intel/compilers_and_libraries_${version}/linux/compiler/lib/intel64_lin/* $out/lib/
|
2018-10-03 03:53:48 +01:00
|
|
|
cp -r opt/intel/compilers_and_libraries_${version}/linux/mkl/lib/intel64_lin/* $out/lib/
|
|
|
|
cp license.txt $out/lib/
|
2019-09-16 16:05:54 +01:00
|
|
|
|
|
|
|
mkdir -p $out/lib/pkgconfig
|
|
|
|
cp -r opt/intel/compilers_and_libraries_${version}/linux/mkl/bin/pkgconfig/* $out/lib/pkgconfig
|
|
|
|
'');
|
2018-08-18 01:48:40 +01:00
|
|
|
|
2019-03-20 09:45:57 +00:00
|
|
|
# fixDarwinDylibName fails for libmkl_cdft_core.dylib because the
|
|
|
|
# larger updated load commands do not fit. Use install_name_tool
|
|
|
|
# explicitly and ignore the error.
|
|
|
|
postFixup = stdenvNoCC.lib.optionalString stdenvNoCC.isDarwin ''
|
|
|
|
for f in $out/lib/*.dylib; do
|
|
|
|
install_name_tool -id $out/lib/$(basename $f) $f || true
|
|
|
|
done
|
|
|
|
install_name_tool -change @rpath/libiomp5.dylib $out/lib/libiomp5.dylib $out/lib/libmkl_intel_thread.dylib
|
|
|
|
install_name_tool -change @rpath/libtbb.dylib $out/lib/libtbb.dylib $out/lib/libmkl_tbb_thread.dylib
|
|
|
|
install_name_tool -change @rpath/libtbbmalloc.dylib $out/lib/libtbbmalloc.dylib $out/lib/libtbbmalloc_proxy.dylib
|
|
|
|
'';
|
|
|
|
|
2018-08-18 01:48:40 +01:00
|
|
|
# Per license agreement, do not modify the binary
|
|
|
|
dontStrip = true;
|
|
|
|
dontPatchELF = true;
|
|
|
|
|
|
|
|
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;
|
2018-10-23 22:33:49 +01:00
|
|
|
license = licenses.issl;
|
2018-10-03 03:53:48 +01:00
|
|
|
platforms = [ "x86_64-linux" "x86_64-darwin" ];
|
2018-08-18 01:48:40 +01:00
|
|
|
maintainers = [ maintainers.bhipple ];
|
|
|
|
};
|
2019-09-16 16:05:54 +01:00
|
|
|
}
|