未验证 提交 666da145 编写于 作者: Q Qi Li 提交者: GitHub

[NPU] add npu unit test if title has NPU key word, test=develop (#35566)

上级 66223048
...@@ -90,9 +90,9 @@ REGISTER_OP_NPU_KERNEL( ...@@ -90,9 +90,9 @@ REGISTER_OP_NPU_KERNEL(
paddle::operators::StackNPUKernel<paddle::platform::float16>); paddle::operators::StackNPUKernel<paddle::platform::float16>);
REGISTER_OP_NPU_KERNEL( REGISTER_OP_NPU_KERNEL(
stack_grad, paddle::operators::StackNPUKernel<int>, stack_grad, paddle::operators::StackGradNPUKernel<int>,
#ifdef PADDLE_WITH_ASCEND_INT64 #ifdef PADDLE_WITH_ASCEND_INT64
paddle::operators::StackNPUKernel<int64_t>, paddle::operators::StackGradNPUKernel<int64_t>,
#endif #endif
paddle::operators::StackGradNPUKernel<float>, paddle::operators::StackGradNPUKernel<float>,
paddle::operators::StackGradNPUKernel<paddle::platform::float16>); paddle::operators::StackGradNPUKernel<paddle::platform::float16>);
...@@ -1746,11 +1746,14 @@ function parallel_test_base_npu() { ...@@ -1746,11 +1746,14 @@ function parallel_test_base_npu() {
# skipping if no NPU related files changed # skipping if no NPU related files changed
if [ ${SKIP_NPU_TEST:-ON} == "ON" ] ; then if [ ${SKIP_NPU_TEST:-ON} == "ON" ] ; then
fetch_upstream_develop_if_not_exist fetch_upstream_develop_if_not_exist
# get npu py or npu cc file changes
git diff --name-only remotes/upstream/$BRANCH git diff --name-only remotes/upstream/$BRANCH
npu_cc_changes=$(git diff --name-only remotes/upstream/$BRANCH | grep "op_npu.cc" || true) npu_cc_changes=$(git diff --name-only remotes/upstream/$BRANCH | grep "op_npu.cc" || true)
npu_py_changes=$(git diff --name-only remotes/upstream/$BRANCH | grep "op_npu.py" || true) npu_py_changes=$(git diff --name-only remotes/upstream/$BRANCH | grep "op_npu.py" || true)
if [ -z "${npu_cc_changes}" ] && [ -z "${npu_py_changes}" ] ; then # get PR name
echo "NO NPU operators files changed, skip NPU unit tests!" npu_pr_tile=$(curl https://github.com/PaddlePaddle/Paddle/pull/${GIT_PR_ID} 2>/dev/null | grep "<title>" | grep "[NPU]" || true)
if [ -z "${npu_cc_changes}" ] && [ -z "${npu_py_changes}" ] && [ -z "${npu_pr_tile}" ]; then
echo "NO NPU operators files changed and no '[NPU]' found in PR title, skip NPU unit tests!"
exit 0 exit 0
fi fi
fi fi
...@@ -1797,10 +1800,10 @@ set +x ...@@ -1797,10 +1800,10 @@ set +x
if [ ${TIMEOUT_DEBUG_HELP:-OFF} == "ON" ];then if [ ${TIMEOUT_DEBUG_HELP:-OFF} == "ON" ];then
bash $PADDLE_ROOT/tools/timeout_debug_help.sh "$failed_test_lists" # cat logs for tiemout uts which killed by ctest bash $PADDLE_ROOT/tools/timeout_debug_help.sh "$failed_test_lists" # cat logs for tiemout uts which killed by ctest
fi fi
read need_retry_ut_str <<< $(echo "$failed_test_lists" | grep -oEi "\-.+\(.+\)" | sed 's/(.\+)//' | sed 's/- //' ) need_retry_ut_str=$(echo "$failed_test_lists" | grep -oEi "\-.+\(.+\)" | sed 's/(.\+)//' | sed 's/- //' )
need_retry_ut_arr=(${need_retry_ut_str}) need_retry_ut_arr=(${need_retry_ut_str})
need_retry_ut_count=${#need_retry_ut_arr[@]} need_retry_ut_count=${#need_retry_ut_arr[@]}
read retry_unittests <<< $(echo "$failed_test_lists" | grep -oEi "\-.+\(.+\)" | sed 's/(.\+)//' | sed 's/- //' ) retry_unittests=$(echo "$failed_test_lists" | grep -oEi "\-.+\(.+\)" | sed 's/(.\+)//' | sed 's/- //' )
while ( [ $exec_times -lt $retry_time ] ) while ( [ $exec_times -lt $retry_time ] )
do do
if [[ "${exec_times}" == "0" ]] ;then if [[ "${exec_times}" == "0" ]] ;then
...@@ -1810,7 +1813,7 @@ set +x ...@@ -1810,7 +1813,7 @@ set +x
is_retry_execuate=1 is_retry_execuate=1
fi fi
elif [[ "${exec_times}" == "1" ]] ;then elif [[ "${exec_times}" == "1" ]] ;then
read need_retry_ut_str <<< $(echo "$failed_test_lists" | grep -oEi "\-.+\(.+\)" | sed 's/(.\+)//' | sed 's/- //' ) need_retry_ut_str=$(echo "$failed_test_lists" | grep -oEi "\-.+\(.+\)" | sed 's/(.\+)//' | sed 's/- //' )
need_retry_ut_arr=(${need_retry_ut_str}) need_retry_ut_arr=(${need_retry_ut_str})
need_retry_ut_count=${#need_retry_ut_arr[@]} need_retry_ut_count=${#need_retry_ut_arr[@]}
if [ $need_retry_ut_count -lt $exec_retry_threshold ];then if [ $need_retry_ut_count -lt $exec_retry_threshold ];then
...@@ -1828,7 +1831,7 @@ set +x ...@@ -1828,7 +1831,7 @@ set +x
if [[ "${failed_test_lists}" == "" ]];then if [[ "${failed_test_lists}" == "" ]];then
break break
else else
read retry_unittests <<< $(echo "$failed_test_lists" | grep -oEi "\-.+\(.+\)" | sed 's/(.\+)//' | sed 's/- //' ) retry_unittests=$(echo "$failed_test_lists" | grep -oEi "\-.+\(.+\)" | sed 's/(.\+)//' | sed 's/- //' )
fi fi
fi fi
echo "=========================================" echo "========================================="
...@@ -1838,7 +1841,7 @@ set +x ...@@ -1838,7 +1841,7 @@ set +x
echo "${retry_unittests}" echo "${retry_unittests}"
for line in ${retry_unittests[@]} ; for line in ${retry_unittests[@]} ;
do do
read tmp_one_tmp <<< "$( echo $single_card_tests | grep -oEi $line )" tmp_one_tmp="$( echo $single_card_tests | grep -oEi $line )"
if [[ "$tmp_one_tmp" != "" ]]; then if [[ "$tmp_one_tmp" != "" ]]; then
if [[ "$one_card_retry" == "" ]]; then if [[ "$one_card_retry" == "" ]]; then
......
...@@ -13,4 +13,9 @@ if (WITH_ASCEND_CL) ...@@ -13,4 +13,9 @@ if (WITH_ASCEND_CL)
set_tests_properties(test_amp_check_finite_and_scale_op_npu PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE") set_tests_properties(test_amp_check_finite_and_scale_op_npu PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE")
set_tests_properties(test_flags_check_nan_inf_npu PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE") set_tests_properties(test_flags_check_nan_inf_npu PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE")
set_tests_properties(test_float_status_op_npu PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE") set_tests_properties(test_float_status_op_npu PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE")
# Note: the following test cases has running time more than 120s
set_tests_properties(test_nearest_interp_op_npu PROPERTIES TIMEOUT 200)
set_tests_properties(test_nearest_interp_v2_op_npu PROPERTIES TIMEOUT 200)
set_tests_properties(test_stack_op_npu PROPERTIES TIMEOUT 300)
endif() endif()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册