about summary refs log tree commit diff
path: root/pkgs/applications/science/math/mxnet/default.nix
blob: d2f3d0c5f33748ad5b5adf6fe8e2497ab4fc76dc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{ stdenv, lib, fetchgit, cmake
, opencv, gtest, openblas, liblapack
, cudaSupport ? false, cudatoolkit, nvidia_x11
, cudnnSupport ? false, cudnn
}:

assert cudnnSupport -> cudaSupport;

stdenv.mkDerivation rec {
  name = "mxnet-${version}";
  version = "0.11.0";

  # Submodules needed
  src = fetchgit {
    url = "https://github.com/apache/incubator-mxnet";
    rev = "refs/tags/${version}";
    sha256 = "1qgns0c70a1gfyil96h17ms736nwdkp9kv496gvs9pkzqzvr6cpz";
  };

  nativeBuildInputs = [ cmake ];

  buildInputs = [ opencv gtest openblas liblapack ]
              ++ lib.optionals cudaSupport [ cudatoolkit nvidia_x11 ]
              ++ lib.optional cudnnSupport cudnn;

  cmakeFlags = [
    (if cudaSupport then "-DCUDA_ARCH_NAME=All" else "-DUSE_CUDA=OFF")
  ] ++ lib.optional (!cudnnSupport) "-DUSE_CUDNN=OFF";

  installPhase = ''
    install -Dm755 libmxnet.so $out/lib/libmxnet.so
    cp -r ../include $out
  '';

  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;
  };
}