From dd8fc9810d3e76f4a5ea177488e94d8e67a9ccec Mon Sep 17 00:00:00 2001 From: mapingshuo Date: Fri, 27 Sep 2019 16:07:49 +0800 Subject: [PATCH] add train demo to paddle_build.sh (#19885) * add train demo to paddle_build.sh test=develop test=document_preview * code cleaning * test=develop test=develop * remove program desc files test=develop * add test_train to CI test=develop test=document_preview * make run.sh excutable test=develop test=document_preview * switch with_mkl to off test=develop test=document_preview * switch with_mkl to off test=develop * switch with_mkl to on test=develop * move test_fluid_lib_train to ci_py35 test=develop * fix bugs of MKLDNN building * rm build_train_lib(), test=develop * restore tensor.h, test=develop --- paddle/fluid/train/demo/CMakeLists.txt | 1 + paddle/fluid/train/demo/clean.sh | 4 ++++ paddle/fluid/train/demo/run.sh | 30 ++++++++++++++++++++++++++ paddle/scripts/paddle_build.sh | 16 +++++++++++++- 4 files changed, 50 insertions(+), 1 deletion(-) create mode 100755 paddle/fluid/train/demo/clean.sh create mode 100755 paddle/fluid/train/demo/run.sh diff --git a/paddle/fluid/train/demo/CMakeLists.txt b/paddle/fluid/train/demo/CMakeLists.txt index 289dd9869b..5a370b813f 100644 --- a/paddle/fluid/train/demo/CMakeLists.txt +++ b/paddle/fluid/train/demo/CMakeLists.txt @@ -30,6 +30,7 @@ link_directories("${PADDLE_LIB}/third_party/install/zlib/lib") add_executable(demo_trainer demo_trainer.cc) if(WITH_MKLDNN) + add_definitions(-DPADDLE_WITH_MKLDNN) include_directories("${PADDLE_LIB}/third_party/install/mkldnn/include") if(WIN32) set(MKLDNN_LIB ${PADDLE_LIB}/third_party/install/mkldnn/lib/mkldnn.lib) diff --git a/paddle/fluid/train/demo/clean.sh b/paddle/fluid/train/demo/clean.sh new file mode 100755 index 0000000000..0297b9781d --- /dev/null +++ b/paddle/fluid/train/demo/clean.sh @@ -0,0 +1,4 @@ +set -x +cd `dirname $0` +rm -rf build/ +set +x diff --git a/paddle/fluid/train/demo/run.sh b/paddle/fluid/train/demo/run.sh new file mode 100755 index 0000000000..42b331066f --- /dev/null +++ b/paddle/fluid/train/demo/run.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +set -x + +PADDLE_ROOT=$1 +TURN_ON_MKL=$2 # use MKL or Openblas + +# download models +function download() { + wget -q http://paddle-tar.bj.bcebos.com/train_demo/LR/main_program + wget -q http://paddle-tar.bj.bcebos.com/train_demo/LR/startup_program +} + +download + +# build demo trainer +fluid_install_dir=${PADDLE_ROOT}/build/fluid_install_dir + +mkdir -p build +cd build +rm -rf * +cmake .. -DPADDLE_LIB=$fluid_install_dir \ + -DWITH_MKLDNN=$TURN_ON_MKL \ + -DWITH_MKL=$TURN_ON_MKL +make + +cd .. + +# run demo trainer +build/demo_trainer diff --git a/paddle/scripts/paddle_build.sh b/paddle/scripts/paddle_build.sh index 447bd9c85b..1a99c9f52d 100755 --- a/paddle/scripts/paddle_build.sh +++ b/paddle/scripts/paddle_build.sh @@ -296,7 +296,6 @@ function build_base() { make install -j ${parallel_number} } - function build() { mkdir -p ${PADDLE_ROOT}/build cd ${PADDLE_ROOT}/build @@ -952,6 +951,16 @@ EOF ./clean.sh } +function test_fluid_lib_train() { + cat <