Merge pull request #103005 from danieldk/fix-mkl-pkgconfig
mkl: fix .pc file, add test
This commit is contained in:
commit
83401d1a21
3 changed files with 51 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
||||||
{ stdenvNoCC
|
{ callPackage
|
||||||
|
, stdenvNoCC
|
||||||
, fetchurl
|
, fetchurl
|
||||||
, rpmextract
|
, rpmextract
|
||||||
, undmg
|
, undmg
|
||||||
|
@ -90,7 +91,8 @@ in stdenvNoCC.mkDerivation {
|
||||||
substituteInPlace $f \
|
substituteInPlace $f \
|
||||||
--replace "prefix=<INSTALLDIR>/mkl" "prefix=$out" \
|
--replace "prefix=<INSTALLDIR>/mkl" "prefix=$out" \
|
||||||
--replace $\{MKLROOT} "$out" \
|
--replace $\{MKLROOT} "$out" \
|
||||||
--replace "lib/intel64_lin" "lib"
|
--replace "lib/intel64_lin" "lib" \
|
||||||
|
--replace "lib/intel64" "lib"
|
||||||
done
|
done
|
||||||
|
|
||||||
for f in $(find opt/intel -name 'mkl*iomp.pc') ; do
|
for f in $(find opt/intel -name 'mkl*iomp.pc') ; do
|
||||||
|
@ -156,6 +158,8 @@ in stdenvNoCC.mkDerivation {
|
||||||
dontStrip = true;
|
dontStrip = true;
|
||||||
dontPatchELF = true;
|
dontPatchELF = true;
|
||||||
|
|
||||||
|
passthru.tests.pkg-config = callPackage ./test { };
|
||||||
|
|
||||||
meta = with stdenvNoCC.lib; {
|
meta = with stdenvNoCC.lib; {
|
||||||
description = "Intel Math Kernel Library";
|
description = "Intel Math Kernel Library";
|
||||||
longDescription = ''
|
longDescription = ''
|
||||||
|
|
33
pkgs/development/libraries/science/math/mkl/test/default.nix
Normal file
33
pkgs/development/libraries/science/math/mkl/test/default.nix
Normal file
|
@ -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
|
||||||
|
'';
|
||||||
|
}
|
12
pkgs/development/libraries/science/math/mkl/test/test.c
Normal file
12
pkgs/development/libraries/science/math/mkl/test/test.c
Normal file
|
@ -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.);
|
||||||
|
}
|
Loading…
Reference in a new issue