BKM for caffe android lib - mview/caffe-android-lib GitHub Wiki

- Checkout source code
must add —recursive
git clone —recursive https://github.com/mview/caffe-android-lib.git

- Compile tips
When compiling boost, it downloads boost_1_56_0.tar.bz2 from sourceforge.net. You can download it yourself and copy it to boost directory to void waiting for download file.

- runtime issues you may meet
1. assert error
[syncedmem.cpp:217] Check failed: mapped_ptr == cpu_ptr_ (0 vs. 0×5594faa000) Device claims it support zero copy but failed to create correct user ptr buffer
Reason is clEnqueueMapBuffer() return null pointer, but in my test code, I can’t repo the bug. And in my test case there is no copy performance issue. Just do workaround for it.
[workaround]
change
host_unified_ = host_unified;
to
host_unified_ = 0;
in caffe/src/caffe/device.cpp:58
2. protobuf exception error
terminate called after throwing an instance of ‘google::protobuf::FatalException’
what(): This program was compiled against version 2.6.1 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.0.0). Contact the program author for an update. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in “out/target/product/rk3399_mid/gen/SHARED_LIBRARIES/libGLES_trace_intermediates/proto/frameworks/native/opengl/libs/GLES_trace/proto/gltrace.pb.cc”.)

[workaround]
disable assert error
change
GOOGLE_LOG(FATAL)
to
GOOGLE_LOG(INFO)
in protobuf/src/google/protobuf/stubs/common.cc :79

3. No libOpenCL.so in system directory
Make sure your system support OpenCL. e.g. Mali GPU, you can root system
ln -s /vendor/lib64/egl/libGLES_mali.so /system/lib64/libOpenCL
If you can’t root system,You need use the OpenCL proxy driver. You can add it your apk or put it with your native program and use LD_PRELOAD or LD_LIBRARY_PATH.

⚠️ **GitHub.com Fallback** ⚠️