at v192 70 lines 1.9 kB view raw
1{ stdenv 2, openblas 3, boost 4, cudaSupport ? true 5, cudnnSupport ? false 6, cudnn ? null 7, cudatoolkit7 8, fetchFromGitHub 9, google-gflags 10, glog 11, hdf5 12, leveldb 13, lmdb 14, opencv 15, protobuf 16, snappy 17}: 18 19 20let optional = stdenv.lib.optional; 21in stdenv.mkDerivation rec { 22 # Use git revision because latest "release" is really old 23 name = "caffe-git-2015-07-02"; 24 25 src = fetchFromGitHub { 26 owner = "BVLC"; 27 repo = "caffe"; 28 rev = "77d66dfc907dd875d69bb9fc12dd950b531e464f"; 29 sha256 = "0vd4qrc49dhsawj298xpkd5mvi35sh56kdswx3yp8ya4fjajwakx"; 30 }; 31 32 preConfigure = "mv Makefile.config.example Makefile.config"; 33 34 makeFlags = "BLAS=open " + 35 (if !cudaSupport then "CPU_ONLY=1 " else "CUDA_DIR=${cudatoolkit7} ") + 36 (if cudnnSupport then "USE_CUDNN=1 " else ""); 37 38 # too many issues with tests to run them for now 39 doCheck = false; 40 checkPhase = "make runtest ${makeFlags}"; 41 42 buildInputs = [ openblas boost google-gflags glog hdf5 leveldb lmdb opencv 43 protobuf snappy ] 44 ++ optional cudaSupport cudatoolkit7 45 ++ optional cudnnSupport cudnn; 46 47 installPhase = '' 48 mkdir -p $out/{bin,share,lib} 49 for bin in $(find build/tools -executable -type f -name '*.bin'); 50 do 51 cp $bin $out/bin/$(basename $bin .bin) 52 done 53 54 cp -r build/examples $out/share 55 cp -r build/lib $out 56 ''; 57 58 meta = with stdenv.lib; { 59 description = "Deep learning framework"; 60 longDescription = '' 61 Caffe is a deep learning framework made with expression, speed, and 62 modularity in mind. It is developed by the Berkeley Vision and Learning 63 Center (BVLC) and by community contributors. 64 ''; 65 homepage = http://caffe.berkeleyvision.org/; 66 maintainers = with maintainers; [ jb55 ]; 67 license = licenses.bsd2; 68 platforms = platforms.linux; 69 }; 70}