2018-09-04 10:37:54 +01:00
|
|
|
{ stdenv, lib, fetchurl, bash, cmake
|
|
|
|
, opencv, gtest, openblas, liblapack, perl
|
2017-09-17 17:35:47 +01:00
|
|
|
, cudaSupport ? false, cudatoolkit, nvidia_x11
|
2017-09-16 02:39:25 +01:00
|
|
|
, cudnnSupport ? false, cudnn
|
|
|
|
}:
|
|
|
|
|
|
|
|
assert cudnnSupport -> cudaSupport;
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "mxnet-${version}";
|
2018-09-04 10:37:54 +01:00
|
|
|
version = "1.2.1";
|
|
|
|
|
|
|
|
# Fetching from git does not work at the time (1.2.1) due to an
|
|
|
|
# incorrect hash in one of the submodules. The provided tarballs
|
|
|
|
# contain all necessary sources.
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/apache/incubator-mxnet/releases/download/${version}/apache-mxnet-src-${version}-incubating.tar.gz";
|
|
|
|
sha256 = "053zbdgs4j8l79ipdz461zc7wyfbfcflmi5bw7lj2q08zm1glnb2";
|
2017-09-16 02:39:25 +01:00
|
|
|
};
|
|
|
|
|
2018-09-04 10:37:54 +01:00
|
|
|
nativeBuildInputs = [ cmake perl ];
|
2017-09-16 02:39:25 +01:00
|
|
|
|
|
|
|
buildInputs = [ opencv gtest openblas liblapack ]
|
2017-09-17 17:35:47 +01:00
|
|
|
++ lib.optionals cudaSupport [ cudatoolkit nvidia_x11 ]
|
2017-09-16 02:39:25 +01:00
|
|
|
++ lib.optional cudnnSupport cudnn;
|
|
|
|
|
2018-02-25 17:02:20 +00:00
|
|
|
cmakeFlags =
|
|
|
|
(if cudaSupport then [
|
|
|
|
"-DCUDA_ARCH_NAME=All"
|
|
|
|
"-DCUDA_HOST_COMPILER=${cudatoolkit.cc}/bin/cc"
|
|
|
|
] else [ "-DUSE_CUDA=OFF" ])
|
|
|
|
++ lib.optional (!cudnnSupport) "-DUSE_CUDNN=OFF";
|
2017-09-16 02:39:25 +01:00
|
|
|
|
2018-09-04 10:37:54 +01:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace 3rdparty/mkldnn/tests/CMakeLists.txt \
|
|
|
|
--replace "/bin/bash" "${bash}/bin/bash"
|
2018-09-04 19:27:25 +01:00
|
|
|
|
|
|
|
# Build against the system version of OpenMP.
|
|
|
|
# https://github.com/apache/incubator-mxnet/pull/12160
|
|
|
|
rm -rf 3rdparty/openmp
|
2018-09-04 10:37:54 +01:00
|
|
|
'';
|
|
|
|
|
2018-09-04 19:27:25 +01:00
|
|
|
postInstall = ''
|
|
|
|
rm "$out"/lib/*.a
|
2017-09-16 02:39:25 +01: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 02:39:25 +01:00
|
|
|
maintainers = with maintainers; [ abbradar ];
|
|
|
|
license = licenses.asl20;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|