-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild.sh
executable file
·166 lines (145 loc) · 5.1 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#!/bin/bash
set -e
CURFILE=`readlink -m $0`
CURDIR=`dirname ${CURFILE}`
PROJECT_ROOT=`pwd`
echo ${PROJECT_ROOT}
if [ "${PROJECT_ROOT}" != "${CURDIR}" ]; then
echo "PROJECT_ROOT != CURDIR" 1>&2
exit 1
fi
if [ "${THIRD_PARTY}" == "" ]; then
THIRD_PARTY=${PROJECT_ROOT}/tools
fi
if [ "$J" == "" ]; then
export J=`nproc | awk '{print int(($0 + 1)/ 2)}'` # make cocurrent thread number
fi
function build() {
DEFINES=" -DTHIRD_PARTY=${THIRD_PARTY} -DCMAKE_INSTALL_PREFIX=${THIRD_PARTY}"
export PKG_CONFIG_PATH=${THIRD_PARTY}/lib64/pkgconfig:${THIRD_PARTY}/lib/pkgconfig:${PKG_CONFIG_PATH}
if [ "${USE_RDMA}" == "0" ]; then
DEFINES="${DEFINES} -DUSE_RDMA=OFF"
elif [ "${USE_RDMA}" == "1" ]; then
DEFINES="${DEFINES} -DUSE_RDMA=ON"
fi
if [ "${USE_PMEM}" == "0" ]; then
DEFINES="${DEFINES} -DUSE_DCPMM=OFF"
elif [ "${USE_PMEM}" == "1" ]; then
DEFINES="${DEFINES} -DUSE_DCPMM=ON"
fi
mkdir -p ${PROJECT_ROOT}/pico-ps/pico-core/build
pushd ${PROJECT_ROOT}/pico-ps/pico-core/build
cmake ../ ${DEFINES} -DSKIP_BUILD_TEST=ON
make -j$J
make install
popd
mkdir -p ${PROJECT_ROOT}/pico-ps/build
pushd ${PROJECT_ROOT}/pico-ps/build
cmake ../ ${DEFINES} -DSKIP_BUILD_TEST=ON
make -j$J
make install
popd
DEFINES="${DEFINES} -DOPENEMBEDDING_VERSION=${VERSION}"
if [ "${SKIP_CHECK_WHEEL_SETUP}" == "0" ]; then
DEFINES="${DEFINES} -DSKIP_CHECK_WHEEL_SETUP=OFF"
elif [ "${SKIP_CHECK_WHEEL_SETUP}" == "1" ]; then
DEFINES="${DEFINES} -DSKIP_CHECK_WHEEL_SETUP=ON"
fi
mkdir -p ${PROJECT_ROOT}/build
pushd ${PROJECT_ROOT}/build
cmake ../ ${DEFINES} -DPYTHON=${PYTHON}
make -j$J
popd
}
function clean() {
rm -r -f ${PROJECT_ROOT}/build
rm -r -f ${PROJECT_ROOT}/pico-ps/build
rm -r -f ${PROJECT_ROOT}/pico-ps/pico-core/build
}
function publish_check() {
git diff
local git_diff=`git diff`
if [ "$git_diff" == "" ]; then
echo "git nodiff"
else
echo -e "please commit your change before publish"
return 1
fi
}
function exec_test() {
echo RUN TEST $@
if timeout --foreground 600 $@ 2>tmp/last_test.err; then
echo SUCESS! $@
else
cat tmp/last_test.err
echo FAILED! $@
exit 1
fi
}
function unit_test() {
# rm -rf ${PROJECT_ROOT}/.ut
mkdir -p tmp
exec_test python3 test/optimizer_test.py
# test examples
exec_test examples/run/criteo_deepctr_standalone.sh
exec_test examples/run/criteo_deepctr_horovod.sh
exec_test examples/run/criteo_deepctr_checkpoint.sh
exec_test examples/run/criteo_deepctr_mirrored.sh
exec_test examples/run/criteo_deepctr_mpi.sh
exec_test examples/run/criteo_preprocess.sh
exec_test examples/run/criteo_deepctr_horovod.sh
docker run --name serving-example -td -p 8500:8500 -p 8501:8501 \
-v `pwd`/tmp/criteo:/models/criteo -e MODEL_NAME=criteo tensorflow/serving:latest
sleep 5
examples/run/criteo_deepctr_restful.sh
docker stop serving-example
docker rm serving-example
nproc=`nproc`
if [ "$nproc" -ge "8" ]; then
nproc=8
fi
echo $nproc
# test train modes
for np in 1 $nproc; do
exec_test horovodrun -np $np python3 test/benchmark/criteo_deepctr.py \
--data tmp/dac_sample.csv --server --epochs 3
exec_test horovodrun -np $np python3 test/benchmark/criteo_deepctr.py \
--data tmp/dac_sample.csv --server --cache --epochs 3
exec_test horovodrun -np $np python3 test/benchmark/criteo_deepctr.py \
--data tmp/dac_sample.csv --server --cache --prefetch --epochs 3
done
# test only one batch
exec_test python3 test/benchmark/criteo_deepctr.py \
--data examples/train100.csv --batch_size 100 --server --cache --prefetch
exec_test horovodrun -np 2 python3 test/benchmark/criteo_deepctr.py \
--data examples/train100.csv --batch_size 50 --server --cache --prefetch
exec_test horovodrun -np $nproc python3 test/benchmark/criteo_deepctr.py \
--data examples/train100.csv --batch_size 10 --server --cache --prefetch
# test load dump
exec_test horovodrun -np 2 python3 examples/criteo_deepctr_hook.py --checkpoint tmp/epoch
exec_test horovodrun -np $nproc python3 examples/criteo_deepctr_hook.py \
--load tmp/epoch4/variables/variables
exec_test mpirun -np 2 python3 examples/criteo_deepctr_network_mpi.py --checkpoint tmp/epoch
exec_test mpirun -np $nproc python3 examples/criteo_deepctr_network_mpi.py \
--load tmp/epoch4/variables/variables --checkpoint tmp/epoch
exec_test python3 examples/criteo_deepctr_network_mirrored.py \
--load tmp/epoch4/variables/variables
# test with many all reduce
exec_test python3 examples/criteo_deepctr_network.py --data examples/wide100.csv
exec_test horovodrun -np $nproc python3 examples/criteo_deepctr_network.py --data examples/wide100.csv
}
case "$1" in
test)
unit_test
;;
clean)
clean
;;
build|"")
build
;;
*)
echo "unkown cmd"
exit 1
;;
esac