Skip to content

fix capi package#7255

Merged
luotao1 merged 3 commits intoPaddlePaddle:developfrom
tensor-tang:capi
Jan 8, 2018
Merged

fix capi package#7255
luotao1 merged 3 commits intoPaddlePaddle:developfrom
tensor-tang:capi

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 Jan 5, 2018
@tensor-tang tensor-tang force-pushed the capi branch 2 times, most recently from 3d5245c to 6822b0c Compare January 5, 2018 16:50
@tensor-tang tensor-tang changed the title [WIP] 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.

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

4 participants