未验证 提交 9b0f621c 编写于 作者: Y Yuanle Liu 提交者: GitHub

adjust inference lib dir (#53091)

上级 c3c85794
...@@ -285,58 +285,56 @@ include_directories(${CMAKE_BINARY_DIR}/../paddle/fluid/framework/io) ...@@ -285,58 +285,56 @@ include_directories(${CMAKE_BINARY_DIR}/../paddle/fluid/framework/io)
copy( copy(
inference_lib_dist inference_lib_dist
SRCS ${PADDLE_SOURCE_DIR}/paddle/phi/api/ext/*.h SRCS ${PADDLE_SOURCE_DIR}/paddle/phi/api/ext/*.h
DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/phi/api/ext/) DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/phi/api/ext/)
copy( copy(
inference_lib_dist inference_lib_dist
SRCS ${PADDLE_SOURCE_DIR}/paddle/phi/api/include/*.h SRCS ${PADDLE_SOURCE_DIR}/paddle/phi/api/include/*.h
DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/phi/api/include/ DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/phi/api/include/)
)
copy( copy(
inference_lib_dist inference_lib_dist
SRCS ${PADDLE_SOURCE_DIR}/paddle/phi/api/all.h SRCS ${PADDLE_SOURCE_DIR}/paddle/phi/api/all.h
DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/phi/api/) DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/phi/api/)
copy( copy(
inference_lib_dist inference_lib_dist
SRCS ${PADDLE_SOURCE_DIR}/paddle/phi/common/*.h SRCS ${PADDLE_SOURCE_DIR}/paddle/phi/common/*.h
DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/phi/common/) DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/phi/common/)
copy( copy(
inference_lib_dist inference_lib_dist
SRCS ${PADDLE_SOURCE_DIR}/paddle/phi/core/macros.h SRCS ${PADDLE_SOURCE_DIR}/paddle/phi/core/macros.h
DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/phi/core/) DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/phi/core/)
copy( copy(
inference_lib_dist inference_lib_dist
SRCS ${PADDLE_SOURCE_DIR}/paddle/phi/core/visit_type.h SRCS ${PADDLE_SOURCE_DIR}/paddle/phi/core/visit_type.h
DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/phi/core/) DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/phi/core/)
copy( copy(
inference_lib_dist inference_lib_dist
SRCS ${PADDLE_SOURCE_DIR}/paddle/phi/core/hostdevice.h SRCS ${PADDLE_SOURCE_DIR}/paddle/phi/core/hostdevice.h
DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/phi/core/) DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/phi/core/)
copy( copy(
inference_lib_dist inference_lib_dist
SRCS ${PADDLE_SOURCE_DIR}/paddle/fluid/platform/init_phi.h SRCS ${PADDLE_SOURCE_DIR}/paddle/fluid/platform/init_phi.h
DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/phi/) DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/phi/)
copy( copy(
inference_lib_dist inference_lib_dist
SRCS ${PADDLE_SOURCE_DIR}/paddle/utils/any.h SRCS ${PADDLE_SOURCE_DIR}/paddle/utils/any.h
DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/utils/) DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/utils/)
copy( copy(
inference_lib_dist inference_lib_dist
SRCS ${PADDLE_SOURCE_DIR}/paddle/utils/optional.h SRCS ${PADDLE_SOURCE_DIR}/paddle/utils/optional.h
DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/utils/) DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/utils/)
copy( copy(
inference_lib_dist inference_lib_dist
SRCS ${PADDLE_SOURCE_DIR}/paddle/utils/none.h SRCS ${PADDLE_SOURCE_DIR}/paddle/utils/none.h
DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/utils/) DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/utils/)
copy( copy(
inference_lib_dist inference_lib_dist
SRCS ${PADDLE_SOURCE_DIR}/paddle/utils/flat_hash_map.h SRCS ${PADDLE_SOURCE_DIR}/paddle/utils/flat_hash_map.h
DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/utils/) DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/utils/)
copy( copy(
inference_lib_dist inference_lib_dist
SRCS ${PADDLE_SOURCE_DIR}/paddle/extension.h SRCS ${PADDLE_SOURCE_DIR}/paddle/extension.h
DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/) DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/)
# the header file of phi is copied to the experimental directory,
# the include path of phi needs to be changed to adapt to inference api path # the include path of phi needs to be changed to adapt to inference api path
add_custom_command( add_custom_command(
TARGET inference_lib_dist TARGET inference_lib_dist
......
...@@ -17,57 +17,36 @@ set(PADDLE_INFERENCE_INSTALL_DIR ...@@ -17,57 +17,36 @@ set(PADDLE_INFERENCE_INSTALL_DIR
function(phi_header_path_compat TARGET_PATH) function(phi_header_path_compat TARGET_PATH)
message(STATUS "phi header path compat processing: ${TARGET_PATH}") message(STATUS "phi header path compat processing: ${TARGET_PATH}")
string(FIND ${TARGET_PATH} "experimental" pos) file(GLOB HEADERS "${TARGET_PATH}/*" "*.h")
if(pos GREATER 1) foreach(header ${HEADERS})
file(GLOB HEADERS "${TARGET_PATH}/*" "*.h") if(${header} MATCHES ".*.h$")
foreach(header ${HEADERS}) file(READ ${header} HEADER_CONTENT)
if(${header} MATCHES ".*.h$") string(REPLACE "paddle/fluid/platform/" "paddle/phi/" HEADER_CONTENT
file(READ ${header} HEADER_CONTENT) "${HEADER_CONTENT}")
string(REPLACE "paddle/phi/" "paddle/include/experimental/phi/" file(WRITE ${header} "${HEADER_CONTENT}")
HEADER_CONTENT "${HEADER_CONTENT}") message(STATUS "phi header path compat processing complete: ${header}")
string(REPLACE "paddle/fluid/platform/" endif()
"paddle/include/experimental/phi/" HEADER_CONTENT endforeach()
"${HEADER_CONTENT}")
string(REPLACE "paddle/utils/" "paddle/include/experimental/utils/"
HEADER_CONTENT "${HEADER_CONTENT}")
file(WRITE ${header} "${HEADER_CONTENT}")
message(STATUS "phi header path compat processing complete: ${header}")
endif()
endforeach()
endif()
endfunction() endfunction()
phi_header_path_compat(${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle)
phi_header_path_compat( phi_header_path_compat(
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental) ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/phi)
phi_header_path_compat( phi_header_path_compat(
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/phi) ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/phi/api)
phi_header_path_compat( phi_header_path_compat(
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/phi/api) ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/phi/api/ext)
phi_header_path_compat( phi_header_path_compat(
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/phi/api/ext) ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/phi/api/include)
phi_header_path_compat( phi_header_path_compat(
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/phi/api/include) ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/phi/common)
phi_header_path_compat( phi_header_path_compat(
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/phi/common) ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/phi/core)
phi_header_path_compat(
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/phi/core)
# NOTE(liuyuanle): In inference lib, no need include paddle/utils/pybind.h, so we delete this. # NOTE(liuyuanle): In inference lib, no need include paddle/utils/pybind.h, so we delete this.
file(READ file(READ ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/extension.h
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/extension.h
HEADER_CONTENT) HEADER_CONTENT)
string(REGEX REPLACE "#if !defined\\(PADDLE_ON_INFERENCE\\).*#endif" "" string(REGEX REPLACE "#if !defined\\(PADDLE_ON_INFERENCE\\).*#endif" ""
HEADER_CONTENT "${HEADER_CONTENT}") HEADER_CONTENT "${HEADER_CONTENT}")
file(WRITE file(WRITE ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/paddle/extension.h
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/extension.h
"${HEADER_CONTENT}") "${HEADER_CONTENT}")
# In order to be compatible with the original behavior, the header file name needs to be changed
file(RENAME
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/extension.h
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/ext_all.h)
# Included header file of training and inference can be unified as single file: paddle/extension.h
file(COPY ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/ext_all.h
DESTINATION ${PADDLE_INFERENCE_INSTALL_DIR}/paddle)
file(RENAME ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/ext_all.h
${PADDLE_INFERENCE_INSTALL_DIR}/paddle/extension.h)
...@@ -98,8 +98,7 @@ set(SHARED_INFERENCE_SRCS ...@@ -98,8 +98,7 @@ set(SHARED_INFERENCE_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/api/analysis_predictor.cc ${CMAKE_CURRENT_SOURCE_DIR}/api/analysis_predictor.cc
${CMAKE_CURRENT_SOURCE_DIR}/api/paddle_infer_contrib.cc ${CMAKE_CURRENT_SOURCE_DIR}/api/paddle_infer_contrib.cc
${CMAKE_CURRENT_SOURCE_DIR}/api/details/zero_copy_tensor.cc ${CMAKE_CURRENT_SOURCE_DIR}/api/details/zero_copy_tensor.cc
${CMAKE_CURRENT_SOURCE_DIR}/utils/io_utils.cc ${CMAKE_CURRENT_SOURCE_DIR}/utils/io_utils.cc)
${PADDLE_CUSTOM_OP_SRCS})
# shared inference library deps # shared inference library deps
list(REMOVE_ITEM fluid_modules standalone_executor list(REMOVE_ITEM fluid_modules standalone_executor
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册