2019-02-03 16:32:14 +01:00
|
|
|
{ config, stdenv, lib, fetchurl, bash, cmake
|
2020-03-31 16:47:18 +02:00
|
|
|
, opencv3, gtest, blas, perl
|
2019-02-03 16:32:14 +01:00
|
|
|
, cudaSupport ? config.cudaSupport or false, cudatoolkit, nvidia_x11
|
|
|
|
, cudnnSupport ? cudaSupport, cudnn
|
2017-09-16 03:39:25 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
assert cudnnSupport -> cudaSupport;
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "mxnet";
|
2020-04-01 17:46:17 +02:00
|
|
|
version = "1.6.0";
|
2018-09-04 11:37:54 +02:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/apache/incubator-mxnet/releases/download/${version}/apache-mxnet-src-${version}-incubating.tar.gz";
|
2020-04-01 17:46:17 +02:00
|
|
|
sha256 = "1vvdb7pfh63kb9fzs6gqp95q550a3ck4cj9mqxlk9wwhkh30dsq1";
|
2017-09-16 03:39:25 +02:00
|
|
|
};
|
|
|
|
|
2018-09-04 11:37:54 +02:00
|
|
|
nativeBuildInputs = [ cmake perl ];
|
2017-09-16 03:39:25 +02:00
|
|
|
|
2020-05-06 19:23:32 +02:00
|
|
|
buildInputs = [ opencv3 gtest blas.provider ]
|
2017-09-17 18:35:47 +02:00
|
|
|
++ lib.optionals cudaSupport [ cudatoolkit nvidia_x11 ]
|
2017-09-16 03:39:25 +02:00
|
|
|
++ lib.optional cudnnSupport cudnn;
|
|
|
|
|
2018-02-25 18:02:20 +01:00
|
|
|
cmakeFlags =
|
2019-06-02 19:11:58 +02:00
|
|
|
[ "-DUSE_MKL_IF_AVAILABLE=OFF" ]
|
|
|
|
++ (if cudaSupport then [
|
2019-04-12 12:31:22 +02:00
|
|
|
"-DUSE_OLDCMAKECUDA=ON" # see https://github.com/apache/incubator-mxnet/issues/10743
|
2018-02-25 18:02:20 +01: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 03:39:25 +02:00
|
|
|
|
2018-09-04 11:37:54 +02:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace 3rdparty/mkldnn/tests/CMakeLists.txt \
|
|
|
|
--replace "/bin/bash" "${bash}/bin/bash"
|
2018-09-04 20:27:25 +02:00
|
|
|
|
2020-03-31 16:47:18 +02:00
|
|
|
# Build against the system version of OpenMP.
|
2018-09-04 20:27:25 +02:00
|
|
|
# https://github.com/apache/incubator-mxnet/pull/12160
|
|
|
|
rm -rf 3rdparty/openmp
|
2018-09-04 11:37:54 +02:00
|
|
|
'';
|
|
|
|
|
2018-09-04 20:27:25 +02:00
|
|
|
postInstall = ''
|
|
|
|
rm "$out"/lib/*.a
|
2017-09-16 03:39:25 +02:00
|
|
|
'';
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2017-09-16 03:39:25 +02:00
|
|
|
description = "Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler";
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://mxnet.incubator.apache.org/";
|
2017-09-16 03:39:25 +02:00
|
|
|
maintainers = with maintainers; [ abbradar ];
|
|
|
|
license = licenses.asl20;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|