From de171ba0c687374bd5694c57ff85c8d29f8aa1f1 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Sat, 5 Oct 2019 16:17:37 +0300 Subject: [PATCH] cntk: partially unbreak * Use GCC 7 to unbreak the build; * Mark CUDA build as broken due to cub incompatibility. --- .../science/math/cntk/default.nix | 19 ++++++++++++++++--- pkgs/top-level/all-packages.nix | 2 ++ 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 c20a6954c3cb..ceb87b25ba85 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 6ddfef431abd..f23a3f8e1557 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -23554,8 +23554,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 { };