未验证 提交 6330fc94 编写于 作者: W Wilber 提交者: GitHub

cherry-pick (#31279)

上级 777d1a45
...@@ -4,6 +4,8 @@ endif() ...@@ -4,6 +4,8 @@ endif()
INCLUDE(ExternalProject) INCLUDE(ExternalProject)
SET(XPU_PROJECT "extern_xpu") SET(XPU_PROJECT "extern_xpu")
SET(XPU_API_LIB_NAME "libxpuapi.so")
SET(XPU_RT_LIB_NAME "libxpurt.so")
if(NOT XPU_SDK_ROOT) if(NOT XPU_SDK_ROOT)
if (WITH_AARCH64) if (WITH_AARCH64)
...@@ -20,8 +22,6 @@ if(NOT XPU_SDK_ROOT) ...@@ -20,8 +22,6 @@ if(NOT XPU_SDK_ROOT)
SET(XPU_API_INC_DIR "${THIRD_PARTY_PATH}/install/xpu/include") SET(XPU_API_INC_DIR "${THIRD_PARTY_PATH}/install/xpu/include")
SET(XPU_LIB_DIR "${THIRD_PARTY_PATH}/install/xpu/lib") SET(XPU_LIB_DIR "${THIRD_PARTY_PATH}/install/xpu/lib")
SET(XPU_API_LIB_NAME "libxpuapi.so")
SET(XPU_RT_LIB_NAME "libxpurt.so")
SET(XPU_API_LIB "${XPU_LIB_DIR}/${XPU_API_LIB_NAME}") SET(XPU_API_LIB "${XPU_LIB_DIR}/${XPU_API_LIB_NAME}")
SET(XPU_RT_LIB "${XPU_LIB_DIR}/${XPU_RT_LIB_NAME}") SET(XPU_RT_LIB "${XPU_LIB_DIR}/${XPU_RT_LIB_NAME}")
......
...@@ -322,6 +322,7 @@ endif (WITH_LITE) ...@@ -322,6 +322,7 @@ endif (WITH_LITE)
if (WITH_CRYPTO) if (WITH_CRYPTO)
include(external/cryptopp) # download, build, install cryptopp include(external/cryptopp) # download, build, install cryptopp
add_definitions(-DPADDLE_WITH_CRYPTO)
endif (WITH_CRYPTO) endif (WITH_CRYPTO)
add_custom_target(third_party ALL DEPENDS ${third_party_deps}) add_custom_target(third_party ALL DEPENDS ${third_party_deps})
...@@ -56,9 +56,4 @@ std::shared_ptr<Cipher> CipherFactory::CreateCipher( ...@@ -56,9 +56,4 @@ std::shared_ptr<Cipher> CipherFactory::CreateCipher(
} }
} // namespace framework } // namespace framework
std::shared_ptr<framework::Cipher> MakeCipher(const std::string& config_file) {
return framework::CipherFactory::CreateCipher(config_file);
}
} // namespace paddle } // namespace paddle
...@@ -30,8 +30,14 @@ endif() ...@@ -30,8 +30,14 @@ endif()
cc_library(analysis_config SRCS analysis_config.cc DEPS ${mkldnn_quantizer_cfg} lod_tensor paddle_pass_builder) cc_library(analysis_config SRCS analysis_config.cc DEPS ${mkldnn_quantizer_cfg} lod_tensor paddle_pass_builder)
cc_library(paddle_pass_builder SRCS paddle_pass_builder.cc) cc_library(paddle_pass_builder SRCS paddle_pass_builder.cc)
cc_library(paddle_inference_api SRCS api.cc api_impl.cc helper.cc DEPS lod_tensor scope reset_tensor_array if(WITH_CRYPTO)
analysis_config zero_copy_tensor trainer_desc_proto) cc_library(paddle_inference_api SRCS api.cc api_impl.cc helper.cc DEPS lod_tensor scope reset_tensor_array
analysis_config zero_copy_tensor trainer_desc_proto paddle_crypto)
else()
cc_library(paddle_inference_api SRCS api.cc api_impl.cc helper.cc DEPS lod_tensor scope reset_tensor_array
analysis_config zero_copy_tensor trainer_desc_proto)
endif()
if(WIN32) if(WIN32)
target_link_libraries(paddle_inference_api gflags) target_link_libraries(paddle_inference_api gflags)
......
...@@ -146,4 +146,10 @@ std::string UpdateDllFlag(const char *name, const char *value) { ...@@ -146,4 +146,10 @@ std::string UpdateDllFlag(const char *name, const char *value) {
return ret; return ret;
} }
#ifdef PADDLE_WITH_CRYPTO
std::shared_ptr<framework::Cipher> MakeCipher(const std::string &config_file) {
return framework::CipherFactory::CreateCipher(config_file);
}
#endif
} // namespace paddle } // namespace paddle
...@@ -91,4 +91,9 @@ TEST(paddle_inference_api, AnalysisConfigCopyCtor) { ...@@ -91,4 +91,9 @@ TEST(paddle_inference_api, AnalysisConfigCopyCtor) {
CHECK_NE(ps, delete_pass); CHECK_NE(ps, delete_pass);
} }
} }
#ifdef PADDLE_WITH_CRYPTO
TEST(paddle_inference_api, crypto) { paddle::MakeCipher(""); }
#endif
} // namespace paddle } // namespace paddle
...@@ -36,11 +36,13 @@ include_directories("${PADDLE_LIB_THIRD_PARTY_PATH}protobuf/include") ...@@ -36,11 +36,13 @@ include_directories("${PADDLE_LIB_THIRD_PARTY_PATH}protobuf/include")
include_directories("${PADDLE_LIB_THIRD_PARTY_PATH}glog/include") include_directories("${PADDLE_LIB_THIRD_PARTY_PATH}glog/include")
include_directories("${PADDLE_LIB_THIRD_PARTY_PATH}gflags/include") include_directories("${PADDLE_LIB_THIRD_PARTY_PATH}gflags/include")
include_directories("${PADDLE_LIB_THIRD_PARTY_PATH}xxhash/include") include_directories("${PADDLE_LIB_THIRD_PARTY_PATH}xxhash/include")
include_directories("${PADDLE_LIB_THIRD_PARTY_PATH}cryptopp/include")
link_directories("${PADDLE_LIB_THIRD_PARTY_PATH}protobuf/lib") link_directories("${PADDLE_LIB_THIRD_PARTY_PATH}protobuf/lib")
link_directories("${PADDLE_LIB_THIRD_PARTY_PATH}glog/lib") link_directories("${PADDLE_LIB_THIRD_PARTY_PATH}glog/lib")
link_directories("${PADDLE_LIB_THIRD_PARTY_PATH}gflags/lib") link_directories("${PADDLE_LIB_THIRD_PARTY_PATH}gflags/lib")
link_directories("${PADDLE_LIB_THIRD_PARTY_PATH}xxhash/lib") link_directories("${PADDLE_LIB_THIRD_PARTY_PATH}xxhash/lib")
link_directories("${PADDLE_LIB_THIRD_PARTY_PATH}cryptopp/lib")
link_directories("${PADDLE_LIB}/paddle/lib") link_directories("${PADDLE_LIB}/paddle/lib")
if (WIN32) if (WIN32)
...@@ -145,12 +147,12 @@ if (NOT WIN32) ...@@ -145,12 +147,12 @@ if (NOT WIN32)
set(EXTERNAL_LIB "-lrt -ldl -lpthread") set(EXTERNAL_LIB "-lrt -ldl -lpthread")
set(DEPS ${DEPS} set(DEPS ${DEPS}
${MATH_LIB} ${MKLDNN_LIB} ${MATH_LIB} ${MKLDNN_LIB}
glog gflags protobuf xxhash glog gflags protobuf xxhash cryptopp
${EXTERNAL_LIB}) ${EXTERNAL_LIB})
else() else()
set(DEPS ${DEPS} set(DEPS ${DEPS}
${MATH_LIB} ${MKLDNN_LIB} ${MATH_LIB} ${MKLDNN_LIB}
glog gflags_static libprotobuf xxhash ${EXTERNAL_LIB}) glog gflags_static libprotobuf xxhash cryptopp-static ${EXTERNAL_LIB})
set(DEPS ${DEPS} shlwapi.lib) set(DEPS ${DEPS} shlwapi.lib)
endif(NOT WIN32) endif(NOT WIN32)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册