forked from mirrors/nixpkgs
4a7f99d55d
Part of: https://github.com/NixOS/nixpkgs/issues/108938 meta = with stdenv.lib; is a widely used pattern. We want to slowly remove the `stdenv.lib` indirection and encourage people to use `lib` directly. Thus let’s start with the meta field. This used a rewriting script to mostly automatically replace all occurances of this pattern, and add the `lib` argument to the package header if it doesn’t exist yet. The script in its current form is available at https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
54 lines
1.7 KiB
Nix
54 lines
1.7 KiB
Nix
{ config, stdenv, lib, fetchurl, bash, cmake
|
|
, opencv3, gtest, blas, perl
|
|
, cudaSupport ? config.cudaSupport or false, cudatoolkit, nvidia_x11
|
|
, cudnnSupport ? cudaSupport, cudnn
|
|
}:
|
|
|
|
assert cudnnSupport -> cudaSupport;
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "mxnet";
|
|
version = "1.6.0";
|
|
|
|
src = fetchurl {
|
|
url = "https://github.com/apache/incubator-mxnet/releases/download/${version}/apache-mxnet-src-${version}-incubating.tar.gz";
|
|
sha256 = "1vvdb7pfh63kb9fzs6gqp95q550a3ck4cj9mqxlk9wwhkh30dsq1";
|
|
};
|
|
|
|
nativeBuildInputs = [ cmake perl ];
|
|
|
|
buildInputs = [ opencv3 gtest blas.provider ]
|
|
++ 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
|
|
'';
|
|
|
|
meta = with 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;
|
|
};
|
|
}
|