diff --git a/paddle/scripts/paddle_build.bat b/paddle/scripts/paddle_build.bat index ef92d96dcbb922a59dd999eae9163b03539b8f56..281adabf9e21241227ea59be72bbce796be3bdf2 100644 --- a/paddle/scripts/paddle_build.bat +++ b/paddle/scripts/paddle_build.bat @@ -256,11 +256,14 @@ set WITH_GPU=ON set WITH_AVX=ON set MSVC_STATIC_CRT=ON set ON_INFER=ON +set WITH_TESTING=ON +set WITH_TENSORRT=ON +set WITH_INFERENCE_API_TEST=ON call :cmake || goto cmake_error call :build || goto build_error call :test_whl_pacakage || goto test_whl_pacakage_error -:: call :test_unit || goto test_unit_error +call :test_unit || goto test_unit_error ::call :test_inference || goto test_inference_error :: call :check_change_of_unittest || goto check_change_of_unittest_error goto:success diff --git a/paddle/scripts/paddle_build.sh b/paddle/scripts/paddle_build.sh index bcc4cf8713c7bfe28ce94227147fdbbd481aac8b..e5a36ced0d321bdf2e0c2ca5ece97fb800c0f293 100755 --- a/paddle/scripts/paddle_build.sh +++ b/paddle/scripts/paddle_build.sh @@ -1227,8 +1227,8 @@ set +x is_nightly='' # indicate whether the case will only run at night get_quickly_disable_ut||disable_ut_quickly='' # indicate whether the case was in quickly disable list - UT_list=$(ctest -N | awk -F ': ' '{print $2}' | sed '/^$/d' | sed '$d') - output=$(python ${PADDLE_ROOT}/tools/parallel_UT_rule.py "${UT_list}") + ctest -N | awk -F ': ' '{print $2}' | sed '/^$/d' | sed '$d' > all_ut_list + output=$(python ${PADDLE_ROOT}/tools/parallel_UT_rule.py) high_parallel_job=$(echo $output | cut -d ";" -f 1) secondary_high_parallel_job=$(echo $output | cut -d ";" -f 2) third_high_parallel_job=$(echo $output | cut -d ";" -f 3) diff --git a/tools/parallel_UT_rule.py b/tools/parallel_UT_rule.py index 647c36c8954e0749166ef3e7585239c8fb9e37ac..be9be5a895457f568142bdb08613c7a5346a3cb9 100644 --- a/tools/parallel_UT_rule.py +++ b/tools/parallel_UT_rule.py @@ -2205,7 +2205,12 @@ def main(): lowest_high_parallel_job = '^job$' non_parallel_job = '^job$' - test_cases = sys.argv[1] + # sys.argv[1] may exceed max_arg_length when busybox run parallel_UT_rule in windows + BUILD_DIR = os.getcwd() + file_path = os.path.join(BUILD_DIR, 'all_ut_list') + with open(file_path, 'r') as f: + test_cases = f.read() + test_cases = test_cases.split("\n") if platform.system() == 'Windows': diff --git a/tools/windows/get_prec_ut_list.py b/tools/windows/get_prec_ut_list.py index 2b89b978e459a9d02d742292f9cc70a94328bf81..9285fb8e84c3c7c0ba7ebbc44032bd351c745143 100644 --- a/tools/windows/get_prec_ut_list.py +++ b/tools/windows/get_prec_ut_list.py @@ -14,6 +14,8 @@ """To get a list of prec ut """ import sys +import os +import platform def get_prec_ut_list(all_test_cases, prec_test_cases): @@ -24,7 +26,7 @@ def get_prec_ut_list(all_test_cases, prec_test_cases): prec_test_cases_list_new = [item.rstrip() for item in prec_test_cases_list] if len(prec_test_cases) == 0: - return "\n".join(all_test_cases_list) + return case_to_run = ['test_prec_ut'] for case in all_test_cases_list_new: @@ -32,14 +34,20 @@ def get_prec_ut_list(all_test_cases, prec_test_cases): case_to_run.append(case) else: print("{} will not run in PRECISION_TEST mode.".format(case)) - for case in case_to_run: - print(case) + + with open(file_path, 'w') as f: + f.write('\n'.join(case_to_run)) if __name__ == '__main__': # get prec cases lists with open('ut_list', 'r') as f: prec_test_cases = f.read() - all_test_cases = sys.argv[1] + + # sys.argv[1] may exceed max_arg_length when busybox run parallel_UT_rule in windows + BUILD_DIR = os.getcwd() + file_path = os.path.join(BUILD_DIR, 'all_ut_list') + with open(file_path, 'r') as f: + all_test_cases = f.read() #prec_test_cases = sys.argv[2] get_prec_ut_list(all_test_cases, prec_test_cases) diff --git a/tools/windows/run_unittests.sh b/tools/windows/run_unittests.sh index dcf73189a773234a0bd3737c6221e64efbb8e77e..eaeddee278f358b56a69aa41ce3aa55a473329db 100644 --- a/tools/windows/run_unittests.sh +++ b/tools/windows/run_unittests.sh @@ -157,7 +157,7 @@ long_time_test="^test_gru_op$|\ if [ ${WITH_GPU:-OFF} == "ON" ];then export CUDA_VISIBLE_DEVICES=0 - UT_list=$(ctest -N | awk -F ': ' '{print $2}' | sed '/^$/d' | sed '$d') + ctest -N | awk -F ': ' '{print $2}' | sed '/^$/d' | sed '$d' > all_ut_list num=$(ctest -N | awk -F ': ' '{print $2}' | sed '/^$/d' | sed '$d' | wc -l) echo "Windows 1 card TestCases count is $num" if [ ${PRECISION_TEST:-OFF} == "ON" ]; then @@ -165,19 +165,14 @@ if [ ${WITH_GPU:-OFF} == "ON" ];then if [[ -f "ut_list" ]]; then echo "PREC length: "`wc -l ut_list` precision_cases=`cat ut_list` + if [[ "$precision_cases" != "" ]];then + python ${PADDLE_ROOT}/tools/windows/get_prec_ut_list.py + fi fi fi - set +e - if [ ${PRECISION_TEST:-OFF} == "ON" ] && [[ "$precision_cases" != "" ]];then - UT_list_res=$(python ${PADDLE_ROOT}/tools/windows/get_prec_ut_list.py "$UT_list" ) - UT_list_prec=$(echo "${UT_list_res}" | grep -v 'PRECISION_TEST') - echo "${UT_list_res}" | grep 'PRECISION_TEST' - UT_list=$UT_list_prec - fi - set -e - - output=$(python ${PADDLE_ROOT}/tools/parallel_UT_rule.py "${UT_list}") + # sys.argv[1] may exceed max_arg_length when busybox run parallel_UT_rule in windows + output=$(python ${PADDLE_ROOT}/tools/parallel_UT_rule.py) 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) @@ -319,6 +314,10 @@ if [ "${WITH_GPU:-OFF}" == "ON" ];then echo "========================================" exit 8; fi + if nvcc --version | grep 11.2; then + echo "Only test added_ut temporarily when running in CI-Windows-inference of CUDA 11.2." + exit 0; + fi fi run_unittest_gpu $cpu_parallel_job 10 run_unittest_gpu $tetrad_parallel_job 4