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

[feature][osx] enable osx paddle_inference and add whl (#123) #23

Merged
merged 1 commit into from
Aug 16, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,13 @@ if(ENABLE_PADDLE_BACKEND)
add_definitions(-DENABLE_PADDLE_BACKEND)
list(APPEND ALL_DEPLOY_SRCS ${DEPLOY_PADDLE_SRCS})
include(external/paddle_inference.cmake)
list(APPEND DEPEND_LIBS external_paddle_inference external_dnnl external_omp)
if(NOT APPLE)
list(APPEND DEPEND_LIBS external_paddle_inference external_dnnl external_omp)
else()
# no third parties libs(mkldnn and omp) need to
# link into paddle_inference on MacOS OSX.
list(APPEND DEPEND_LIBS external_paddle_inference)
endif()
endif()

if(WITH_GPU)
Expand Down
9 changes: 6 additions & 3 deletions FastDeploy.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,16 @@ if(ENABLE_PADDLE_BACKEND)
set(DNNL_LIB "${CMAKE_CURRENT_LIST_DIR}/third_libs/install/paddle_inference/third_party/install/mkldnn/lib/mkldnn.lib")
set(IOMP_LIB "${CMAKE_CURRENT_LIST_DIR}/third_libs/install/paddle_inference/third_party/install/mklml/lib/libiomp5md.lib")
elseif(APPLE)
set(DNNL_LIB "")
set(IOMP_LIB "")
message(STATUS "No third parties libs(mkldnn and omp) need to link into paddle_inference on MacOS OSX.")
else()
set(DNNL_LIB "${CMAKE_CURRENT_LIST_DIR}/third_libs/install/paddle_inference/third_party/install/mkldnn/lib/libmkldnn.so.0")
set(IOMP_LIB "${CMAKE_CURRENT_LIST_DIR}/third_libs/install/paddle_inference/third_party/install/mklml/lib/libiomp5.so")
endif()
list(APPEND FASTDEPLOY_LIBS ${PADDLE_LIB} ${DNNL_LIB} ${IOMP_LIB})
if(NOT APPLE)
list(APPEND FASTDEPLOY_LIBS ${PADDLE_LIB} ${DNNL_LIB} ${IOMP_LIB})
else()
list(APPEND FASTDEPLOY_LIBS ${PADDLE_LIB})
endif()
endif()

if(WITH_GPU)
Expand Down
166 changes: 83 additions & 83 deletions README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/compile/prebuilt_libraries.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ FastDeploy提供了在Windows/Linux/Mac上的预先编译CPP部署库,开发

| 部署库下载地址 | 架构 |硬件 |
| :---- | :-- | :------ |
| [comming...] | x86 | CPU |
| [comming...] | arm64 | CPU |
| [fastdeploy-osx-x86_64-0.2.0.tgz](https://bj.bcebos.com/paddlehub/fastdeploy/cpp/fastdeploy-osx-x86_64-0.2.0.tgz) | x86 | CPU |
| [fastdeploy-osx-arm64-0.2.0.tgz](https://bj.bcebos.com/paddlehub/fastdeploy/cpp/fastdeploy-osx-arm64-0.2.0.tgz) | arm64 | CPU |

## 其它文档

Expand Down
8 changes: 6 additions & 2 deletions docs/compile/prebuilt_wheels.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@ python -m pip install fastdeploy_python-0.2.0-cp38-cp38-manylinux1_x86_64.whl

| 架构 | 硬件 | 安装包 | Python版本 |
| :---- | :-- | :------ | :----- |
| x86_64 | CPU | [comming...] | 3.9 |
| arm64 | CPU | [comming...] | 3.9 |
| x86_64 | CPU | [fastdeploy_python-0.2.0-cp36-cp36m-macosx_10_14_x86_64.whl](https://bj.bcebos.com/paddlehub/fastdeploy/wheels/fastdeploy_python-0.2.0-cp36-cp36m-macosx_10_14_x86_64.whl) | 3.6 |
| x86_64 | CPU | [fastdeploy_python-0.2.0-cp37-cp37m-macosx_10_14_x86_64.whl](https://bj.bcebos.com/paddlehub/fastdeploy/wheels/fastdeploy_python-0.2.0-cp37-cp37m-macosx_10_14_x86_64.whl) | 3.7 |
| x86_64 | CPU | [fastdeploy_python-0.2.0-cp38-cp38-macosx_10_14_x86_64.whl](https://bj.bcebos.com/paddlehub/fastdeploy/wheels/fastdeploy_python-0.2.0-cp38-cp38-macosx_10_14_x86_64.whl) | 3.8 |
| x86_64 | CPU | [fastdeploy_python-0.2.0-cp39-cp39-macosx_10_14_x86_64.whl](https://bj.bcebos.com/paddlehub/fastdeploy/wheels/fastdeploy_python-0.2.0-cp39-cp39-macosx_10_14_x86_64.whl) | 3.9 |
| arm64 | CPU | [fastdeploy_python-0.2.0-cp38-cp38-macosx_11_0_arm64.whl](https://bj.bcebos.com/paddlehub/fastdeploy/wheels/fastdeploy_python-0.2.0-cp38-cp38-macosx_11_0_arm64.whl) | 3.8 |
| arm64 | CPU | [fastdeploy_python-0.2.0-cp39-cp39-macosx_11_0_arm64.whl](https://bj.bcebos.com/paddlehub/fastdeploy/wheels/fastdeploy_python-0.2.0-cp39-cp39-macosx_11_0_arm64.whl) | 3.9 |

## 其它文档

Expand Down
24 changes: 13 additions & 11 deletions external/paddle_inference.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ elseif(APPLE)
set(PADDLEINFERENCE_COMPILE_LIB
"${PADDLEINFERENCE_INSTALL_DIR}/paddle/lib/libpaddle_inference.dylib"
CACHE FILEPATH "paddle_inference compile library." FORCE)
set(DNNL_LIB "")
set(OMP_LIB "")
else()
set(PADDLEINFERENCE_COMPILE_LIB
"${PADDLEINFERENCE_INSTALL_DIR}/paddle/lib/libpaddle_inference.so"
Expand All @@ -57,8 +55,8 @@ if(WIN32)
set(PADDLEINFERENCE_FILE "paddle_inference-win-x64-${PADDLEINFERENCE_VERSION}.zip")
endif()
elseif(APPLE)
message(FATAL_ERROR "Paddle Backend doesn't support Mac OSX now.")
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "arm64")
message(FATAL_ERROR "Paddle Backend doesn't support Mac OSX with Arm64 now.")
set(PADDLEINFERENCE_FILE "paddle_inference-osx-arm64-${PADDLEINFERENCE_VERSION}.tgz")
else()
set(PADDLEINFERENCE_FILE "paddle_inference-osx-x86_64-${PADDLEINFERENCE_VERSION}.tgz")
Expand Down Expand Up @@ -94,12 +92,16 @@ set_property(TARGET external_paddle_inference PROPERTY IMPORTED_LOCATION
${PADDLEINFERENCE_COMPILE_LIB})
add_dependencies(external_paddle_inference ${PADDLEINFERENCE_PROJECT})

add_library(external_dnnl STATIC IMPORTED GLOBAL)
set_property(TARGET external_dnnl PROPERTY IMPORTED_LOCATION
${DNNL_LIB})
add_dependencies(external_dnnl ${PADDLEINFERENCE_PROJECT})
if (NOT APPLE)
# no third parties libs(mkldnn and omp) need to
# link into paddle_inference on MacOS OSX.
add_library(external_dnnl STATIC IMPORTED GLOBAL)
set_property(TARGET external_dnnl PROPERTY IMPORTED_LOCATION
${DNNL_LIB})
add_dependencies(external_dnnl ${PADDLEINFERENCE_PROJECT})

add_library(external_omp STATIC IMPORTED GLOBAL)
set_property(TARGET external_omp PROPERTY IMPORTED_LOCATION
${OMP_LIB})
add_dependencies(external_omp ${PADDLEINFERENCE_PROJECT})
add_library(external_omp STATIC IMPORTED GLOBAL)
set_property(TARGET external_omp PROPERTY IMPORTED_LOCATION
${OMP_LIB})
add_dependencies(external_omp ${PADDLEINFERENCE_PROJECT})
endif()
13 changes: 7 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,12 +463,13 @@ def run(self):
for f in all_files:
# remove un-need ocv samples files to avoid too long file path
# in windows which can make building process failed.
if f.find(".vcxproj.") > 0:
continue
if f.find("opencv") > 0 and (f.find("samples") > 0 or
f.find("java") > 0 or
f.find(".png") > 0 or f.find(".jpg")):
continue
if platform.system().lower() == "windows":
if f.find(".vcxproj.") > 0:
continue
if f.find("opencv") > 0 and any(
(f.find("samples") > 0, f.find("java") > 0, f.find(".png") > 0,
f.find(".jpg") > 0)):
continue
package_data[PACKAGE_NAME].append(os.path.relpath(f, PACKAGE_NAME))

setuptools.setup(
Expand Down