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

fix capi package #7255

Merged
merged 3 commits into from
Jan 8, 2018
Merged

fix capi package #7255

merged 3 commits into from
Jan 8, 2018

Conversation

tensor-tang
Copy link
Contributor

@tensor-tang tensor-tang commented Jan 5, 2018

fix #7254 and fix #7181

@tensor-tang tensor-tang changed the title fix capi package [WIP] fix capi package Jan 5, 2018
@tensor-tang tensor-tang changed the title [WIP] fix capi package fix capi package Jan 5, 2018
@tensor-tang
Copy link
Contributor Author

tensor-tang commented Jan 5, 2018

You can directly run the below script to check the result.

#!/bin/bash
set -xe
export PADDLE_DEV_NAME="paddlepaddle/paddle:latest-dev"
docker run -i --rm -v $PWD:/paddle ${PADDLE_DEV_NAME} \
  rm -rf /paddle/build
docker run  -i --rm -v $PWD:/paddle \
  -e "WITH_PYTHON=OFF" \
  -e "WITH_SWIG_PY=OFF" \
  -e "WITH_PYTHON=OFF" \
  -e "WITH_C_API=ON" \
  -e "WITH_GPU=OFF" \
  -e "WITH_AVX=ON" \
  -e "WITH_MKL=ON" \
  -e "WITH_STYLE_CHECK=OFF" \
  ${PADDLE_DEV_NAME} \
  bash -x /paddle/paddle/scripts/docker/build.sh

The paddle.tgz would contain:

bin include lib opt third_party

And in the lib:

lib/libmklml_intel.so
lib/libiomp5.so
lib/libmkldnn.so.0
lib/libpaddle_capi_whole.a
lib/libpaddle_capi_engine.a
lib/libpaddle_capi_layers.a
lib/libpaddle_capi_shared.so

ADD_CUSTOM_TARGET(mkldnn_shared_lib ALL DEPENDS ${MKLDNN_SHARED_LIB})

IF(WITH_C_API)
INSTALL(FILES ${MKLDNN_SHARED_LIB} DESTINATION lib)
Copy link
Contributor

Choose a reason for hiding this comment

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

Not stall to lib, but third_party/mkldnn/lib. Please refer to https://github.com/PaddlePaddle/Paddle/blob/develop/cmake/external/glog.cmake#L71

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @Xreki , The reason installed to lib is that the script here installed to lib directly.
This function is trying to replace the command.

And I think the *.so should be contained into /usr/local/lib, maybe @Yancey1989 has considered this before?
Anyway I am OK installing to third-party, but then user should set the path to LD manually.

Same as below.

Copy link
Contributor

Choose a reason for hiding this comment

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

As glog etc is a static library, but mkldnn etc is a shared library, thus, if *.so are contained into thirdparty, users should export LD_LIBRARY_PATH which leads an extra step for users. So we can contain *.so into /usr/loacl/lib at this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

The same with @luotao1 , I think *.so contained into /usr/local/lib is an easy way for the user.

@@ -66,3 +66,7 @@ ADD_LIBRARY(mklml SHARED IMPORTED GLOBAL)
SET_PROPERTY(TARGET mklml PROPERTY IMPORTED_LOCATION ${MKLML_LIB})
ADD_DEPENDENCIES(mklml ${MKLML_PROJECT})
LIST(APPEND external_project_dependencies mklml)

IF(WITH_C_API)
INSTALL(FILES ${MKLML_LIB} ${MKLML_IOMP_LIB} DESTINATION lib)
Copy link
Contributor

Choose a reason for hiding this comment

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

Not install to lib, but third_party/mklml/lib.Please refer to https://github.com/PaddlePaddle/Paddle/blob/develop/cmake/external/glog.cmake#L71

Copy link
Contributor

@luotao1 luotao1 left a comment

Choose a reason for hiding this comment

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

LGTM

@luotao1 luotao1 merged commit c62383e into PaddlePaddle:develop Jan 8, 2018
@tensor-tang tensor-tang deleted the capi branch January 8, 2018 05:22
@luotao1 luotao1 mentioned this pull request Nov 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tar failed when generate capi package The size of libmkldnn.so.0 is 0B in capi
4 participants