Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions pkgs/applications/science/math/caffe/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,17 @@ let
# The default for cudatoolkit 10.1 is CUDNN 8.0.5, the last version to support CUDA 10.1.
# However, this caffe does not build with CUDNN 8.x, so we use CUDNN 7.6.5 instead.
# Earlier versions of cudatoolkit use pre-8.x CUDNN, so we use the default.
cudnn = if lib.versionOlder cudatoolkit.version "10.1"
then cudaPackages.cudnn
else cudaPackages.cudnn_7_6;
in

assert leveldbSupport -> (leveldb != null && snappy != null);
assert cudnnSupport -> cudaSupport;
assert ncclSupport -> cudaSupport;
assert pythonSupport -> (python != null && numpy != null);
hasCudnn =
if lib.versionOlder cudatoolkit.version "10.1"
then cudaPackages ? cudnn
else cudaPackages ? cudnn_7_6;

let
toggle = bool: if bool then "ON" else "OFF";

test_model_weights = fetchurl {
url = "http://dl.caffe.berkeleyvision.org/bvlc_reference_caffenet.caffemodel";
sha256 = "472d4a06035497b180636d8a82667129960371375bd10fcb6df5c6c7631f25e0";
};

in

stdenv.mkDerivation rec {
Expand Down Expand Up @@ -74,7 +67,8 @@ stdenv.mkDerivation rec {

buildInputs = [ boost gflags glog protobuf hdf5-cpp opencv4 blas ]
++ lib.optional cudaSupport cudatoolkit
++ lib.optional cudnnSupport cudnn
++ lib.optional (lib.versionOlder cudatoolkit.version "10.1" && hasCudnn) cudaPackages.cudnn
++ lib.optional (lib.versionAtLeast cudatoolkit.version "10.1" && hasCudnn) cudaPackages.cudnn_7_6
++ lib.optional lmdbSupport lmdb
++ lib.optional ncclSupport nccl
++ lib.optionals leveldbSupport [ leveldb snappy ]
Expand Down Expand Up @@ -154,7 +148,14 @@ stdenv.mkDerivation rec {
'';
homepage = "http://caffe.berkeleyvision.org/";
maintainers = with maintainers; [ ];
broken = (pythonSupport && (python.isPy310)) || cudaSupport;
broken =
(pythonSupport && (python.isPy310))
|| cudaSupport
|| !(leveldbSupport -> (leveldb != null && snappy != null))
|| !(cudnnSupport -> (hasCudnn && cudaSupport))
|| !(ncclSupport -> cudaSupport)
|| !(pythonSupport -> (python != null && numpy != null))
;
license = licenses.bsd2;
platforms = platforms.linux ++ platforms.darwin;
};
Expand Down