summary refs log tree commit diff
path: root/pkgs/applications/science/math/cntk/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/science/math/cntk/default.nix')
-rw-r--r--pkgs/applications/science/math/cntk/default.nix19
1 files changed, 16 insertions, 3 deletions
diff --git a/pkgs/applications/science/math/cntk/default.nix b/pkgs/applications/science/math/cntk/default.nix
index c20a6954c3c..ceb87b25ba8 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;