-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
compile and install the shared library of fluid inference #7572
Changes from all commits
3cf23be
816e556
984d09c
c0f0f23
2be7cf9
3635388
c96b7e8
fc75da7
5f202db
a12db45
f1c4c80
c0da87f
5c05653
acb13e7
8b442e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,28 @@ | ||
set(FLUID_CORE_MODULES | ||
backward proto_desc paddle_memory executor prune init ${GLOB_OP_LIB}) | ||
set(FLUID_CORE_MODULES proto_desc paddle_memory executor prune init) | ||
|
||
cc_library(paddle_fluid_api | ||
SRCS inference.cc | ||
DEPS ${FLUID_CORE_MODULES}) | ||
DEPS ${FLUID_CORE_MODULES} ${GLOB_OP_LIB}) | ||
|
||
# Merge all modules into a simgle static library | ||
cc_library(paddle_fluid DEPS paddle_fluid_api ${FLUID_CORE_MODULES}) | ||
# Merge all modules into a single static library | ||
cc_library(paddle_fluid DEPS paddle_fluid_api ${FLUID_CORE_MODULES} ${GLOB_OP_LIB}) | ||
|
||
# Create shared library | ||
add_library(paddle_fluid_shared SHARED inference.cc) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shared library不能直接叫 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 考虑到两点:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 一个是静态库,一个是动态库,名字也不能一样? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 比如,如果按照下面这样写:
cmake会报错:
不过能不能先编译出来,然后再在cmake里面改成一样的名字。 |
||
|
||
target_circle_link_libraries(paddle_fluid_shared | ||
ARCHIVE_START | ||
${GLOB_OP_LIB} | ||
ARCHIVE_END | ||
${FLUID_CORE_MODULES}) | ||
|
||
SET_TARGET_PROPERTIES(paddle_fluid_shared PROPERTIES OUTPUT_NAME paddle_fluid) | ||
|
||
# install library & headers | ||
if(NOT WITH_C_API AND WITH_FLUID) | ||
install(FILES inference.h DESTINATION include/paddle/inference) | ||
install(TARGETS paddle_fluid_shared DESTINATION lib) | ||
endif() | ||
|
||
add_executable(example example.cc) | ||
if(APPLE) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
cc_library(stringpiece SRCS piece.cc) | ||
cc_test(stringpiece_test SRCS piece_test.cc DEPS stringpiece glog gflags) | ||
|
||
cc_test(stringprintf_test SRCS printf_test.cc DEPS glog gflags) | ||
cc_test(to_string_test SRCS to_string_test.cc) | ||
|
||
if(NOT WITH_C_API AND WITH_FLUID) | ||
file(GLOB STRING_HEADERS *.h) | ||
install(FILES ${STRING_HEADERS} DESTINATION include/paddle/string) | ||
install(FILES tinyformat/tinyformat.h DESTINATION include/paddle/string/tinyformat) | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we rename WITH_C_API into PADDLE_BUILD_INFERENCE_LIB ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As WITH_C_API is used for a long time in old PaddlePaddle, users are familiar with it, we may remain it. And for fluid, we will add WITH_FLUID option for both training and inference. (see #7578 (comment))