summary refs log tree commit diff
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2018-02-25 19:58:21 +0300
committerNikolay Amiantov <ab@fmap.me>2018-02-25 22:24:09 +0300
commit1bfca90bf7f099efb28c86131341c3697178b869 (patch)
tree2f2b2ca491049128e26ad0a7d4706798935c8519
parent605a4d4eedb038114076e8bc04d8a0cb205e82f6 (diff)
cntk: 2.2 -> 2.4
Comment for `broken` indicates that it never worked at all, which is strange
since on my machine it did. Anyway it works now for me.
-rw-r--r--pkgs/applications/science/math/cntk/default.nix24
-rw-r--r--pkgs/applications/science/math/cntk/fix_std_bind.patch11
-rw-r--r--pkgs/top-level/all-packages.nix10
-rw-r--r--pkgs/top-level/python-packages.nix7
4 files changed, 34 insertions, 18 deletions
diff --git a/pkgs/applications/science/math/cntk/default.nix b/pkgs/applications/science/math/cntk/default.nix
index bb78fbe235512..b8e3f2e31e12c 100644
--- a/pkgs/applications/science/math/cntk/default.nix
+++ b/pkgs/applications/science/math/cntk/default.nix
@@ -12,28 +12,22 @@ let
   cub = fetchFromGitHub {
     owner = "NVlabs";
     repo = "cub";
-    rev = "1.4.1";
-    sha256 = "1lcdwblz03c0yq1lxndg566kg14b5qm14x5qixjbmz6wq85kgmqc";
+    rev = "1.7.4";
+    sha256 = "0ksd5n1lxqhm5l5cd2lps4cszhjkf6gmzahaycs7nxb06qci8c66";
   };
 
 in stdenv.mkDerivation rec {
   name = "CNTK-${version}";
-  version = "2.2";
+  version = "2.4";
 
   # Submodules
   src = fetchgit {
     url = "https://github.com/Microsoft/CNTK";
     rev = "v${version}";
-    sha256 = "0q4knrwiyphb2fbqf9jzqvkz2jzj6jmbmang3lavdvsh7z0n8zz9";
+    sha256 = "0m28wb0ljixcpi14g3gcfiraimh487yxqhd9yrglgyvjb69x597y";
   };
 
-  patches = [
-    # Fix "'exp' was not declared"
-    (fetchpatch {
-      url = "https://github.com/imriss/CNTK/commit/ef1cca6df95cc507deb8471df2c0dd8cbfeef23b.patch";
-      sha256 = "0z7xyrxwric0c4h7rfs05f544mcq6d10wgs0vvfcyd2pcf410hy7";
-    })
-  ];
+  patches = [ ./fix_std_bind.patch ];
 
   nativeBuildInputs = [ cmake ];
 
@@ -50,6 +44,8 @@ in stdenv.mkDerivation rec {
     "--with-mpi=${openmpi}"
   ] ++ lib.optionals cudaSupport [
     "--cuda=yes"
+    # FIXME
+    "--asgd=no"
     "--with-cuda=${cudatoolkit}"
     "--with-gdk-include=${cudatoolkit}/include"
     "--with-gdk-nvml-lib=${nvidia_x11}/lib"
@@ -85,16 +81,12 @@ in stdenv.mkDerivation rec {
     cp bin/cntk $out/bin
   '';
 
-  hardeningDisable = [ "format" ];
-
-  # on 2.2: fatal error: tensorboard/tensorboard.pb.h: No such file or directory
-  enableParallelBuilding = false;
+  enableParallelBuilding = true;
 
   meta = with lib; {
     homepage = https://github.com/Microsoft/CNTK;
     description = "An open source deep-learning toolkit";
     license = if onebitSGDSupport then licenses.unfreeRedistributable else licenses.mit;
     maintainers = with maintainers; [ abbradar ];
-    broken = true; # Never succeeded to build.
   };
 }
diff --git a/pkgs/applications/science/math/cntk/fix_std_bind.patch b/pkgs/applications/science/math/cntk/fix_std_bind.patch
new file mode 100644
index 0000000000000..df97a0c666695
--- /dev/null
+++ b/pkgs/applications/science/math/cntk/fix_std_bind.patch
@@ -0,0 +1,11 @@
+diff -ru3 CNTK-old/Source/CNTKv2LibraryDll/EvaluatorWrapper.h CNTK-new/Source/CNTKv2LibraryDll/EvaluatorWrapper.h
+--- CNTK-old/Source/CNTKv2LibraryDll/EvaluatorWrapper.h	1970-01-01 03:00:01.000000000 +0300
++++ CNTK-new/Source/CNTKv2LibraryDll/EvaluatorWrapper.h	2018-02-25 18:16:16.330269647 +0300
+@@ -9,6 +9,7 @@
+ #include <boost/noncopyable.hpp>
+ #include <memory>
+ #include <vector>
++#include <functional>
+ 
+ #include "CNTKLibrary.h"
+ #include "CNTKLibraryC.h"
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 9ab44f69eae2e..003882e59afea 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -19744,14 +19744,20 @@ with pkgs;
     inherit (python3Packages) python future six numpy pydot;
     protobuf = protobuf3_1;
     python-protobuf = python3Packages.protobuf3_1;
+    # Used only for image loading.
+    opencv3 = self.opencv3.override {
+      enableCuda = false;
+    };
   };
 
   cntk = callPackage ../applications/science/math/cntk rec {
     cudaSupport = pkgs.config.cudaSupport or false;
     cudnnSupport = cudaSupport;
     inherit (linuxPackages) nvidia_x11;
-    cudatoolkit = cudatoolkit8;
-    cudnn = cudnn6_cudatoolkit8;
+    # Used only for image loading.
+    opencv3 = self.opencv3.override {
+      enableCuda = false;
+    };
   };
 
   ecm = callPackage ../applications/science/math/ecm { };
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 274719e599c86..0a4a4798c7a19 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -2225,6 +2225,7 @@ in {
 
     postPatch = ''
       cd bindings/python
+      sed -i 's,"libmpi.so.12","${pkgs.openmpi}/lib/libmpi.so",g' cntk/train/distributed.py
     '';
 
     postInstall = ''
@@ -2233,6 +2234,12 @@ in {
       # It's not installed for some reason.
       cp cntk/cntk_py.py $out/${python.sitePackages}/cntk
     '';
+
+    # Actual tests are broken.
+    checkPhase = ''
+      cd $NIX_BUILD_TOP
+      ${python.interpreter} -c "import cntk"
+    '';
   };
 
   celery = callPackage ../development/python-modules/celery { pytest = self.pytest_32; };