未验证 提交 290be88d 编写于 作者: Y YUNSHEN XIE 提交者: GitHub

use busybox run test on windows openblas (#31728)

* use busybox run test on windows openblas

* fix error

* fix disable_quick and nightly lable issue

* add retry on windows openblas

* fix bug

* use one file to run cpu and gpu tests

* fix with grep warning

* fix syntax error

* change run_unittest to run_unittest_gpu

* Update run_unittests.sh

fix error
上级 69c874fd
...@@ -52,6 +52,8 @@ if not defined WITH_CACHE set WITH_CACHE=OFF ...@@ -52,6 +52,8 @@ if not defined WITH_CACHE set WITH_CACHE=OFF
if not defined WITH_UNITY_BUILD set WITH_UNITY_BUILD=OFF if not defined WITH_UNITY_BUILD set WITH_UNITY_BUILD=OFF
if not defined INFERENCE_DEMO_INSTALL_DIR set INFERENCE_DEMO_INSTALL_DIR=%cache_dir:\=/%/inference_demo if not defined INFERENCE_DEMO_INSTALL_DIR set INFERENCE_DEMO_INSTALL_DIR=%cache_dir:\=/%/inference_demo
if not defined LOG_LEVEL set LOG_LEVEL=normal if not defined LOG_LEVEL set LOG_LEVEL=normal
if not defined PRECISION_TEST set PRECISION_TEST=OFF
if not defined NIGHTLY_MODE set PRECISION_TEST=OFF
rem -------set cache build directory----------- rem -------set cache build directory-----------
rmdir build\python /s/q rmdir build\python /s/q
...@@ -501,7 +503,7 @@ setlocal enabledelayedexpansion ...@@ -501,7 +503,7 @@ setlocal enabledelayedexpansion
set CUDA_DEVICE_COUNT=1 set CUDA_DEVICE_COUNT=1
set FLAGS_fraction_of_gpu_memory_to_use=0.92 set FLAGS_fraction_of_gpu_memory_to_use=0.92
%cache_dir%\tools\busybox64.exe bash %work_dir%\tools\windows\run_unittests.sh %NIGHTLY_MODE% %PRECISION_TEST% %cache_dir%\tools\busybox64.exe bash %work_dir%\tools\windows\run_unittests.sh %NIGHTLY_MODE% %PRECISION_TEST% %WITH_GPU%
goto:eof goto:eof
...@@ -510,7 +512,7 @@ echo ======================================== ...@@ -510,7 +512,7 @@ echo ========================================
echo Running CPU unit tests in parallel way ... echo Running CPU unit tests in parallel way ...
echo ======================================== echo ========================================
ctest.exe -E "(%disable_ut_quickly%)" -LE %nightly_label% --output-on-failure -C Release -j 8 --repeat until-pass:4 after-timeout:4 %cache_dir%\tools\busybox64.exe bash %work_dir%\tools\windows\run_unittests.sh %NIGHTLY_MODE% %PRECISION_TEST% %WITH_GPU%
goto:eof goto:eof
......
...@@ -16,6 +16,7 @@ set -e ...@@ -16,6 +16,7 @@ set -e
set +x set +x
NIGHTLY_MODE=$1 NIGHTLY_MODE=$1
PRECISION_TEST=$2 PRECISION_TEST=$2
WITH_GPU=$3
export PADDLE_ROOT="$(cd "$PWD/../" && pwd )" export PADDLE_ROOT="$(cd "$PWD/../" && pwd )"
if [ ${NIGHTLY_MODE:-OFF} == "ON" ]; then if [ ${NIGHTLY_MODE:-OFF} == "ON" ]; then
...@@ -204,23 +205,26 @@ long_time_test="^best_fit_allocator_test$|\ ...@@ -204,23 +205,26 @@ long_time_test="^best_fit_allocator_test$|\
^test_strided_slice_op$|\ ^test_strided_slice_op$|\
^test_transpose_op$" ^test_transpose_op$"
export FLAGS_call_stack_level=2 if [ ${WITH_GPU:-OFF} == "ON" ];then
export FLAGS_fraction_of_gpu_memory_to_use=0.92 export FLAGS_call_stack_level=2
export CUDA_VISIBLE_DEVICES=0 export FLAGS_fraction_of_gpu_memory_to_use=0.92
export CUDA_VISIBLE_DEVICES=0
UT_list=$(ctest -N | awk -F ': ' '{print $2}' | sed '/^$/d' | sed '$d') UT_list=$(ctest -N | awk -F ': ' '{print $2}' | sed '/^$/d' | sed '$d')
num=$(ctest -N | awk -F ': ' '{print $2}' | sed '/^$/d' | sed '$d' | wc -l) num=$(ctest -N | awk -F ': ' '{print $2}' | sed '/^$/d' | sed '$d' | wc -l)
echo "Windows 1 card TestCases count is $num" echo "Windows 1 card TestCases count is $num"
if [ ${PRECISION_TEST:-OFF} == "ON" ]; then if [ ${PRECISION_TEST:-OFF} == "ON" ]; then
python ${PADDLE_ROOT}/tools/get_pr_ut.py python ${PADDLE_ROOT}/tools/get_pr_ut.py
if [[ -f "ut_list" ]]; then if [[ -f "ut_list" ]]; then
set +x
echo "PREC length: "`wc -l ut_list` echo "PREC length: "`wc -l ut_list`
precision_cases=`cat ut_list` precision_cases=`cat ut_list`
set -x
fi
fi fi
fi
set +e set +e
if [ ${PRECISION_TEST:-OFF} == "ON" ] && [[ "$precision_cases" != "" ]];then if [ ${PRECISION_TEST:-OFF} == "ON" ] && [[ "$precision_cases" != "" ]];then
UT_list_prec='' UT_list_prec=''
re=$(cat ut_list|awk -F ' ' '{print }' | awk 'BEGIN{ all_str=""}{if (all_str==""){all_str=$1}else{all_str=all_str"$|^"$1}} END{print "^"all_str"$"}') re=$(cat ut_list|awk -F ' ' '{print }' | awk 'BEGIN{ all_str=""}{if (all_str==""){all_str=$1}else{all_str=all_str"$|^"$1}} END{print "^"all_str"$"}')
for case in $UT_list; do for case in $UT_list; do
...@@ -236,15 +240,15 @@ if [ ${PRECISION_TEST:-OFF} == "ON" ] && [[ "$precision_cases" != "" ]];then ...@@ -236,15 +240,15 @@ if [ ${PRECISION_TEST:-OFF} == "ON" ] && [[ "$precision_cases" != "" ]];then
fi fi
done done
UT_list=$UT_list_prec UT_list=$UT_list_prec
fi fi
set -e set -e
output=$(python ${PADDLE_ROOT}/tools/parallel_UT_rule.py "${UT_list}")
cpu_parallel_job=$(echo $output | cut -d ";" -f 1)
tetrad_parallel_job=$(echo $output | cut -d ";" -f 2)
two_parallel_job=$(echo $output | cut -d ";" -f 3)
non_parallel_job=$(echo $output | cut -d ";" -f 4)
output=$(python ${PADDLE_ROOT}/tools/parallel_UT_rule.py "${UT_list}")
cpu_parallel_job=$(echo $output | cut -d ";" -f 1)
tetrad_parallel_job=$(echo $output | cut -d ";" -f 2)
two_parallel_job=$(echo $output | cut -d ";" -f 3)
non_parallel_job=$(echo $output | cut -d ";" -f 4)
fi
failed_test_lists='' failed_test_lists=''
tmp_dir=`mktemp -d` tmp_dir=`mktemp -d`
...@@ -264,7 +268,13 @@ function collect_failed_tests() { ...@@ -264,7 +268,13 @@ function collect_failed_tests() {
set -e set -e
} }
function run_unittest() { function run_unittest_cpu() {
tmpfile=$tmp_dir/$RANDOM
(ctest -E "${disable_ut_quickly}" -LE "${nightly_label}" --output-on-failure -C Release -j 8 | tee $tmpfile) &
wait;
}
function run_unittest_gpu() {
test_case=$1 test_case=$1
parallel_job=$2 parallel_job=$2
parallel_level_base=${CTEST_PARALLEL_LEVEL:-1} parallel_level_base=${CTEST_PARALLEL_LEVEL:-1}
...@@ -283,7 +293,11 @@ function run_unittest() { ...@@ -283,7 +293,11 @@ function run_unittest() {
} }
function unittests_retry(){ function unittests_retry(){
if [ "${WITH_GPU:-OFF}" == "ON" ];then
parallel_job=1 parallel_job=1
else
parallel_job=4
fi
is_retry_execuate=0 is_retry_execuate=0
wintest_error=1 wintest_error=1
retry_time=3 retry_time=3
...@@ -334,7 +348,7 @@ function unittests_retry(){ ...@@ -334,7 +348,7 @@ function unittests_retry(){
function show_ut_retry_result() { function show_ut_retry_result() {
if [[ "$is_retry_execuate" != "0" ]];then if [[ "$is_retry_execuate" != "0" ]];then
failed_test_lists_ult=`echo "${failed_test_lists}" | grep -o '[^ ].*$'` failed_test_lists_ult=`echo "${failed_test_lists}"`
echo "=========================================" echo "========================================="
echo "There are more than 10 failed unit tests, so no unit test retry!!!" echo "There are more than 10 failed unit tests, so no unit test retry!!!"
echo "=========================================" echo "========================================="
...@@ -363,10 +377,15 @@ function show_ut_retry_result() { ...@@ -363,10 +377,15 @@ function show_ut_retry_result() {
} }
set +e set +e
run_unittest $cpu_parallel_job 12
run_unittest $tetrad_parallel_job 4 if [ "${WITH_GPU:-OFF}" == "ON" ];then
run_unittest $two_parallel_job 2 run_unittest_gpu $cpu_parallel_job 12
run_unittest $non_parallel_job run_unittest_gpu $tetrad_parallel_job 4
run_unittest_gpu $two_parallel_job 2
run_unittest_gpu $non_parallel_job
else
run_unittest_cpu
fi
collect_failed_tests collect_failed_tests
set -e set -e
rm -f $tmp_dir/* rm -f $tmp_dir/*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册