Skip to content

Commit

Permalink
Update presets for Caffe (BVLC/caffe@42cd785) and make it work on CPU…
Browse files Browse the repository at this point in the history
…-only machines (issue #219)
  • Loading branch information
saudet committed Jul 31, 2016
1 parent dbbb313 commit d32a104
Show file tree
Hide file tree
Showing 7 changed files with 1,065 additions and 67 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@

* Make Caffe work on CPU-only machines ([issue #219](https://github.com/bytedeco/javacpp-presets/issues/219))
* Fix loading issue with `opencv_face` ([issue bytedeco/javacv#470](https://github.com/bytedeco/javacv/issues/470)
* Fix presets for CUDA 7.5 on the `linux-ppc64le` platform
* Upgrade presets for TensorFlow 0.9.0
* Upgrade presets for Caffe, TensorFlow 0.9.0
* Set default options in `tensorflow/cppbuild.sh` to prevent console reads during build
* Add `Tensor.createStringArray()` method to access `DT_STRING` data ([issue #249](https://github.com/bytedeco/javacpp-presets/issues/249))
* Fix Javadoc links for externally referenced classes
Expand Down
8 changes: 4 additions & 4 deletions caffe/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Introduction
------------
This directory contains the JavaCPP Presets module for:

* Caffe 1.0-rc3 http://caffe.berkeleyvision.org/
* Caffe http://caffe.berkeleyvision.org/

Please refer to the parent README.md file for more detailed information about the JavaCPP Presets.

Expand Down Expand Up @@ -42,7 +42,7 @@ We can use [Maven 3](http://maven.apache.org/) to download and install automatic
<dependency>
<groupId>org.bytedeco.javacpp-presets</groupId>
<artifactId>caffe</artifactId>
<version>rc3-1.2</version>
<version>master-1.2</version>
</dependency>
</dependencies>
</project>
Expand Down Expand Up @@ -253,9 +253,9 @@ public class caffe {
solver.Solve(snapshot);
} else if (weights.length() > 0) {
CopyLayers(solver, weights);
solver.Solve((String)null);
solver.Solve();
} else {
solver.Solve((String)null);
solver.Solve();
}
logger.info("Optimization Done.");
return 0;
Expand Down
27 changes: 27 additions & 0 deletions caffe/caffe-nogpu.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
diff -ruN caffe-master/include/caffe/util/device_alternate.hpp caffe-master-nogpu/include/caffe/util/device_alternate.hpp
--- caffe-master/include/caffe/util/device_alternate.hpp 2016-06-18 08:35:07.000000000 +0900
+++ caffe-master-nogpu/include/caffe/util/device_alternate.hpp 2016-07-31 17:37:38.000000000 +0900
@@ -49,20 +49,20 @@
/* Code block avoids redefinition of cudaError_t error */ \
do { \
cudaError_t error = condition; \
- CHECK_EQ(error, cudaSuccess) << " " << cudaGetErrorString(error); \
+ LOG_IF(ERROR, error != cudaSuccess) << " " << cudaGetErrorString(error); \
} while (0)

#define CUBLAS_CHECK(condition) \
do { \
cublasStatus_t status = condition; \
- CHECK_EQ(status, CUBLAS_STATUS_SUCCESS) << " " \
+ LOG_IF(ERROR, status != CUBLAS_STATUS_SUCCESS) << " " \
<< caffe::cublasGetErrorString(status); \
} while (0)

#define CURAND_CHECK(condition) \
do { \
curandStatus_t status = condition; \
- CHECK_EQ(status, CURAND_STATUS_SUCCESS) << " " \
+ LOG_IF(ERROR, status != CURAND_STATUS_SUCCESS) << " " \
<< caffe::curandGetErrorString(status); \
} while (0)

7 changes: 4 additions & 3 deletions caffe/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ PROTO=2.6.1
LEVELDB=1.18
SNAPPY=1.1.3
LMDB=0.9.18
BOOST=1_59_0
HDF5=1.8.16
BOOST=1_61_0
HDF5=1.8.17
OPENBLAS=0.2.18
CAFFE_VERSION=rc3
CAFFE_VERSION=master

download https://github.com/google/glog/archive/v$GLOG.tar.gz glog-$GLOG.tar.gz
download https://github.com/gflags/gflags/archive/v$GFLAGS.tar.gz gflags-$GFLAGS.tar.gz
Expand Down Expand Up @@ -145,6 +145,7 @@ if [[ $BLAS == "open" ]]; then
fi

cd caffe-$CAFFE_VERSION
patch -Np1 < ../../../caffe-nogpu.patch
cp Makefile.config.example Makefile.config
export PATH=../bin:$PATH
export CXXFLAGS="-I../include -I$OPENCV_PATH/include"
Expand Down
2 changes: 1 addition & 1 deletion caffe/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>org.bytedeco.javacpp-presets</groupId>
<artifactId>caffe</artifactId>
<version>rc3-${project.parent.version}</version>
<version>master-${project.parent.version}</version>
<packaging>jar</packaging>
<name>JavaCPP Presets for Caffe</name>

Expand Down
Loading

0 comments on commit d32a104

Please sign in to comment.