summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2019-10-05 16:17:37 +0300
committerNikolay Amiantov <ab@fmap.me>2019-10-05 16:19:08 +0300
commit5f51f818cb55ea589c1fcdb5f8588215f813f5f8 (patch)
tree458afce02a558703b0c5ed0f510cdb33ba857a57 /pkgs
parent72f9bc5d17dc09806a156d64becc2aaeef8d7901 (diff)
cntk: partially unbreak
* Use GCC 7 to unbreak the build;
* Mark CUDA build as broken due to cub incompatibility.

(cherry picked from commit de171ba0c687374bd5694c57ff85c8d29f8aa1f1)
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/science/math/cntk/default.nix19
-rw-r--r--pkgs/top-level/all-packages.nix2
2 files changed, 18 insertions, 3 deletions
diff --git a/pkgs/applications/science/math/cntk/default.nix b/pkgs/applications/science/math/cntk/default.nix
index c20a6954c3cbc..ceb87b25ba85c 100644
--- a/pkgs/applications/science/math/cntk/default.nix
+++ b/pkgs/applications/science/math/cntk/default.nix
@@ -1,7 +1,7 @@
-{ config, lib, stdenv, fetchgit, fetchFromGitHub, cmake
+{ lib, stdenv, fetchgit, fetchFromGitHub, cmake
 , openblas, opencv3, libzip, boost, protobuf, openmpi
 , onebitSGDSupport ? false
-, cudaSupport ? config.cudaSupport or false, cudatoolkit, nvidia_x11
+, cudaSupport ? false, addOpenGLRunpath, cudatoolkit, nvidia_x11
 , cudnnSupport ? cudaSupport, cudnn
 }:
 
@@ -27,7 +27,10 @@ in stdenv.mkDerivation rec {
     sha256 = "18l9k7s966a26ywcf7flqyhm61788pcb9fj3wk61jrmgkhy2pcns";
   };
 
-  nativeBuildInputs = [ cmake ];
+  nativeBuildInputs = [ cmake ] ++ lib.optional cudaSupport addOpenGLRunpath;
+
+  # Force OpenMPI to use g++ in PATH.
+  OMPI_CXX = "g++";
 
   buildInputs = [ openblas opencv3 libzip boost protobuf openmpi ]
              ++ lib.optional cudaSupport cudatoolkit
@@ -69,6 +72,7 @@ in stdenv.mkDerivation rec {
       ln -s ${cudnn}/include cuda
       export configureFlags="$configureFlags --with-cudnn=$PWD"
     ''}
+
     ../configure $configureFlags
   '';
 
@@ -79,9 +83,18 @@ in stdenv.mkDerivation rec {
     cp bin/cntk $out/bin
   '';
 
+  postFixup = lib.optionalString cudaSupport ''
+    for lib in $out/lib/*; do
+      addOpenGLRunpath "$lib"
+    done
+  '';
+
   enableParallelBuilding = true;
 
   meta = with lib; {
+    # Newer cub is included with cudatoolkit now and it breaks the build.
+    # https://github.com/Microsoft/CNTK/issues/3191
+    broken = cudaSupport;
     homepage = https://github.com/Microsoft/CNTK;
     description = "An open source deep-learning toolkit";
     license = if onebitSGDSupport then licenses.unfreeRedistributable else licenses.mit;
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 5f96c3532d689..b9ff1493f1528 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -23333,8 +23333,10 @@ in
   caffeine-ng = callPackage ../tools/X11/caffeine-ng {};
 
   cntk = callPackage ../applications/science/math/cntk {
+    stdenv = gcc7Stdenv;
     inherit (linuxPackages) nvidia_x11;
     opencv3 = opencv3WithoutCuda; # Used only for image loading.
+    cudaSupport = pkgs.config.cudaSupport or false;
   };
 
   ecm = callPackage ../applications/science/math/ecm { };