Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
c7c47523
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
c7c47523
编写于
8月 04, 2020
作者:
Z
zhangchunle
提交者:
GitHub
8月 04, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cherrypick1.8 update paddle_build.sh (#25904)
上级
05603c9a
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
223 addition
and
54 deletion
+223
-54
paddle/scripts/paddle_build.sh
paddle/scripts/paddle_build.sh
+208
-49
tools/print_signatures.py
tools/print_signatures.py
+4
-0
tools/sampcd_processor.py
tools/sampcd_processor.py
+11
-5
未找到文件。
paddle/scripts/paddle_build.sh
浏览文件 @
c7c47523
...
@@ -59,11 +59,14 @@ function init() {
...
@@ -59,11 +59,14 @@ function init() {
}
}
function
cmake_base
()
{
function
cmake_base
()
{
#
b
uild script will not fail if *.deb does not exist
#
B
uild script will not fail if *.deb does not exist
rm
*
.deb 2>/dev/null
||
true
rm
*
.deb 2>/dev/null
||
true
#
d
elete previous built whl packages
#
D
elete previous built whl packages
rm
-rf
python/dist 2>/dev/null
||
true
rm
-rf
python/dist 2>/dev/null
||
true
# `gym` is only used in unittest, it's not suitable to add in requirements.txt.
# Add it dynamically.
echo
"gym"
>>
${
PADDLE_ROOT
}
/python/requirements.txt
# Support build for all python versions, currently
# Support build for all python versions, currently
# including cp27-cp27m and cp27-cp27mu.
# including cp27-cp27m and cp27-cp27mu.
PYTHON_FLAGS
=
""
PYTHON_FLAGS
=
""
...
@@ -119,6 +122,8 @@ function cmake_base() {
...
@@ -119,6 +122,8 @@ function cmake_base() {
exit
1
exit
1
fi
fi
fi
fi
# delete `gym` to avoid modifying requirements.txt in *.whl
sed
-i
.bak
"/^gym
$/
d"
${
PADDLE_ROOT
}
/python/requirements.txt
else
else
if
[
"
$1
"
!=
""
]
;
then
if
[
"
$1
"
!=
""
]
;
then
echo
"using python abi:
$1
"
echo
"using python abi:
$1
"
...
@@ -175,6 +180,8 @@ function cmake_base() {
...
@@ -175,6 +180,8 @@ function cmake_base() {
else
else
pip
install
-r
${
PADDLE_ROOT
}
/python/requirements.txt
pip
install
-r
${
PADDLE_ROOT
}
/python/requirements.txt
fi
fi
# delete `gym` to avoid modifying requirements.txt in *.whl
sed
-i
"/^gym
$/
d"
${
PADDLE_ROOT
}
/python/requirements.txt
fi
fi
if
[
"
$SYSTEM
"
==
"Darwin"
]
;
then
if
[
"
$SYSTEM
"
==
"Darwin"
]
;
then
...
@@ -193,15 +200,12 @@ function cmake_base() {
...
@@ -193,15 +200,12 @@ function cmake_base() {
Configuring cmake in /paddle/build ...
Configuring cmake in /paddle/build ...
-DCMAKE_BUILD_TYPE=
${
CMAKE_BUILD_TYPE
:-
Release
}
-DCMAKE_BUILD_TYPE=
${
CMAKE_BUILD_TYPE
:-
Release
}
${
PYTHON_FLAGS
}
${
PYTHON_FLAGS
}
-DWITH_DSO=ON
-DWITH_GPU=
${
WITH_GPU
:-
OFF
}
-DWITH_GPU=
${
WITH_GPU
:-
OFF
}
-DWITH_AMD_GPU=
${
WITH_AMD_GPU
:-
OFF
}
-DWITH_AMD_GPU=
${
WITH_AMD_GPU
:-
OFF
}
-DWITH_DISTRIBUTE=
${
distibuted_flag
}
-DWITH_DISTRIBUTE=
${
distibuted_flag
}
-DWITH_MKL=
${
WITH_MKL
:-
ON
}
-DWITH_MKL=
${
WITH_MKL
:-
ON
}
-DWITH_AVX=
${
WITH_AVX
:-
OFF
}
-DWITH_AVX=
${
WITH_AVX
:-
OFF
}
-DWITH_GOLANG=
${
WITH_GOLANG
:-
OFF
}
-DCUDA_ARCH_NAME=
${
CUDA_ARCH_NAME
:-
All
}
-DCUDA_ARCH_NAME=
${
CUDA_ARCH_NAME
:-
All
}
-DCUDA_ARCH_BIN=
${
CUDA_ARCH_BIN
}
-DWITH_PYTHON=
${
WITH_PYTHON
:-
ON
}
-DWITH_PYTHON=
${
WITH_PYTHON
:-
ON
}
-DCUDNN_ROOT=/usr/
-DCUDNN_ROOT=/usr/
-DWITH_TESTING=
${
WITH_TESTING
:-
ON
}
-DWITH_TESTING=
${
WITH_TESTING
:-
ON
}
...
@@ -216,24 +220,23 @@ function cmake_base() {
...
@@ -216,24 +220,23 @@ function cmake_base() {
-DCMAKE_INSTALL_PREFIX=
${
INSTALL_PREFIX
:-
/paddle/build
}
-DCMAKE_INSTALL_PREFIX=
${
INSTALL_PREFIX
:-
/paddle/build
}
-DWITH_GRPC=
${
grpc_flag
}
-DWITH_GRPC=
${
grpc_flag
}
-DWITH_LITE=
${
WITH_LITE
:-
OFF
}
-DWITH_LITE=
${
WITH_LITE
:-
OFF
}
-DLITE_GIT_TAG=develop
========================================
========================================
EOF
EOF
# Disable UNITTEST_USE_VIRTUALENV in docker because
# Disable UNITTEST_USE_VIRTUALENV in docker because
# docker environment is fully controlled by this script.
# docker environment is fully controlled by this script.
# See /Paddle/CMakeLists.txt, UNITTEST_USE_VIRTUALENV option.
# See /Paddle/CMakeLists.txt, UNITTEST_USE_VIRTUALENV option.
set
+e
cmake ..
\
cmake ..
\
-DCMAKE_BUILD_TYPE
=
${
CMAKE_BUILD_TYPE
:-
Release
}
\
-DCMAKE_BUILD_TYPE
=
${
CMAKE_BUILD_TYPE
:-
Release
}
\
${
PYTHON_FLAGS
}
\
${
PYTHON_FLAGS
}
\
-DWITH_DSO
=
ON
\
-DWITH_GPU
=
${
WITH_GPU
:-
OFF
}
\
-DWITH_GPU
=
${
WITH_GPU
:-
OFF
}
\
-DWITH_AMD_GPU
=
${
WITH_AMD_GPU
:-
OFF
}
\
-DWITH_AMD_GPU
=
${
WITH_AMD_GPU
:-
OFF
}
\
-DWITH_DISTRIBUTE
=
${
distibuted_flag
}
\
-DWITH_DISTRIBUTE
=
${
distibuted_flag
}
\
-DWITH_MKL
=
${
WITH_MKL
:-
ON
}
\
-DWITH_MKL
=
${
WITH_MKL
:-
ON
}
\
-DWITH_AVX
=
${
WITH_AVX
:-
OFF
}
\
-DWITH_AVX
=
${
WITH_AVX
:-
OFF
}
\
-DNOAVX_CORE_FILE
=
${
NOAVX_CORE_FILE
:-
""
}
\
-DNOAVX_CORE_FILE
=
${
NOAVX_CORE_FILE
:-
""
}
\
-DWITH_GOLANG
=
${
WITH_GOLANG
:-
OFF
}
\
-DCUDA_ARCH_NAME
=
${
CUDA_ARCH_NAME
:-
All
}
\
-DCUDA_ARCH_NAME
=
${
CUDA_ARCH_NAME
:-
All
}
\
-DCUDA_ARCH_BIN
=
${
CUDA_ARCH_BIN
}
\
-DWITH_PYTHON
=
${
WITH_PYTHON
:-
ON
}
\
-DWITH_PYTHON
=
${
WITH_PYTHON
:-
ON
}
\
-DCUDNN_ROOT
=
/usr/
\
-DCUDNN_ROOT
=
/usr/
\
-DWITH_TESTING
=
${
WITH_TESTING
:-
ON
}
\
-DWITH_TESTING
=
${
WITH_TESTING
:-
ON
}
\
...
@@ -246,8 +249,11 @@ EOF
...
@@ -246,8 +249,11 @@ EOF
-DPY_VERSION
=
${
PY_VERSION
:-
2
.7
}
\
-DPY_VERSION
=
${
PY_VERSION
:-
2
.7
}
\
-DCMAKE_INSTALL_PREFIX
=
${
INSTALL_PREFIX
:-
/paddle/build
}
\
-DCMAKE_INSTALL_PREFIX
=
${
INSTALL_PREFIX
:-
/paddle/build
}
\
-DWITH_GRPC
=
${
grpc_flag
}
\
-DWITH_GRPC
=
${
grpc_flag
}
\
-DWITH_LITE
=
${
WITH_LITE
:-
OFF
}
-DLITE_GIT_TAG
=
develop
\
-DWITH_LITE
=
${
WITH_LITE
:-
OFF
}
;
build_error
=
$?
if
[
"
$build_error
"
!=
0
]
;
then
exit
7
;
fi
}
}
function
cmake_gen
()
{
function
cmake_gen
()
{
...
@@ -270,6 +276,7 @@ function check_style() {
...
@@ -270,6 +276,7 @@ function check_style() {
eval
"
$(
GIMME_GO_VERSION
=
1.8.3 gimme
)
"
eval
"
$(
GIMME_GO_VERSION
=
1.8.3 gimme
)
"
fi
fi
pip
install
cpplint pylint pytest astroid isort
pip
install
cpplint pylint pytest astroid isort
# set up go environment for running gometalinter
# set up go environment for running gometalinter
mkdir
-p
$GOPATH
/src/github.com/PaddlePaddle/
mkdir
-p
$GOPATH
/src/github.com/PaddlePaddle/
...
@@ -298,6 +305,7 @@ function check_style() {
...
@@ -298,6 +305,7 @@ function check_style() {
#=================================================
#=================================================
function
build_base
()
{
function
build_base
()
{
set
+e
if
[
"
$SYSTEM
"
==
"Linux"
]
;
then
if
[
"
$SYSTEM
"
==
"Linux"
]
;
then
if
[
`
nproc
`
-gt
16
]
;
then
if
[
`
nproc
`
-gt
16
]
;
then
parallel_number
=
$(
expr
`
nproc
`
- 8
)
parallel_number
=
$(
expr
`
nproc
`
- 8
)
...
@@ -315,7 +323,36 @@ function build_base() {
...
@@ -315,7 +323,36 @@ function build_base() {
make clean
make clean
fi
fi
make
install
-j
${
parallel_number
}
make
install
-j
${
parallel_number
}
;
build_error
=
$?
if
[
"
$build_error
"
!=
0
]
;
then
exit
7
;
fi
}
function
build_size
()
{
cat
<<
EOF
============================================
Calculate /paddle/build size and PR whl size
============================================
EOF
if
[
"
$1
"
==
"fluid_inference"
]
;
then
cd
${
PADDLE_ROOT
}
/build
cp
-r
fluid_inference_install_dir fluid_inference
tar
-czf
fluid_inference.tgz fluid_inference
buildSize
=
$(
du
-h
--max-depth
=
0
${
PADDLE_ROOT
}
/build/fluid_inference.tgz |awk
'{print $1}'
)
echo
"FLuid_Inference Size:
$buildSize
"
else
SYSTEM
=
`
uname
-s
`
if
[
"
$SYSTEM
"
==
"Darwin"
]
;
then
com
=
'du -h -d 0'
else
com
=
'du -h --max-depth=0'
fi
buildSize
=
$(
$com
${
PADDLE_ROOT
}
/build |awk
'{print $1}'
)
echo
"Build Size:
$buildSize
"
PR_whlSize
=
$(
$com
${
PADDLE_ROOT
}
/build/python/dist |awk
'{print $1}'
)
echo
"PR whl Size:
$PR_whlSize
"
fi
}
}
function
build
()
{
function
build
()
{
...
@@ -327,9 +364,22 @@ function build() {
...
@@ -327,9 +364,22 @@ function build() {
============================================
============================================
EOF
EOF
build_base
$@
build_base
$@
current_branch
=
`
git branch |
grep
\*
|
cut
-d
' '
-f2
`
if
[
"
$current_branch
"
!=
"develop_base_pr"
]
;
then
build_size
fi
}
function
cmake_gen_and_build
()
{
startTime_s
=
`
date
+%s
`
cmake_gen
$1
build
$2
endTime_s
=
`
date
+%s
`
echo
"Build Time:
$[
$endTime_s
-
$startTime_s
]s"
}
}
function
build_mac
()
{
function
build_mac
()
{
set
+e
mkdir
-p
${
PADDLE_ROOT
}
/build
mkdir
-p
${
PADDLE_ROOT
}
/build
cd
${
PADDLE_ROOT
}
/build
cd
${
PADDLE_ROOT
}
/build
cat
<<
EOF
cat
<<
EOF
...
@@ -340,7 +390,20 @@ EOF
...
@@ -340,7 +390,20 @@ EOF
if
[[
"
$ENABLE_MAKE_CLEAN
"
!=
"OFF"
]]
;
then
if
[[
"
$ENABLE_MAKE_CLEAN
"
!=
"OFF"
]]
;
then
make clean
make clean
fi
fi
make
install
-j
8
make
install
-j
8
;
build_error
=
$?
if
[
"
$build_error
"
!=
0
]
;
then
exit
7
;
fi
set
-e
build_size
}
function
cmake_gen_and_build_mac
()
{
startTime_s
=
`
date
+%s
`
cmake_gen
$1
build_mac
endTime_s
=
`
date
+%s
`
echo
"Build Time:
$[
$endTime_s
-
$startTime_s
]s"
}
}
function
run_test
()
{
function
run_test
()
{
...
@@ -428,12 +491,11 @@ function run_mac_test() {
...
@@ -428,12 +491,11 @@ function run_mac_test() {
Running unit tests ...
Running unit tests ...
========================================
========================================
EOF
EOF
#remove proxy here to fix dist error on mac
#remove proxy here to fix dist ut 'test_fl_listen_and_serv_op' error on mac.
#see details: https://github.com/PaddlePaddle/Paddle/issues/24738
my_proxy
=
$http_proxy
my_proxy
=
$http_proxy
export
http_proxy
=
export
http_proxy
=
export
https_proxy
=
export
https_proxy
=
# make install should also be test when unittest
make
install
-j
8
set
+ex
set
+ex
if
[
"
$1
"
==
"cp27-cp27m"
]
;
then
if
[
"
$1
"
==
"cp27-cp27m"
]
;
then
...
@@ -458,8 +520,10 @@ EOF
...
@@ -458,8 +520,10 @@ EOF
elif
[
"
$1
"
==
"cp37-cp37m"
]
;
then
elif
[
"
$1
"
==
"cp37-cp37m"
]
;
then
pip3.7
install
--user
${
INSTALL_PREFIX
:-
/paddle/build
}
/opt/paddle/share/wheels/
*
.whl
pip3.7
install
--user
${
INSTALL_PREFIX
:-
/paddle/build
}
/opt/paddle/share/wheels/
*
.whl
fi
fi
ut_startTime_s
=
`
date
+%s
`
ctest
--output-on-failure
-j
$2
ctest
--output-on-failure
-j
$2
ut_endTime_s
=
`
date
+%s
`
echo
"Mac testCase Time:
$[
$ut_endTime_s
-
$ut_startTime_s
]s"
paddle version
paddle version
# Recovery proxy to avoid failure in later steps
# Recovery proxy to avoid failure in later steps
export
http_proxy
=
$my_proxy
export
http_proxy
=
$my_proxy
...
@@ -520,6 +584,10 @@ function generate_api_spec() {
...
@@ -520,6 +584,10 @@ function generate_api_spec() {
op_desc_path
=
${
PADDLE_ROOT
}
/paddle/fluid/OP_DESC_
${
spec_kind
}
.spec
op_desc_path
=
${
PADDLE_ROOT
}
/paddle/fluid/OP_DESC_
${
spec_kind
}
.spec
python
${
PADDLE_ROOT
}
/tools/print_op_desc.py
>
$op_desc_path
python
${
PADDLE_ROOT
}
/tools/print_op_desc.py
>
$op_desc_path
# print api and the md5 of source code of the api.
api_source_md5_path
=
${
PADDLE_ROOT
}
/paddle/fluid/API_
${
spec_kind
}
.source.md5
python
${
PADDLE_ROOT
}
/tools/count_api_without_core_ops.py
-p
paddle
>
$api_source_md5_path
awk
-F
'('
'{print $NF}'
$spec_path
>
${
spec_path
}
.doc
awk
-F
'('
'{print $NF}'
$spec_path
>
${
spec_path
}
.doc
awk
-F
'('
'{$NF="";print $0}'
$spec_path
>
${
spec_path
}
.api
awk
-F
'('
'{$NF="";print $0}'
$spec_path
>
${
spec_path
}
.api
if
[
"
$1
"
==
"cp35-cp35m"
]
||
[
"
$1
"
==
"cp36-cp36m"
]
||
[
"
$1
"
==
"cp37-cp37m"
]
;
then
if
[
"
$1
"
==
"cp35-cp35m"
]
||
[
"
$1
"
==
"cp36-cp36m"
]
||
[
"
$1
"
==
"cp37-cp37m"
]
;
then
...
@@ -612,9 +680,9 @@ EOF
...
@@ -612,9 +680,9 @@ EOF
function
assert_api_spec_approvals
()
{
function
assert_api_spec_approvals
()
{
/bin/bash
${
PADDLE_ROOT
}
/tools/check_api_approvals.sh
/bin/bash
${
PADDLE_ROOT
}
/tools/check_api_approvals.sh
;
approval_error
=
$?
if
[
"
$
?
"
!=
0
]
;
then
if
[
"
$
approval_error
"
!=
0
]
;
then
exit
1
exit
6
fi
fi
}
}
...
@@ -684,9 +752,42 @@ function caught_error() {
...
@@ -684,9 +752,42 @@ function caught_error() {
done
done
}
}
function
case_count
(){
cat
<<
EOF
============================================
Generating TestCases Count ...
============================================
EOF
testcases
=
$1
num
=
$(
echo
$testcases
|grep
-o
'\^'
|wc
-l
)
if
[
"
$2
"
==
""
]
;
then
echo
"exclusive TestCases count is
$num
"
else
echo
"
$2
card TestCases count is
$num
"
fi
}
failed_test_lists
=
''
tmp_dir
=
`
mktemp
-d
`
function
collect_failed_tests
()
{
for
file
in
`
ls
$tmp_dir
`
;
do
exit_code
=
0
grep
-q
'The following tests FAILED:'
$tmp_dir
/
$file
||
exit_code
=
$?
if
[
$exit_code
-ne
0
]
;
then
failuretest
=
''
else
failuretest
=
`
grep
-A
10000
'The following tests FAILED:'
$tmp_dir
/
$file
|
sed
's/The following tests FAILED://g'
|sed
'/^$/d'
`
failed_test_lists
=
"
${
failed_test_lists
}
${
failuretest
}
"
fi
done
}
function
card_test
()
{
function
card_test
()
{
set
-m
set
-m
case_count
$1
$2
ut_startTime_s
=
`
date
+%s
`
# get the CUDA device count
# get the CUDA device count
CUDA_DEVICE_COUNT
=
$(
nvidia-smi
-L
|
wc
-l
)
CUDA_DEVICE_COUNT
=
$(
nvidia-smi
-L
|
wc
-l
)
...
@@ -705,7 +806,7 @@ function card_test() {
...
@@ -705,7 +806,7 @@ function card_test() {
fi
fi
trap
'caught_error'
CHLD
trap
'caught_error'
CHLD
tmpfile_rand
=
`
date
+%s%N
`
NUM_PROC
=
$[
CUDA_DEVICE_COUNT/
$cardnumber
]
NUM_PROC
=
$[
CUDA_DEVICE_COUNT/
$cardnumber
]
for
((
i
=
0
;
i <
$NUM_PROC
;
i++
))
;
do
for
((
i
=
0
;
i <
$NUM_PROC
;
i++
))
;
do
# CUDA_VISIBLE_DEVICES http://acceleware.com/blog/cudavisibledevices-masking-gpus
# CUDA_VISIBLE_DEVICES http://acceleware.com/blog/cudavisibledevices-masking-gpus
...
@@ -718,26 +819,32 @@ function card_test() {
...
@@ -718,26 +819,32 @@ function card_test() {
cuda_list
=
"
$cuda_list
,
$[
i*cardnumber+j]"
cuda_list
=
"
$cuda_list
,
$[
i*cardnumber+j]"
fi
fi
done
done
tmpfile
=
$tmp_dir
/
$tmpfile_rand
"_"
$i
if
[
${
TESTING_DEBUG_MODE
:-
OFF
}
==
"ON"
]
;
then
if
[
${
TESTING_DEBUG_MODE
:-
OFF
}
==
"ON"
]
;
then
if
[[
$cardnumber
==
$CUDA_DEVICE_COUNT
]]
;
then
if
[[
$cardnumber
==
$CUDA_DEVICE_COUNT
]]
;
then
ctest
-I
$i
,,
$NUM_PROC
-R
"(
$testcases
)"
-V
&
(
ctest
-I
$i
,,
$NUM_PROC
-R
"(
$testcases
)"
-V
|
tee
$tmpfile
;
test
${
PIPESTATUS
[0]
}
-eq
0
)
&
else
else
env
CUDA_VISIBLE_DEVICES
=
$cuda_list
ctest
-I
$i
,,
$NUM_PROC
-R
"(
$testcases
)"
-V
&
(
env
CUDA_VISIBLE_DEVICES
=
$cuda_list
ctest
-I
$i
,,
$NUM_PROC
-R
"(
$testcases
)"
-V
|
tee
$tmpfile
;
test
${
PIPESTATUS
[0]
}
-eq
0
)
&
fi
fi
else
else
if
[[
$cardnumber
==
$CUDA_DEVICE_COUNT
]]
;
then
if
[[
$cardnumber
==
$CUDA_DEVICE_COUNT
]]
;
then
ctest
-I
$i
,,
$NUM_PROC
-R
"(
$testcases
)"
--output-on-failure
&
(
ctest
-I
$i
,,
$NUM_PROC
-R
"(
$testcases
)"
--output-on-failure
|
tee
$tmpfile
;
test
${
PIPESTATUS
[0]
}
-eq
0
)
&
else
else
env
CUDA_VISIBLE_DEVICES
=
$cuda_list
ctest
-I
$i
,,
$NUM_PROC
-R
"(
$testcases
)"
--output-on-failure
&
(
env
CUDA_VISIBLE_DEVICES
=
$cuda_list
ctest
-I
$i
,,
$NUM_PROC
-R
"(
$testcases
)"
--output-on-failure
|
tee
$tmpfile
;
test
${
PIPESTATUS
[0]
}
-eq
0
)
&
fi
fi
fi
fi
done
done
wait
;
# wait for all subshells to finish
wait
;
# wait for all subshells to finish
ut_endTime_s
=
`
date
+%s
`
if
[
"
$2
"
==
""
]
;
then
echo
"exclusive TestCases Total Time:
$[
$ut_endTime_s
-
$ut_startTime_s
]s"
else
echo
"
$2
card TestCases Total Time:
$[
$ut_endTime_s
-
$ut_startTime_s
]s"
fi
set
+m
set
+m
}
}
function
parallel_test_base
()
{
function
parallel_test_base
_gpu
()
{
if
[
${
WITH_TESTING
:-
ON
}
==
"ON"
]
;
then
if
[
${
WITH_TESTING
:-
ON
}
==
"ON"
]
;
then
cat
<<
EOF
cat
<<
EOF
========================================
========================================
...
@@ -786,6 +893,15 @@ set +x
...
@@ -786,6 +893,15 @@ set +x
multiple_card_tests
=
"
$multiple_card_tests
|^
$testcase
$"
multiple_card_tests
=
"
$multiple_card_tests
|^
$testcase
$"
fi
fi
else
else
if
[[
"
${#
single_card_tests
}
"
-gt
3000
]]
;
then
if
[[
"
$single_card_tests_1
"
==
""
]]
;
then
single_card_tests_1
=
"^
$testcase
$"
else
single_card_tests_1
=
"
$single_card_tests_1
|^
$testcase
$"
fi
continue
fi
if
[[
"
$single_card_tests
"
==
""
]]
;
then
if
[[
"
$single_card_tests
"
==
""
]]
;
then
single_card_tests
=
"^
$testcase
$"
single_card_tests
=
"^
$testcase
$"
else
else
...
@@ -799,8 +915,19 @@ set +x
...
@@ -799,8 +915,19 @@ set +x
done
<<<
"
$test_cases
"
;
done
<<<
"
$test_cases
"
;
card_test
"
$single_card_tests
"
1
# run cases with single GPU
card_test
"
$single_card_tests
"
1
# run cases with single GPU
card_test
"
$single_card_tests_1
"
1
# run cases with single GPU
card_test
"
$multiple_card_tests
"
2
# run cases with two GPUs
card_test
"
$multiple_card_tests
"
2
# run cases with two GPUs
card_test
"
$exclusive_tests
"
# run cases exclusively, in this cases would be run with 4/8 GPUs
card_test
"
$exclusive_tests
"
# run cases exclusively, in this cases would be run with 4/8 GPUs
collect_failed_tests
if
[
-n
"
${
failed_test_lists
}
"
]
;
then
failed_test_lists_ult
=
`
echo
"
${
failed_test_lists
}
"
|grep
-Po
'[^ ].*$'
`
echo
"========================================"
echo
"Summary Failed Tests... "
echo
"========================================"
echo
"The following tests FAILED: "
echo
"
${
failed_test_lists_ult
}
"
fi
rm
-f
$tmp_dir
/
*
if
[[
"
$EXIT_CODE
"
!=
"0"
]]
;
then
if
[[
"
$EXIT_CODE
"
!=
"0"
]]
;
then
exit
8
;
exit
8
;
fi
fi
...
@@ -808,10 +935,36 @@ set -ex
...
@@ -808,10 +935,36 @@ set -ex
fi
fi
}
}
function
parallel_test_base_cpu
()
{
mkdir
-p
${
PADDLE_ROOT
}
/build
cd
${
PADDLE_ROOT
}
/build
if
[
${
WITH_TESTING
:-
ON
}
==
"ON"
]
;
then
cat
<<
EOF
========================================
Running unit cpu tests ...
========================================
EOF
ut_startTime_s
=
`
date
+%s
`
ctest
--output-on-failure
-j
$1
ut_endTime_s
=
`
date
+%s
`
echo
"CPU testCase Time:
$[
$ut_endTime_s
-
$ut_startTime_s
]s"
if
[[
"
$EXIT_CODE
"
!=
"0"
]]
;
then
exit
8
;
fi
fi
}
function
parallel_test
()
{
function
parallel_test
()
{
ut_total_startTime_s
=
`
date
+%s
`
mkdir
-p
${
PADDLE_ROOT
}
/build
mkdir
-p
${
PADDLE_ROOT
}
/build
cd
${
PADDLE_ROOT
}
/build
cd
${
PADDLE_ROOT
}
/build
parallel_test_base
if
[
"
$WITH_GPU
"
==
"ON"
]
;
then
parallel_test_base_gpu
else
parallel_test_base_cpu
${
PROC_RUN
:-
1
}
fi
ut_total_endTime_s
=
`
date
+%s
`
echo
"TestCases Total Time:
$[
$ut_total_endTime_s
-
$ut_total_startTime_s
]s"
}
}
function
enable_unused_var_check
()
{
function
enable_unused_var_check
()
{
...
@@ -1069,10 +1222,17 @@ EOF
...
@@ -1069,10 +1222,17 @@ EOF
if
[[
"
$1
"
!=
""
]]
;
then
if
[[
"
$1
"
!=
""
]]
;
then
parallel_number
=
$1
parallel_number
=
$1
fi
fi
cmake ..
-DWITH_DISTRIBUTE
=
OFF
-DON_INFER
=
ON
-DCUDA_ARCH_NAME
=
${
CUDA_ARCH_NAME
:-
Auto
}
-DCUDA_ARCH_BIN
=
${
CUDA_ARCH_BIN
}
startTime_s
=
`
date
+%s
`
set
+e
make
-j
${
parallel_number
}
fluid_lib_dist
cmake ..
-DWITH_DISTRIBUTE
=
OFF
-DON_INFER
=
ON
-DCUDA_ARCH_NAME
=
${
CUDA_ARCH_NAME
:-
Auto
}
;
build_error
=
$?
make
-j
${
parallel_number
}
inference_lib_dist
make
-j
${
parallel_number
}
fluid_lib_dist
;
build_error
=
$?
make
-j
${
parallel_number
}
inference_lib_dist
;
build_error
=
$?
if
[
"
$build_error
"
!=
0
]
;
then
exit
7
;
fi
endTime_s
=
`
date
+%s
`
echo
"Build Time:
$[
$endTime_s
-
$startTime_s
]s"
build_size
"fluid_inference"
}
}
function
tar_fluid_lib
()
{
function
tar_fluid_lib
()
{
...
@@ -1094,10 +1254,13 @@ function test_fluid_lib() {
...
@@ -1094,10 +1254,13 @@ function test_fluid_lib() {
Testing fluid library for inference ...
Testing fluid library for inference ...
========================================
========================================
EOF
EOF
fluid_startTime_s
=
`
date
+%s
`
cd
${
PADDLE_ROOT
}
/paddle/fluid/inference/api/demo_ci
cd
${
PADDLE_ROOT
}
/paddle/fluid/inference/api/demo_ci
./run.sh
${
PADDLE_ROOT
}
${
WITH_MKL
:-
ON
}
${
WITH_GPU
:-
OFF
}
${
INFERENCE_DEMO_INSTALL_DIR
}
\
./run.sh
${
PADDLE_ROOT
}
${
WITH_MKL
:-
ON
}
${
WITH_GPU
:-
OFF
}
${
INFERENCE_DEMO_INSTALL_DIR
}
\
${
TENSORRT_INCLUDE_DIR
:-
/usr/local/TensorRT/include
}
\
${
TENSORRT_INCLUDE_DIR
:-
/usr/local/TensorRT/include
}
\
${
TENSORRT_LIB_DIR
:-
/usr/local/TensorRT/lib
}
${
TENSORRT_LIB_DIR
:-
/usr/local/TensorRT/lib
}
fluid_endTime_s
=
`
date
+%s
`
echo
"test_fluid_lib Total Time:
$[
$fluid_endTime_s
-
$fluid_startTime_s
]s"
./clean.sh
./clean.sh
}
}
...
@@ -1107,8 +1270,11 @@ function test_fluid_lib_train() {
...
@@ -1107,8 +1270,11 @@ function test_fluid_lib_train() {
Testing fluid library for training ...
Testing fluid library for training ...
========================================
========================================
EOF
EOF
fluid_train_startTime_s
=
`
date
+%s
`
cd
${
PADDLE_ROOT
}
/paddle/fluid/train/demo
cd
${
PADDLE_ROOT
}
/paddle/fluid/train/demo
./run.sh
${
PADDLE_ROOT
}
${
WITH_MKL
:-
ON
}
./run.sh
${
PADDLE_ROOT
}
${
WITH_MKL
:-
ON
}
fluid_train_endTime_s
=
`
date
+%s
`
echo
"test_fluid_lib_train Total Time:
$[
$fluid_train_endTime_s
-
$fluid_train_startTime_s
]s"
./clean.sh
./clean.sh
}
}
...
@@ -1121,28 +1287,25 @@ function example() {
...
@@ -1121,28 +1287,25 @@ function example() {
pip
install
${
PADDLE_ROOT
}
/build/python/dist/
*
.whl
pip
install
${
PADDLE_ROOT
}
/build/python/dist/
*
.whl
paddle version
paddle version
cd
${
PADDLE_ROOT
}
/tools
cd
${
PADDLE_ROOT
}
/tools
python sampcd_processor.py cpu
python sampcd_processor.py cpu
;
example_error
=
$?
if
[
"
$
?
"
!=
"0"
]
;
then
if
[
"
$
example_error
"
!=
"0"
]
;
then
echo
"Code instance execution failed"
echo
"Code instance execution failed"
exit
1
exit
5
fi
fi
}
}
function
main
()
{
function
main
()
{
local
CMD
=
$1
local
CMD
=
$1
local
parallel_number
=
$2
local
parallel_number
=
$2
init
init
case
$CMD
in
case
$CMD
in
build_only
)
build_only
)
cmake_gen
${
PYTHON_ABI
:-
""
}
cmake_gen_and_build
${
PYTHON_ABI
:-
""
}
${
parallel_number
}
build
${
parallel_number
}
;;
;;
build_and_check
)
build_and_check
)
check_style
check_style
generate_upstream_develop_api_spec
${
PYTHON_ABI
:-
""
}
${
parallel_number
}
generate_upstream_develop_api_spec
${
PYTHON_ABI
:-
""
}
${
parallel_number
}
cmake_gen
${
PYTHON_ABI
:-
""
}
cmake_gen_and_build
${
PYTHON_ABI
:-
""
}
${
parallel_number
}
build
${
parallel_number
}
check_sequence_op_unittest
check_sequence_op_unittest
generate_api_spec
${
PYTHON_ABI
:-
""
}
"PR"
generate_api_spec
${
PYTHON_ABI
:-
""
}
"PR"
example
example
...
@@ -1198,8 +1361,7 @@ function main() {
...
@@ -1198,8 +1361,7 @@ function main() {
;;
;;
cicheck_coverage
)
cicheck_coverage
)
check_approvals_of_unittest 1
check_approvals_of_unittest 1
cmake_gen
${
PYTHON_ABI
:-
""
}
cmake_gen_and_build
${
PYTHON_ABI
:-
""
}
${
parallel_number
}
build
${
parallel_number
}
enable_unused_var_check
enable_unused_var_check
parallel_test
parallel_test
check_coverage
check_coverage
...
@@ -1227,13 +1389,11 @@ function main() {
...
@@ -1227,13 +1389,11 @@ function main() {
assert_api_spec_approvals
assert_api_spec_approvals
;;
;;
maccheck
)
maccheck
)
cmake_gen
${
PYTHON_ABI
:-
""
}
cmake_gen_and_build_mac
${
PYTHON_ABI
:-
""
}
build_mac
run_mac_test
${
PYTHON_ABI
:-
""
}
${
PROC_RUN
:-
1
}
run_mac_test
${
PYTHON_ABI
:-
""
}
${
PROC_RUN
:-
1
}
;;
;;
maccheck_py35
)
maccheck_py35
)
cmake_gen
${
PYTHON_ABI
:-
""
}
cmake_gen_and_build_mac
${
PYTHON_ABI
:-
""
}
build_mac
run_mac_test
${
PYTHON_ABI
:-
""
}
${
PROC_RUN
:-
1
}
run_mac_test
${
PYTHON_ABI
:-
""
}
${
PROC_RUN
:-
1
}
check_change_of_unittest
${
PYTHON_ABI
:-
""
}
check_change_of_unittest
${
PYTHON_ABI
:-
""
}
;;
;;
...
@@ -1242,8 +1402,7 @@ function main() {
...
@@ -1242,8 +1402,7 @@ function main() {
build_mac
build_mac
;;
;;
cicheck_py35
)
cicheck_py35
)
cmake_gen
${
PYTHON_ABI
:-
""
}
cmake_gen_and_build
${
PYTHON_ABI
:-
""
}
${
parallel_number
}
build
${
parallel_number
}
parallel_test
parallel_test
;;
;;
cmake_gen
)
cmake_gen
)
...
...
tools/print_signatures.py
浏览文件 @
c7c47523
...
@@ -105,6 +105,10 @@ def visit_member(parent_name, member):
...
@@ -105,6 +105,10 @@ def visit_member(parent_name, member):
if
hasattr
(
value
,
'__name__'
)
and
(
not
name
.
startswith
(
"_"
)
or
if
hasattr
(
value
,
'__name__'
)
and
(
not
name
.
startswith
(
"_"
)
or
name
==
"__init__"
):
name
==
"__init__"
):
visit_member
(
cur_name
,
value
)
visit_member
(
cur_name
,
value
)
elif
inspect
.
ismethoddescriptor
(
member
):
return
elif
inspect
.
isbuiltin
(
member
):
return
elif
callable
(
member
):
elif
callable
(
member
):
queue_dict
(
member
,
cur_name
)
queue_dict
(
member
,
cur_name
)
elif
inspect
.
isgetsetdescriptor
(
member
):
elif
inspect
.
isgetsetdescriptor
(
member
):
...
...
tools/sampcd_processor.py
浏览文件 @
c7c47523
...
@@ -470,7 +470,7 @@ def get_filenames():
...
@@ -470,7 +470,7 @@ def get_filenames():
except
AttributeError
:
except
AttributeError
:
whl_error
.
append
(
api
)
whl_error
.
append
(
api
)
continue
continue
if
len
(
module
.
split
(
'.'
))
>
2
:
if
len
(
module
.
split
(
'.'
))
>
1
:
filename
=
'../python/'
filename
=
'../python/'
module_py
=
'%s.py'
%
module
.
split
(
'.'
)[
-
1
]
module_py
=
'%s.py'
%
module
.
split
(
'.'
)[
-
1
]
for
i
in
range
(
0
,
len
(
module
.
split
(
'.'
))
-
1
):
for
i
in
range
(
0
,
len
(
module
.
split
(
'.'
))
-
1
):
...
@@ -478,9 +478,15 @@ def get_filenames():
...
@@ -478,9 +478,15 @@ def get_filenames():
filename
=
filename
+
module_py
filename
=
filename
+
module_py
else
:
else
:
filename
=
''
filename
=
''
print
(
"
\n
----Exception in get api filename----
\n
"
)
print
(
"
\n
WARNING:
----Exception in get api filename----
\n
"
)
print
(
"
\n
"
+
api
+
' module is '
+
module
+
"
\n
"
)
print
(
"
\n
"
+
api
+
' module is '
+
module
+
"
\n
"
)
if
filename
not
in
filenames
:
if
filename
!=
''
:
# rm contrib file
if
filename
.
startswith
(
'../python/paddle/fluid/contrib'
)
or
filename
==
'../python/paddle/verison.py'
:
pass
elif
filename
not
in
filenames
:
filenames
.
append
(
filename
)
filenames
.
append
(
filename
)
# get all methods
# get all methods
method
=
''
method
=
''
...
@@ -492,7 +498,7 @@ def get_filenames():
...
@@ -492,7 +498,7 @@ def get_filenames():
name
=
'%s.%s'
%
(
api
.
split
(
'.'
)[
-
2
],
api
.
split
(
'.'
)[
-
1
])
name
=
'%s.%s'
%
(
api
.
split
(
'.'
)[
-
2
],
api
.
split
(
'.'
)[
-
1
])
else
:
else
:
name
=
''
name
=
''
print
(
"
\n
----Exception in get api methods----
\n
"
)
print
(
"
\n
WARNING:
----Exception in get api methods----
\n
"
)
print
(
"
\n
"
+
line
+
"
\n
"
)
print
(
"
\n
"
+
line
+
"
\n
"
)
print
(
"
\n
"
+
api
+
' method is None!!!'
+
"
\n
"
)
print
(
"
\n
"
+
api
+
' method is None!!!'
+
"
\n
"
)
for
j
in
range
(
2
,
len
(
module
.
split
(
'.'
))):
for
j
in
range
(
2
,
len
(
module
.
split
(
'.'
))):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录