caffe: depend on opencv3

openblas is used since it's propagated from OpenCV and ATLAS compiled without
architecture-specific optimizations is generally slower than OpenBLAS as I
heard.
This commit is contained in:
Nikolay Amiantov 2018-02-25 20:00:26 +03:00
parent 1bfca90bf7
commit 25079ad238
2 changed files with 14 additions and 7 deletions

View File

@ -7,11 +7,11 @@
, hdf5-cpp
, leveldb
, lmdb
, opencv
, opencv3
, protobuf
, snappy
, atlas
, doxygen
, openblas
, cudaSupport ? true, cudatoolkit
, cudnnSupport ? false, cudnn ? null
, pythonSupport ? false, python ? null, numpy ? null
@ -35,12 +35,15 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ cmake doxygen ];
cmakeFlags = [
"-DCUDA_ARCH_NAME=All"
(if pythonSupport then "-Dpython_version=${python.version}" else "-DBUILD_python=OFF")
] ++ lib.optional (!cudaSupport) "-DCPU_ONLY=ON";
cmakeFlags =
[ (if pythonSupport then "-Dpython_version=${python.version}" else "-DBUILD_python=OFF")
"-DBLAS=open"
] ++ (if cudaSupport then [
"-DCUDA_ARCH_NAME=All"
"-DCUDA_HOST_COMPILER=${cudatoolkit.cc}/bin/cc"
] else [ "-DCPU_ONLY=ON" ]);
buildInputs = [ boost google-gflags glog protobuf hdf5-cpp lmdb leveldb snappy opencv atlas ]
buildInputs = [ boost google-gflags glog protobuf hdf5-cpp lmdb leveldb snappy opencv3 openblas ]
++ lib.optional cudaSupport cudatoolkit
++ lib.optional cudnnSupport cudnn
++ lib.optionals pythonSupport [ python numpy ];

View File

@ -19737,6 +19737,10 @@ with pkgs;
caffe = callPackage ../applications/science/math/caffe rec {
cudaSupport = config.caffe.cudaSupport or config.cudaSupport or false;
cudnnSupport = cudaSupport;
# Used only for image loading.
opencv3 = self.opencv3.override {
enableCuda = false;
};
};
caffe2 = callPackage ../development/libraries/science/math/caffe2 {