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

compile and install the static library of fluid inference #7827

Merged
merged 18 commits into from
Mar 7, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/external/openblas.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ IF(NOT ${CBLAS_FOUND})
CONFIGURE_COMMAND ""
)
SET(CBLAS_PROVIDER openblas)
IF(WITH_C_API)
IF(WITH_C_API OR WITH_FLUID)
INSTALL(DIRECTORY ${CBLAS_INC_DIR} DESTINATION third_party/openblas)
# Because libopenblas.a is a symbolic link of another library, thus need to
# install the whole directory.
Expand Down
16 changes: 14 additions & 2 deletions paddle/inference/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,20 @@ cc_library(paddle_fluid_api
SRCS inference.cc
DEPS ${FLUID_CORE_MODULES} ${GLOB_OP_LIB})

if(WITH_GPU)
set(GPU_DEPS gpu_info dynload_cuda)
endif()
# Merge all modules into a single static library
cc_library(paddle_fluid DEPS paddle_fluid_api ${FLUID_CORE_MODULES} ${GLOB_OP_LIB})
cc_library(paddle_fluid DEPS paddle_fluid_api
Copy link
Contributor

Choose a reason for hiding this comment

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

memory模块一样,我们在每个模块最后加一个cc_library,将该模块里面所有的target都合并成一个静态库?

cc_library(paddle_memory
DEPS
memory
memcpy
meta_data
meta_cache
memory_block
buddy_allocator
system_allocator)

这样,在inference里面,我们只需要依赖paddle_memroy, paddle_framework, paddle_operators, paddle_string, paddle_platform。不过这样还是不能自动添加。

framework_proto ddim tensor place scope threadpool attribute
shape_inference cpu_info op_registry operator op_proto_maker op_info
data_transform data_device_transform data_type_transform data_layout_transform
selected_rows lod_tensor lod_rank_table dynload_warpctc dynamic_loader
device_context profiler
${GPU_DEPS}
${OP_MATH_MODULES}
${FLUID_CORE_MODULES}
${GLOB_OP_LIB})

# Create shared library
add_library(paddle_fluid_shared SHARED inference.cc)
Expand All @@ -21,7 +33,7 @@ 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)
install(TARGETS paddle_fluid_shared paddle_fluid DESTINATION lib)
endif()

add_executable(example example.cc)
Expand Down
4 changes: 4 additions & 0 deletions paddle/operators/math/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ cc_test(selected_rows_functor_test SRCS selected_rows_functor_test.cc DEPS selec
cc_test(im2col_test SRCS im2col_test.cc DEPS math_function tensor)
cc_test(vol2col_test SRCS vol2col_test.cc DEPS vol2col tensor)
cc_test(sequence_padding_test SRCS sequence_padding_test.cc DEPS sequence_padding)

set(OP_MATH_MODULES math_function selected_rows_functor softmax cross_entropy pooling sequence_pooling
vol2col context_project sequence2batch sequence_padding sequence_scale lstm_compute maxouting
unpooling gru_compute cos_sim_functor activation_functions CACHE INTERNAL "Global OP Math Modules")