Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add pybind.h to inference lib for static link #10690

Merged

Conversation

jacquesqiao
Copy link
Member

@jacquesqiao jacquesqiao commented May 16, 2018

task list: #10574

目前我们让用户使用paddle的lib的时候,如果是静态连接的方式,则使用-Wl,--whole-archive的方式进行链接,这样libpaddle_fluid.a中的所有内容都会被连接到目标文件中。

如果提供了pybind.h中的USE_OP的列表,则用户可以不使用-Wl,--whole-archive的方式进行link,而是按照他的需求link一部分op进去,方便做裁剪,好处是用户的二进制会变小,因为只link了lib中的一部分。

相当于给了用户多一种选择。

@jacquesqiao jacquesqiao requested review from luotao1 and Xreki May 16, 2018 06:43
Copy link
Contributor

@luotao1 luotao1 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@Superjomn Superjomn left a comment

Choose a reason for hiding this comment

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

LGTM 后面可以通过操作这个文件实现裁剪

@Xreki
Copy link
Contributor

Xreki commented May 16, 2018

现在的静态库已经不需要使用-Wl,--whole-archive链接了,io.cc里面已经include pybind.h了:

#include "paddle/fluid/pybind/pybind.h"

@Xreki Xreki added the 预测 原名Inference,包含Capi预测问题等 label May 16, 2018
@jacquesqiao
Copy link
Member Author

@Xreki 但是pybind.h不在inference lib里边,直接include会挂,这个pr就是把这个文件拷贝进去的

@jacquesqiao jacquesqiao merged commit 5c58eee into PaddlePaddle:develop May 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
预测 原名Inference,包含Capi预测问题等
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants