File tree Expand file tree Collapse file tree 4 files changed +29
-29
lines changed
contrib/inference/demo_ci Expand file tree Collapse file tree 4 files changed +29
-29
lines changed Original file line number Diff line number Diff line change @@ -52,14 +52,12 @@ else()
52
52
set (MATH_LIB ${PADDLE_LIB} /third_party/install/openblas/lib/libopenblas.a )
53
53
endif ()
54
54
55
+ # Note: libpaddle_inference_api.so/a must put before libpaddle_fluid.so/a
55
56
if (WITH_STATIC_LIB )
56
57
set (DEPS
57
- "-Wl,--whole-archive"
58
- ${PADDLE_LIB} /paddle/fluid/inference/libpaddle_fluid.a
59
- "-Wl,--no-whole-archive"
60
- ${PADDLE_LIB} /contrib/inference/libpaddle_inference_api.a )
58
+ ${PADDLE_LIB} /contrib/inference/libpaddle_inference_api.a
59
+ ${PADDLE_LIB} /paddle/fluid/inference/libpaddle_fluid.a )
61
60
else ()
62
- # Note: libpaddle_inference_api.so must put before libpaddle_fluid.so
63
61
set (DEPS
64
62
${PADDLE_LIB} /contrib/inference/libpaddle_inference_api.so
65
63
${PADDLE_LIB} /paddle/fluid/inference/libpaddle_fluid.so )
Original file line number Diff line number Diff line change 1
1
set -x
2
2
PADDLE_ROOT=$1
3
- WITH_MKL=$2
4
- WITH_GPU=$3
5
- if [ $3 == " ON" ]; then
3
+ TURN_ON_MKL=$2 # use MKL or Openblas
4
+ TEST_GPU_CPU=$3 # test both GPU/CPU mode or only CPU mode
5
+ if [ $2 == ON ]; then
6
+ # You can export yourself if move the install path
7
+ MKL_LIB=${PADDLE_ROOT} /build/fluid_install_dir/third_party/install/mklml/lib
8
+ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH :${MKL_LIB}
9
+ fi
10
+ if [ $3 == ON ]; then
6
11
use_gpu_list=' true false'
7
12
else
8
13
use_gpu_list=' false'
11
16
mkdir -p build
12
17
cd build
13
18
14
- for WITH_STATIC_LIB in false ; do
19
+ for WITH_STATIC_LIB in ON OFF ; do
15
20
rm -rf *
16
21
cmake .. -DPADDLE_LIB=${PADDLE_ROOT} /build/fluid_install_dir/ \
17
- -DWITH_MKL=$WITH_MKL \
22
+ -DWITH_MKL=$TURN_ON_MKL \
18
23
-DDEMO_NAME=simple_on_word2vec \
19
- -DWITH_GPU=$WITH_GPU \
24
+ -DWITH_GPU=$TEST_GPU_CPU \
20
25
-DWITH_STATIC_LIB=$WITH_STATIC_LIB
21
- make
26
+ make -j
22
27
for use_gpu in $use_gpu_list ; do
23
28
./simple_on_word2vec \
24
29
--dirname=${PADDLE_ROOT} /build/python/paddle/fluid/tests/book/word2vec.inference.model \
25
30
--use_gpu=$use_gpu
31
+ if [ $? -ne 0 ]; then
32
+ echo " inference demo runs fail."
33
+ exit 1
34
+ fi
26
35
done
27
36
done
28
- if [ $? -eq 0 ]; then
29
- exit 0
30
- else
31
- echo " inference demo runs fail."
32
- exit 1
33
- fi
34
37
set +x
Original file line number Diff line number Diff line change
1
+ # analysis and tensorrt must be added before creating static library,
2
+ # otherwise, there would be undefined reference to them in static library.
3
+ add_subdirectory (analysis )
4
+ if (TENSORRT_FOUND )
5
+ add_subdirectory (tensorrt )
6
+ endif ()
7
+
1
8
set (FLUID_CORE_MODULES proto_desc memory lod_tensor executor )
2
9
3
10
# TODO(panyx0718): Should this be called paddle_fluid_inference_api_internal?
@@ -7,10 +14,6 @@ cc_library(paddle_fluid_api
7
14
8
15
get_property (fluid_modules GLOBAL PROPERTY FLUID_MODULES )
9
16
10
- if (WITH_CONTRIB )
11
- set (fluid_modules "${fluid_modules} " paddle_inference_api )
12
- endif ()
13
-
14
17
# Create static library
15
18
cc_library (paddle_fluid DEPS ${fluid_modules} paddle_fluid_api )
16
19
if (NOT APPLE )
@@ -35,9 +38,3 @@ if(WITH_TESTING)
35
38
# both tests/book and analysis depends the models that generated by python/paddle/fluid/tests/book
36
39
add_subdirectory (tests/book )
37
40
endif ()
38
-
39
- add_subdirectory (analysis )
40
-
41
- if (TENSORRT_FOUND )
42
- add_subdirectory (tensorrt )
43
- endif ()
Original file line number Diff line number Diff line change @@ -516,6 +516,7 @@ function gen_fluid_inference_lib() {
516
516
Deploying fluid inference library ...
517
517
========================================
518
518
EOF
519
+ cmake .. -DWITH_DISTRIBUTE=OFF
519
520
make -j ` nproc` inference_lib_dist
520
521
cd ${PADDLE_ROOT} /build
521
522
cp -r fluid_install_dir fluid
@@ -531,7 +532,7 @@ function test_fluid_inference_lib() {
531
532
========================================
532
533
EOF
533
534
cd ${PADDLE_ROOT} /paddle/contrib/inference/demo_ci
534
- sh run.sh ${PADDLE_ROOT} ${WITH_MKL:- ON} ${WITH_GPU:- OFF}
535
+ ./ run.sh ${PADDLE_ROOT} ${WITH_MKL:- ON} ${WITH_GPU:- OFF}
535
536
fi
536
537
}
537
538
@@ -577,6 +578,7 @@ function main() {
577
578
fluid_inference_lib)
578
579
cmake_gen ${PYTHON_ABI:- " " }
579
580
gen_fluid_inference_lib
581
+ test_fluid_inference_lib
580
582
;;
581
583
check_style)
582
584
check_style
You can’t perform that action at this time.
0 commit comments