Convert entire mkl package to a fixed-output derivation
This commit is contained in:
parent
ba02a2c371
commit
0b82df8dbe
@ -1,4 +1,20 @@
|
|||||||
{ stdenvNoCC, writeText, fetchurl, rpmextract, openmp, undmg }:
|
{ 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.
|
||||||
|
*/
|
||||||
|
|
||||||
stdenvNoCC.mkDerivation rec {
|
stdenvNoCC.mkDerivation rec {
|
||||||
name = "mkl-${version}";
|
name = "mkl-${version}";
|
||||||
@ -19,7 +35,6 @@ stdenvNoCC.mkDerivation rec {
|
|||||||
});
|
});
|
||||||
|
|
||||||
buildInputs = if stdenvNoCC.isDarwin then [ undmg ] else [ rpmextract ];
|
buildInputs = if stdenvNoCC.isDarwin then [ undmg ] else [ rpmextract ];
|
||||||
propagatedBuildInputs = [ openmp ];
|
|
||||||
|
|
||||||
buildPhase = if stdenvNoCC.isDarwin then ''
|
buildPhase = if stdenvNoCC.isDarwin then ''
|
||||||
for f in Contents/Resources/pkg/*.tgz; do
|
for f in Contents/Resources/pkg/*.tgz; do
|
||||||
@ -28,7 +43,7 @@ stdenvNoCC.mkDerivation rec {
|
|||||||
'' else ''
|
'' else ''
|
||||||
rpmextract rpm/intel-mkl-common-c-${date}-${rel}-${date}-${rel}.noarch.rpm
|
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-mkl-core-rt-${date}-${rel}-${date}-${rel}.x86_64.rpm
|
||||||
'' ;
|
'';
|
||||||
|
|
||||||
installPhase = if stdenvNoCC.isDarwin then ''
|
installPhase = if stdenvNoCC.isDarwin then ''
|
||||||
mkdir -p $out/lib
|
mkdir -p $out/lib
|
||||||
@ -46,14 +61,13 @@ stdenvNoCC.mkDerivation rec {
|
|||||||
dontStrip = true;
|
dontStrip = true;
|
||||||
dontPatchELF = true;
|
dontPatchELF = true;
|
||||||
|
|
||||||
# Some mkl calls require openmp, but Intel does not add these to SO_NEEDED and
|
# Since these are unmodified binaries from Intel, they do not depend on stdenv
|
||||||
# instructs users to put openmp on their LD_LIBRARY_PATH.
|
# and we can make them fixed-output derivations for cache efficiency.
|
||||||
setupHook = writeText "setup-hook.sh" ''
|
outputHashAlgo = "sha256";
|
||||||
addOpenmp() {
|
outputHashMode = "recursive";
|
||||||
addToSearchPath LD_LIBRARY_PATH ${openmp}/lib
|
outputHash = if stdenvNoCC.isDarwin
|
||||||
}
|
then "1224dln7n8px1rk8biiggf77wjhxh8mzw0hd8zlyjm8i6j8w7i12"
|
||||||
addEnvHooks "$targetOffset" addOpenmp
|
else "0d8ai0wi8drp071acqkm1wv6vyg12010y843y56zzi1pql81xqvx";
|
||||||
'';
|
|
||||||
|
|
||||||
meta = with stdenvNoCC.lib; {
|
meta = with stdenvNoCC.lib; {
|
||||||
description = "Intel Math Kernel Library";
|
description = "Intel Math Kernel Library";
|
||||||
|
@ -20858,9 +20858,7 @@ with pkgs;
|
|||||||
|
|
||||||
m4rie = callPackage ../development/libraries/science/math/m4rie { };
|
m4rie = callPackage ../development/libraries/science/math/m4rie { };
|
||||||
|
|
||||||
mkl = callPackage ../development/libraries/science/math/mkl {
|
mkl = callPackage ../development/libraries/science/math/mkl { };
|
||||||
inherit (llvmPackages) openmp;
|
|
||||||
};
|
|
||||||
|
|
||||||
nasc = callPackage ../applications/science/math/nasc { };
|
nasc = callPackage ../applications/science/math/nasc { };
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user