Merge master into staging-next

This commit is contained in:
Frederik Rietdijk
2020-11-09 14:33:52 +01:00
313 changed files with 7523 additions and 7431 deletions
@@ -100,7 +100,7 @@ in stdenv.mkDerivation {
outputs = [ "out" "dev" ];
passthru.tests = callPackage ./test { };
passthru.tests.cmake = callPackage ./test { };
meta = with stdenv.lib; {
description = "C++ API of the PyTorch machine learning framework";
@@ -6,16 +6,12 @@ stdenv.mkDerivation {
src = ./.;
postPatch = ''
cat CMakeLists.txt
'';
makeFlags = [ "VERBOSE=1" ];
nativeBuildInputs = [ cmake ];
buildInputs = [ libtorch-bin ];
doCheck = true;
installPhase = ''
touch $out
'';
@@ -1,7 +1,20 @@
#include <torch/torch.h>
#undef NDEBUG
#include <cassert>
#include <iostream>
#include <torch/torch.h>
int main() {
torch::Tensor tensor = torch::eye(3);
std::cout << tensor << std::endl;
float checkData[] = {
1, 0, 0,
0, 1, 0,
0, 0, 1
};
torch::Tensor check = torch::from_blob(checkData, {3, 3});
assert(tensor.allclose(check));
}
@@ -1,4 +1,5 @@
{ stdenvNoCC
{ callPackage
, stdenvNoCC
, fetchurl
, rpmextract
, undmg
@@ -90,7 +91,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 +158,8 @@ in stdenvNoCC.mkDerivation {
dontStrip = true;
dontPatchELF = true;
passthru.tests.pkg-config = callPackage ./test { };
meta = with stdenvNoCC.lib; {
description = "Intel Math Kernel Library";
longDescription = ''
@@ -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
'';
}
@@ -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.);
}