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