1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-24 10:56:56 +00:00
nixpkgs/pkgs/applications/science/math/mxnet/default.nix
2019-06-02 21:50:06 +03:00

56 lines
1.7 KiB
Nix

{ config, stdenv, lib, fetchurl, bash, cmake
, opencv3, gtest, openblas, liblapack, perl
, cudaSupport ? config.cudaSupport or false, cudatoolkit, nvidia_x11
, cudnnSupport ? cudaSupport, cudnn
}:
assert cudnnSupport -> cudaSupport;
stdenv.mkDerivation rec {
name = "mxnet-${version}";
version = "1.4.1";
src = fetchurl {
url = "https://github.com/apache/incubator-mxnet/releases/download/${version}/apache-mxnet-src-${version}-incubating.tar.gz";
sha256 = "1d0lhlpdaxycjzpwwrpgjd3v2q2ka89v5rr13ddxayy7ld2hxiaj";
};
nativeBuildInputs = [ cmake perl ];
buildInputs = [ opencv3 gtest openblas liblapack ]
++ lib.optionals cudaSupport [ cudatoolkit nvidia_x11 ]
++ lib.optional cudnnSupport cudnn;
cmakeFlags =
[ "-DUSE_MKL_IF_AVAILABLE=OFF" ]
++ (if cudaSupport then [
"-DUSE_OLDCMAKECUDA=ON" # see https://github.com/apache/incubator-mxnet/issues/10743
"-DCUDA_ARCH_NAME=All"
"-DCUDA_HOST_COMPILER=${cudatoolkit.cc}/bin/cc"
] else [ "-DUSE_CUDA=OFF" ])
++ lib.optional (!cudnnSupport) "-DUSE_CUDNN=OFF";
postPatch = ''
substituteInPlace 3rdparty/mkldnn/tests/CMakeLists.txt \
--replace "/bin/bash" "${bash}/bin/bash"
# Build against the system version of OpenMP.
# https://github.com/apache/incubator-mxnet/pull/12160
rm -rf 3rdparty/openmp
'';
postInstall = ''
rm "$out"/lib/*.a
'';
enableParallelBuilding = true;
meta = with stdenv.lib; {
description = "Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler";
homepage = https://mxnet.incubator.apache.org/;
maintainers = with maintainers; [ abbradar ];
license = licenses.asl20;
platforms = platforms.linux;
};
}