|
26 | 26 | # The default for cudatoolkit 10.1 is CUDNN 8.0.5, the last version to support CUDA 10.1. |
27 | 27 | # However, this caffe does not build with CUDNN 8.x, so we use CUDNN 7.6.5 instead. |
28 | 28 | # Earlier versions of cudatoolkit use pre-8.x CUDNN, so we use the default. |
29 | | - cudnn = if lib.versionOlder cudatoolkit.version "10.1" |
30 | | - then cudaPackages.cudnn |
31 | | - else cudaPackages.cudnn_7_6; |
32 | | -in |
33 | | - |
34 | | -assert leveldbSupport -> (leveldb != null && snappy != null); |
35 | | -assert cudnnSupport -> cudaSupport; |
36 | | -assert ncclSupport -> cudaSupport; |
37 | | -assert pythonSupport -> (python != null && numpy != null); |
| 29 | + hasCudnn = |
| 30 | + if lib.versionOlder cudatoolkit.version "10.1" |
| 31 | + then cudaPackages ? cudnn |
| 32 | + else cudaPackages ? cudnn_7_6; |
38 | 33 |
|
39 | | -let |
40 | 34 | toggle = bool: if bool then "ON" else "OFF"; |
41 | 35 |
|
42 | 36 | test_model_weights = fetchurl { |
43 | 37 | url = "http://dl.caffe.berkeleyvision.org/bvlc_reference_caffenet.caffemodel"; |
44 | 38 | sha256 = "472d4a06035497b180636d8a82667129960371375bd10fcb6df5c6c7631f25e0"; |
45 | 39 | }; |
46 | | - |
47 | 40 | in |
48 | 41 |
|
49 | 42 | stdenv.mkDerivation rec { |
@@ -74,7 +67,8 @@ stdenv.mkDerivation rec { |
74 | 67 |
|
75 | 68 | buildInputs = [ boost gflags glog protobuf hdf5-cpp opencv4 blas ] |
76 | 69 | ++ lib.optional cudaSupport cudatoolkit |
77 | | - ++ lib.optional cudnnSupport cudnn |
| 70 | + ++ lib.optional (lib.versionOlder cudatoolkit.version "10.1" && hasCudnn) cudaPackages.cudnn |
| 71 | + ++ lib.optional (lib.versionAtLeast cudatoolkit.version "10.1" && hasCudnn) cudaPackages.cudnn_7_6 |
78 | 72 | ++ lib.optional lmdbSupport lmdb |
79 | 73 | ++ lib.optional ncclSupport nccl |
80 | 74 | ++ lib.optionals leveldbSupport [ leveldb snappy ] |
@@ -154,7 +148,14 @@ stdenv.mkDerivation rec { |
154 | 148 | ''; |
155 | 149 | homepage = "http://caffe.berkeleyvision.org/"; |
156 | 150 | maintainers = with maintainers; [ ]; |
157 | | - broken = (pythonSupport && (python.isPy310)) || cudaSupport; |
| 151 | + broken = |
| 152 | + (pythonSupport && (python.isPy310)) |
| 153 | + || cudaSupport |
| 154 | + || !(leveldbSupport -> (leveldb != null && snappy != null)) |
| 155 | + || !(cudnnSupport -> (hasCudnn && cudaSupport)) |
| 156 | + || !(ncclSupport -> cudaSupport) |
| 157 | + || !(pythonSupport -> (python != null && numpy != null)) |
| 158 | + ; |
158 | 159 | license = licenses.bsd2; |
159 | 160 | platforms = platforms.linux ++ platforms.darwin; |
160 | 161 | }; |
|
0 commit comments