aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/mkl
diff options
context:
space:
mode:
authorMx Kookie <kookie@spacekookie.de>2020-12-09 18:55:19 +0000
committerMx Kookie <kookie@spacekookie.de>2020-12-09 18:55:19 +0000
commit80d90d9b204f7c17912740f9f414fe5d59f293ba (patch)
tree5f2065a06e724270610760d59d01c6888b375a46 /infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/mkl
parent3a31a84c7d3e589035ad08499206aac44a81f424 (diff)
parent83cbad92d73216bb0d9187c56cce0b91f9121d5a (diff)
Merge commit '83cbad92d73216bb0d9187c56cce0b91f9121d5a' into main
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/mkl')
-rw-r--r--infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/mkl/default.nix21
-rw-r--r--infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/mkl/test/default.nix33
-rw-r--r--infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/mkl/test/test.c12
3 files changed, 57 insertions, 9 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/mkl/default.nix b/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/mkl/default.nix
index 2be3baed4497..1887d53e3066 100644
--- a/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/mkl/default.nix
+++ b/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/mkl/default.nix
@@ -1,4 +1,5 @@
-{ stdenvNoCC
+{ callPackage
+, stdenvNoCC
, fetchurl
, rpmextract
, undmg
@@ -19,12 +20,11 @@ let
# Darwin is pinned to 2019.3 because the DMG does not unpack; see here for details:
# https://github.com/matthewbauer/undmg/issues/4
year = if stdenvNoCC.isDarwin then "2019" else "2020";
- spot = if stdenvNoCC.isDarwin then "3" else "3";
- rel = if stdenvNoCC.isDarwin then "199" else "279";
+ spot = if stdenvNoCC.isDarwin then "3" else "4";
+ rel = if stdenvNoCC.isDarwin then "199" else "304";
- # Replace `openmpSpot` by `spot` after 2020.3. Release 2020.03
- # adresses performance regressions and does not update OpenMP.
- openmpSpot = if stdenvNoCC.isDarwin then spot else "2";
+ # Replace `openmpSpot` by `spot` after 2020.
+ openmpSpot = if stdenvNoCC.isDarwin then spot else "3";
rpm-ver = "${year}.${spot}-${rel}-${year}.${spot}-${rel}";
@@ -46,8 +46,8 @@ in stdenvNoCC.mkDerivation {
})
else
(fetchurl {
- url = "https://registrationcenter-download.intel.com/akdlm/irc_nas/tec/16903/l_mkl_${version}.tgz";
- sha256 = "013shn3c823bjfssq4jyl3na5lbzj99s09ds608ljqllri7473ib";
+ url = "https://registrationcenter-download.intel.com/akdlm/irc_nas/tec/16917/l_mkl_${version}.tgz";
+ hash = "sha256-IxTUZTaXTb0I8qTk+emhVdx+eeJ5jHTn3fqtAKWRfqU=";
});
nativeBuildInputs = [ validatePkgConfig ] ++ (if stdenvNoCC.isDarwin
@@ -90,7 +90,8 @@ in stdenvNoCC.mkDerivation {
substituteInPlace $f \
--replace "prefix=<INSTALLDIR>/mkl" "prefix=$out" \
--replace $\{MKLROOT} "$out" \
- --replace "lib/intel64_lin" "lib"
+ --replace "lib/intel64_lin" "lib" \
+ --replace "lib/intel64" "lib"
done
for f in $(find opt/intel -name 'mkl*iomp.pc') ; do
@@ -156,6 +157,8 @@ in stdenvNoCC.mkDerivation {
dontStrip = true;
dontPatchELF = true;
+ passthru.tests.pkg-config = callPackage ./test { };
+
meta = with stdenvNoCC.lib; {
description = "Intel Math Kernel Library";
longDescription = ''
diff --git a/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/mkl/test/default.nix b/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/mkl/test/default.nix
new file mode 100644
index 000000000000..688c0ec7c399
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/mkl/test/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, pkg-config, mkl }:
+
+stdenv.mkDerivation {
+ pname = "mkl-test";
+ version = mkl.version;
+
+ src = ./.;
+
+ nativeBuildInputs = [ pkg-config ];
+
+ buildInputs = [ mkl ];
+
+ doCheck = true;
+
+ buildPhase = ''
+ # Check regular Nix build.
+ gcc $(pkg-config --cflags --libs mkl-dynamic-ilp64-seq) test.c -o test
+
+ # Clear flags to ensure that we are purely relying on options
+ # provided by pkg-config.
+ NIX_CFLAGS_COMPILE="" \
+ NIX_LDFLAGS="" \
+ gcc $(pkg-config --cflags --libs mkl-dynamic-ilp64-seq) test.c -o test
+ '';
+
+ installPhase = ''
+ touch $out
+ '';
+
+ checkPhase = ''
+ ./test
+ '';
+}
diff --git a/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/mkl/test/test.c b/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/mkl/test/test.c
new file mode 100644
index 000000000000..9413ac0c68e9
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/development/libraries/science/math/mkl/test/test.c
@@ -0,0 +1,12 @@
+#include <assert.h>
+
+#include <mkl_cblas.h>
+
+int main() {
+ float u[] = {1., 2., 3.};
+ float v[] = {4., 5., 6.};
+
+ float dp = cblas_sdot(3, u, 1, v, 1);
+
+ assert(dp == 32.);
+}