Skip to content

Conversation

@NHZlX
Copy link
Contributor

@NHZlX NHZlX commented Oct 9, 2017

fix #4542

A new "lite" generator parameter was introduced in the protoc(version > 3) for C++ and
Java messages. Example usage:

./protoc --cpp_out=lite:$OUTPUT_PATH foo.proto

so, so we can set MOBILE_INFERENCE in cmake to decide whether or not to use the lite mode in protobuf.

We did test Under this condition

arm-v7a CMAKE_BUILD_TYPE='MinSizeRel'

  • Before optimize
Library size(kB)
libpaddle_capi_shared.so 7515
libpaddle_capi_shared.so(strip) 2553
libpaddle_capi_whole.a 14418
  • After optimize
Library size(kB)
libpaddle_capi_shared.so 6556
libpaddle_capi_shared.so(strip) 1869
libpaddle_capi_whole.a 12628

@hedaoyuan
Copy link
Contributor

Can avoid modifying proto files? Here are some similar discussions.

@Xreki
Copy link
Contributor

Xreki commented Oct 11, 2017

Need to change the linking library here from PROTOBUF_LIBRARY to PROTOBUF_LITE_LIBRARY. And use make VERBOSE=1 to confirm which library you are linking.

@hedaoyuan
Copy link
Contributor

Actually, even the link PROTOBUF_LIBRARY library will only link to the LITE part of it.

Copy link
Contributor

@hedaoyuan hedaoyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

补充一个优化前后的size变化数据吧。

@NHZlX NHZlX merged commit 2002c78 into PaddlePaddle:develop Oct 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Question about using the message-lite in Paddle

3 participants