Skip to content
This repository has been archived by the owner on Feb 20, 2020. It is now read-only.

Very slow, use new version caffe2 #31

Open
northeastsquare opened this issue Jul 25, 2017 · 5 comments
Open

Very slow, use new version caffe2 #31

northeastsquare opened this issue Jul 25, 2017 · 5 comments

Comments

@northeastsquare
Copy link

northeastsquare commented Jul 25, 2017

  1. I clone new caffe2, compile a cpu version, and have:
    libCaffe2_CPU.a libCAFFE2_NNPACK.a libCAFFE2_PTHREADPOOL.a libcpufeatures.a
  2. create script.ar:
    CREATE libcaffe2.a
    ADDLIB libCAFFE2_NNPACK.a
    ADDLIB libCAFFE2_PTHREADPOOL.a
    ADDLIB libcpufeatures.a
    ADDLIB libCaffe2_CPU.a
    SAVE
    END
  3. ar -M < script.ar
    4.replace AICamera libcaffe2.a with the generated libcaffe2.a
    5.in AICamera2/app/src/main/cpp, make a soft link to the new caffe2 source code, copy some proto.pb.h files
    7.run with android studio

the result, speed very slow, Can you give me help? Where am I wrong?
@bwasti

@northeastsquare
Copy link
Author

By the way , recogition result not correct

@northeastsquare
Copy link
Author

northeastsquare commented Jul 26, 2017

the size libcaffe2 which I use build_android.sh:
302257934
while you provide is :
31855028
nearly 10 times, why?

@northeastsquare
Copy link
Author

northeastsquare commented Jul 26, 2017

below is the cmake summary:

Summary
-- General:
-- Git version :
-- System : Android
-- C++ compiler : /usr/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++
-- C++ compiler version : 4.9
-- Protobuf compiler : /home/xchen/src/caffe2/build_host_protoc/bin/protoc
-- CXX flags : -fexceptions -frtti -Wno-psabi --sysroot=/usr/android-ndk-r10e/platforms/android-21/arch-arm -funwind-tables -finline-limit=64 -fsigned-char -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=neon -fdata-sections -ffunction-sections -Wa,--noexecstack -Wno-deprecated -std=c++11 -fPIC -Wno-narrowing
-- Build type : Release
-- Compile definitions : ;ANDROID;CAFFE2_USE_EIGEN_FOR_BLAS;EIGEN_MPL2_ONLY;CAFFE2_UNIQUE_LONG_TYPEMETA;CAFFE2_NO_BUILTIN_CPU_SUPPORTS

-- BUILD_SHARED_LIBS : OFF
-- BUILD_PYTHON : OFF
-- Python version :
-- Python library :
-- BUILD_TEST : OFF
-- USE_CUDA : OFF
-- USE_NERVANA_GPU : OFF
-- USE_GLOG : OFF
-- USE_GFLAGS : OFF
-- USE_LMDB : OFF
-- USE_LEVELDB : OFF
-- USE_OPENCV : OFF
-- USE_FFMPEG :
-- USE_ZMQ : OFF
-- USE_ROCKSDB : OFF
-- USE_MPI : OFF
-- USE_NCCL : OFF
-- USE_NNPACK : ON
-- USE_OPENMP : OFF
-- USE_REDIS : OFF
-- USE_GLOO : OFF
-- Configuring done

@lhCheung1991
Copy link

I got the same problem @northeastsquare

@bwasti
Copy link
Contributor

bwasti commented Aug 1, 2017

You're going to want to compile with -O3, let me add that to the CMakeLists in caffe2 :)

To do so yourself right now, edit this line to say

  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O3 -fPIC")

edit: waiting on tests to pass here facebookarchive/caffe2#1000

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants