未验证 提交 8db001f8 编写于 作者: H huzhiqiang 提交者: GitHub

Add 'inference' folder into build.lite.x86, 'inference' folder contains head...

Add 'inference' folder into build.lite.x86, 'inference' folder contains head files、library files and demo of x86 compiling (#2301)

Add inference folder into build.lite.x86, build.lite.x86/inference folder contains head files、library files and demo of x86 compiling
上级 fd9ceec8
...@@ -88,13 +88,31 @@ if (LITE_WITH_PYTHON) ...@@ -88,13 +88,31 @@ if (LITE_WITH_PYTHON)
endif() endif()
if (LITE_WITH_X86) if (LITE_WITH_X86)
add_dependencies(publish_inference eigen3) add_custom_target(publish_inference_x86_cxx_lib ${TARGET}
add_dependencies(publish_inference fluid_data_type) COMMAND mkdir -p "${INFER_LITE_PUBLISH_ROOT}/cxx/lib"
add_dependencies(publish_inference bundle_full_api) COMMAND mkdir -p "${INFER_LITE_PUBLISH_ROOT}/bin"
add_dependencies(publish_inference bundle_light_api) COMMAND mkdir -p "${INFER_LITE_PUBLISH_ROOT}/cxx/include"
add_dependencies(publish_inference test_model_bin) COMMAND cp "${CMAKE_SOURCE_DIR}/lite/api/paddle_*.h" "${INFER_LITE_PUBLISH_ROOT}/cxx/include"
add_dependencies(publish_inference paddle_full_api_shared) COMMAND cp "${CMAKE_BINARY_DIR}/libpaddle_api_full_bundled.a" "${INFER_LITE_PUBLISH_ROOT}/cxx/lib"
add_dependencies(publish_inference paddle_light_api_shared) COMMAND cp "${CMAKE_BINARY_DIR}/libpaddle_api_light_bundled.a" "${INFER_LITE_PUBLISH_ROOT}/cxx/lib"
COMMAND cp "${CMAKE_BINARY_DIR}/lite/api/*.so" "${INFER_LITE_PUBLISH_ROOT}/cxx/lib"
COMMAND cp "${CMAKE_BINARY_DIR}/lite/api/test_model_bin" "${INFER_LITE_PUBLISH_ROOT}/bin"
)
add_dependencies(publish_inference_x86_cxx_lib bundle_full_api)
add_dependencies(publish_inference_x86_cxx_lib bundle_light_api)
add_dependencies(publish_inference_x86_cxx_lib test_model_bin)
add_dependencies(publish_inference_x86_cxx_lib paddle_full_api_shared)
add_dependencies(publish_inference_x86_cxx_lib paddle_light_api_shared)
add_dependencies(publish_inference publish_inference_x86_cxx_lib)
add_custom_target(publish_inference_x86_cxx_demos ${TARGET}
COMMAND mkdir -p "${INFER_LITE_PUBLISH_ROOT}/third_party"
COMMAND cp -r "${CMAKE_BINARY_DIR}/third_party/install/*" "${INFER_LITE_PUBLISH_ROOT}/third_party"
COMMAND cp -r "${CMAKE_BINARY_DIR}/third_party/eigen3" "${INFER_LITE_PUBLISH_ROOT}/third_party"
COMMAND mkdir -p "${INFER_LITE_PUBLISH_ROOT}/demo/cxx"
)
add_dependencies(publish_inference_x86_cxx_demos gflags eigen3 mklml xbyak xxhash glog)
add_dependencies(publish_inference_x86_cxx_lib publish_inference_x86_cxx_demos)
endif() endif()
if (LITE_WITH_LIGHT_WEIGHT_FRAMEWORK AND LITE_WITH_ARM) if (LITE_WITH_LIGHT_WEIGHT_FRAMEWORK AND LITE_WITH_ARM)
......
...@@ -254,12 +254,7 @@ void BindLiteLightPredictor(py::module *m) { ...@@ -254,12 +254,7 @@ void BindLiteLightPredictor(py::module *m) {
.def("get_input", &LightPredictorImpl::GetInput) .def("get_input", &LightPredictorImpl::GetInput)
.def("get_output", &LightPredictorImpl::GetOutput) .def("get_output", &LightPredictorImpl::GetOutput)
.def("run", &LightPredictorImpl::Run) .def("run", &LightPredictorImpl::Run)
.def("get_version", &LightPredictorImpl::GetVersion) .def("get_version", &LightPredictorImpl::GetVersion);
.def("save_optimized_model",
[](LightPredictorImpl &self, const std::string &output_dir) {
self.SaveOptimizedModel(output_dir,
lite_api::LiteModelType::kNaiveBuffer);
});
} }
} // namespace pybind } // namespace pybind
......
...@@ -15,7 +15,7 @@ THIRD_PARTY_INCLUDES = -I../../../third_party/gflags/include ...@@ -15,7 +15,7 @@ THIRD_PARTY_INCLUDES = -I../../../third_party/gflags/include
ifeq ($(ARM_ABI), arm8) ifeq ($(ARM_ABI), arm8)
CC = /opt/android-ndk-r17c/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-g++ CC = /opt/android-ndk-r17c/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-g++
CXX_FLAGS = -funwind-tables -no-canonical-prefixes -D__ANDROID_API__=22 -fexceptions -frtti -std=c++11 -fopenmp -O3 -DNDEBUG -fPIE CXX_FLAGS = -funwind-tables -no-canonical-prefixes -D__ANDROID_API__=23 -fexceptions -frtti -std=c++11 -fopenmp -O3 -DNDEBUG -fPIE
CXXFLAGS_LINK = $(CXX_FLAGS) -pie -Wl,--gc-sections CXXFLAGS_LINK = $(CXX_FLAGS) -pie -Wl,--gc-sections
SYSROOT_LINK = --sysroot=/opt/android-ndk-r17c/platforms/android-24/arch-arm64 SYSROOT_LINK = --sysroot=/opt/android-ndk-r17c/platforms/android-24/arch-arm64
SYSTEM_LIBS = /opt/android-ndk-r17c/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_static.a \ SYSTEM_LIBS = /opt/android-ndk-r17c/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_static.a \
...@@ -24,7 +24,7 @@ ifeq ($(ARM_ABI), arm8) ...@@ -24,7 +24,7 @@ ifeq ($(ARM_ABI), arm8)
else else
CC = /opt/android-ndk-r17c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ CC = /opt/android-ndk-r17c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++
CXX_FLAGS = -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=softfp -funwind-tables -no-canonical-prefixes \ CXX_FLAGS = -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=softfp -funwind-tables -no-canonical-prefixes \
-D__ANDROID_API__=22 -fexceptions -frtti -std=c++11 -fopenmp -O3 -DNDEBUG -fPIE -D__ANDROID_API__=23 -fexceptions -frtti -std=c++11 -fopenmp -O3 -DNDEBUG -fPIE
CXXFLAGS_LINK = $(CXX_FLAGS) -pie -Wl,--fix-cortex-a8 -Wl,--gc-sections -Wl,-z,nocopyreloc CXXFLAGS_LINK = $(CXX_FLAGS) -pie -Wl,--fix-cortex-a8 -Wl,--gc-sections -Wl,-z,nocopyreloc
SYSROOT_LINK = --sysroot=/opt/android-ndk-r17c/platforms/android-22/arch-arm SYSROOT_LINK = --sysroot=/opt/android-ndk-r17c/platforms/android-22/arch-arm
SYSTEM_LIBS = /opt/android-ndk-r17c/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_static.a \ SYSTEM_LIBS = /opt/android-ndk-r17c/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_static.a \
......
...@@ -241,7 +241,7 @@ function make_x86 { ...@@ -241,7 +241,7 @@ function make_x86 {
prepare_thirdparty prepare_thirdparty
root_dir=$(pwd) root_dir=$(pwd)
build_directory=$BUILD_DIR/build_x86 build_directory=$BUILD_DIR/build.lite.x86
if [ -d $build_directory ] if [ -d $build_directory ]
then then
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册