Skip to content

Commit 3c5c6e7

Browse files
jetfuelshanyi15
authored andcommitted
Create a new paddle build option to build documentation library (#13063)
* Create a new paddle build option to build documentation library * only build copy_paddle_pybind * Update the to build paddle_python * build everything * Use DWITH_FLUID_ONLY * add build lite * add a smaller lib * Update the gen_doc_lib function to handle multiple cases. * Prevent Paddle triggering documents deployment.
1 parent 9f03ce6 commit 3c5c6e7

File tree

1 file changed

+57
-17
lines changed

1 file changed

+57
-17
lines changed

paddle/scripts/paddle_build.sh

Lines changed: 57 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ function print_usage() {
3333
${BLUE}single_test${NONE}: run a single unit test
3434
${BLUE}bind_test${NONE}: parallel tests bind to different GPU
3535
${BLUE}doc${NONE}: generate paddle documents
36+
${BLUE}gen_doc_lib${NONE}: generate paddle documents library
3637
${BLUE}html${NONE}: convert C++ source code into HTML
3738
${BLUE}dockerfile${NONE}: generate paddle release dockerfile
3839
${BLUE}capi${NONE}: generate paddle CAPI package
@@ -431,24 +432,60 @@ EOF
431432
linkchecker doc/v2/cn/html/index.html
432433
linkchecker doc/v2/api/en/html/index.html
433434

434-
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then exit 0; fi;
435+
# if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then exit 0; fi;
436+
#
437+
# # Deploy to the the content server if its a "develop" or "release/version" branch
438+
# # The "develop_doc" branch is reserved to test full deploy process without impacting the real content.
439+
# if [ "$TRAVIS_BRANCH" == "develop_doc" ]; then
440+
# PPO_SCRIPT_BRANCH=develop
441+
# elif [[ "$TRAVIS_BRANCH" == "develop" || "$TRAVIS_BRANCH" =~ ^v|release/[[:digit:]]+\.[[:digit:]]+(\.[[:digit:]]+)?(-\S*)?$ ]]; then
442+
# PPO_SCRIPT_BRANCH=master
443+
# else
444+
# # Early exit, this branch doesn't require documentation build
445+
# return 0;
446+
# fi
447+
# # Fetch the paddlepaddle.org deploy_docs.sh from the appopriate branch
448+
# export DEPLOY_DOCS_SH=https://raw.githubusercontent.com/PaddlePaddle/PaddlePaddle.org/$PPO_SCRIPT_BRANCH/scripts/deploy/deploy_docs.sh
449+
# export PYTHONPATH=$PYTHONPATH:${PADDLE_ROOT}/build/python:/paddle/build/python
450+
# cd ..
451+
# curl $DEPLOY_DOCS_SH | bash -s $CONTENT_DEC_PASSWD $TRAVIS_BRANCH ${PADDLE_ROOT} ${PADDLE_ROOT}/build/doc/ ${PPO_SCRIPT_BRANCH}
452+
# cd -
453+
}
435454

436-
# Deploy to the the content server if its a "develop" or "release/version" branch
437-
# The "develop_doc" branch is reserved to test full deploy process without impacting the real content.
438-
if [ "$TRAVIS_BRANCH" == "develop_doc" ]; then
439-
PPO_SCRIPT_BRANCH=develop
440-
elif [[ "$TRAVIS_BRANCH" == "develop" || "$TRAVIS_BRANCH" =~ ^v|release/[[:digit:]]+\.[[:digit:]]+(\.[[:digit:]]+)?(-\S*)?$ ]]; then
441-
PPO_SCRIPT_BRANCH=master
442-
else
443-
# Early exit, this branch doesn't require documentation build
444-
return 0;
445-
fi
446-
# Fetch the paddlepaddle.org deploy_docs.sh from the appopriate branch
447-
export DEPLOY_DOCS_SH=https://raw.githubusercontent.com/PaddlePaddle/PaddlePaddle.org/$PPO_SCRIPT_BRANCH/scripts/deploy/deploy_docs.sh
448-
export PYTHONPATH=$PYTHONPATH:${PADDLE_ROOT}/build/python:/paddle/build/python
449-
cd ..
450-
curl $DEPLOY_DOCS_SH | bash -s $CONTENT_DEC_PASSWD $TRAVIS_BRANCH ${PADDLE_ROOT} ${PADDLE_ROOT}/build/doc/ ${PPO_SCRIPT_BRANCH}
451-
cd -
455+
function gen_doc_lib() {
456+
mkdir -p ${PADDLE_ROOT}/build
457+
cd ${PADDLE_ROOT}/build
458+
cat <<EOF
459+
========================================
460+
Building documentation library ...
461+
In /paddle/build
462+
========================================
463+
EOF
464+
cmake .. \
465+
-DCMAKE_BUILD_TYPE=Release \
466+
-DWITH_DOC=ON \
467+
-DWITH_GPU=OFF \
468+
-DWITH_MKL=OFF \
469+
-DWITH_FLUID_ONLY=ON
470+
471+
local LIB_TYPE=$1
472+
case $LIB_TYPE in
473+
full)
474+
# Build full Paddle Python module. Will timeout without caching 'copy_paddle_pybind' first
475+
make -j `nproc` gen_proto_py framework_py_proto copy_paddle_pybind paddle_python
476+
;;
477+
pybind)
478+
# Build paddle pybind library. Takes 49 minutes to build. Might timeout
479+
make -j `nproc` copy_paddle_pybind
480+
;;
481+
proto)
482+
# Even smaller library.
483+
make -j `nproc` framework_py_proto
484+
;;
485+
*)
486+
exit 0
487+
;;
488+
esac
452489
}
453490

454491
function gen_html() {
@@ -608,6 +645,9 @@ function main() {
608645
doc)
609646
gen_docs
610647
;;
648+
gen_doc_lib)
649+
gen_doc_lib $2
650+
;;
611651
html)
612652
gen_html
613653
;;

0 commit comments

Comments
 (0)