caffe2 icon indicating copy to clipboard operation
caffe2 copied to clipboard

android lib libcaffe2.a is 627.6M, what is wrong?

Open wguo1983 opened this issue 6 years ago • 13 comments

the android lib libcaffe2.a

old version is 55M, the model run time is 10s in android. now the newest version is 627M, the same model run time is 20s.

what is wrong?

wguo1983 avatar Mar 02 '18 10:03 wguo1983

Assigning a few folks to take a look - possibly due to additional dependencies we introduced (such as ACL)?

Yangqing avatar Mar 02 '18 20:03 Yangqing

(Also, it is possible it's due to the removal of "-s", cc @Maratyszcza

Yangqing avatar Mar 02 '18 20:03 Yangqing

what build command did you use?

jerryzh168 avatar Mar 02 '18 22:03 jerryzh168

@jerryzh168

./scripts/build_android.sh

wguo1983 avatar Mar 03 '18 01:03 wguo1983

There were two separate issues which during the week that could have this effect: we accidentally disabled NEON in ARMv7 builds, and disabled stripping binaries. Both should we be fixed on master now.

Maratyszcza avatar Mar 04 '18 04:03 Maratyszcza

@Maratyszcza

i get the newest code, but the new size of libcaffe2.a is 636.6M.

wguo1983 avatar Mar 05 '18 01:03 wguo1983

Because object files (.o) are not stripped, libcaffe2.a is just a collection of object files.

freedomtan avatar Mar 07 '18 01:03 freedomtan

@freedomtan How to strip the .o files?

wguo1983 avatar Mar 16 '18 04:03 wguo1983

I meet the same problem, how can I stripe the libcaffe2.a?

dongwflj avatar Mar 27 '18 03:03 dongwflj

@wguo1983: add strip to build rule of .o maybe? @dongwflj: you should strip .o before creating .a, I think

freedomtan avatar Mar 28 '18 07:03 freedomtan

@freedomtan @dongwflj I fix it, delete the "-g" option in gcc in android-ndk "android.toolchain.cmake".

wguo1983 avatar Mar 28 '18 09:03 wguo1983

according to the following thread, you can also add this line into build_andoroid.sh

CMAKE_ARGS+=("-DCMAKE_CXX_FLAGS_RELEASE=-g0")

https://github.com/android-ndk/ndk/issues/243

yamsam avatar Mar 29 '18 00:03 yamsam

@yamsam it is work, thank you!

wguo1983 avatar Mar 29 '18 12:03 wguo1983