未验证 提交 4f86aae0 编写于 作者: P Peihan 提交者: GitHub

support infer_ut on windows nightly build (#35049)

* enable infer_ut on windows

* remove lib calculation & time

* unset http_proxy when download bos file on windows
上级 7f5eb533
......@@ -193,7 +193,11 @@ if(WITH_GTEST)
include(GNUInstallDirs)
include_directories(${GTEST_INSTALL_DIR}/include)
add_dependencies(${DEMO_NAME} thirdparty_gtest)
IF(WIN32)
target_link_libraries(${DEMO_NAME} ${GTEST_INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}/gtest${CMAKE_STATIC_LIBRARY_SUFFIX})
ELSE()
target_link_libraries(${DEMO_NAME} ${GTEST_INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}/libgtest${CMAKE_STATIC_LIBRARY_SUFFIX})
ENDIF(WIN32)
endif()
if(WIN32)
if(USE_TENSORRT)
......
......@@ -23,6 +23,7 @@ TENSORRT_ROOT_DIR=$5 # TensorRT ROOT dir, default to /usr/local/TensorRT
MSVC_STATIC_CRT=$6
inference_install_dir=${PADDLE_ROOT}/build/paddle_inference_install_dir
EXIT_CODE=0 # init default exit code
WIN_DETECT=$(echo `uname` | grep "Win") # detect current platform
export RED='\033[0;31m' # red color
export NC='\033[0m' # no color
......@@ -48,7 +49,7 @@ if [ -d "$TENSORRT_ROOT_DIR" ]; then
USE_TENSORRT=ON
fi
# download vis_demo data
function download() {
url_prefix=$1
model_name=$2
......@@ -56,10 +57,15 @@ function download() {
cd $model_name
if [[ -e "${model_name}.tgz" ]]; then
echo "${model_name}.tgz has been downloaded."
else
if [ $WIN_DETECT != "" ]; then
wget -q -Y off ${url_prefix}/${model_name}.tgz
tar xzf *.tgz
else
wget -q --no-proxy ${url_prefix}/${model_name}.tgz
tar xzf *.tgz
fi
fi
cd ..
}
......@@ -105,6 +111,20 @@ function compile_test() {
mkdir -p ${build_dir}
cd ${build_dir}
TEST_NAME=$1
if [ $WIN_DETECT != "" ]; then
cmake .. -G "Visual Studio 15 2017" -A x64 -T host=x64 -DPADDLE_LIB=${inference_install_dir} \
-DWITH_MKL=$TURN_ON_MKL \
-DDEMO_NAME=${TEST_NAME} \
-DWITH_GPU=$TEST_GPU_CPU \
-DWITH_STATIC_LIB=OFF \
-DUSE_TENSORRT=$USE_TENSORRT \
-DTENSORRT_ROOT=$TENSORRT_ROOT_DIR \
-DMSVC_STATIC_CRT=$MSVC_STATIC_CRT \
-DWITH_GTEST=ON \
-DCMAKE_CXX_FLAGS='/std:c++17' \
-DCMAKE_BUILD_TYPE=Release
msbuild /maxcpucount /property:Configuration=Release ALL_BUILD.vcxproj
else
cmake .. -DPADDLE_LIB=${inference_install_dir} \
-DWITH_MKL=$TURN_ON_MKL \
-DDEMO_NAME=${TEST_NAME} \
......@@ -114,6 +134,7 @@ function compile_test() {
-DTENSORRT_ROOT=$TENSORRT_ROOT_DIR \
-DWITH_GTEST=ON
make -j$(nproc)
fi;
cd -
}
......@@ -129,96 +150,99 @@ rm -rf *
if [ $USE_TENSORRT == ON -a $TEST_GPU_CPU == ON ]; then
rm -rf *
if [ $WIN_DETECT != "" ]; then
exe_dir=${build_dir}/Release
else
exe_dir=${build_dir}
fi;
printf "${YELLOW} start test_resnet50 ${NC} \n";
compile_test "test_resnet50"
./test_resnet50 \
${exe_dir}/test_resnet50 \
--modeldir=$DATA_DIR/resnet50/resnet50 \
--gtest_output=xml:test_resnet50.xml
--gtest_output=xml:${log_dir}/test_resnet50.xml
if [ $? -ne 0 ]; then
echo "test_resnet50 runs failed" >> ${current_dir}/build/test_summary.txt
echo "test_resnet50 runs failed" >> ${exe_dir}/test_summary.txt
EXIT_CODE=1
fi
printf "${YELLOW} start test_det_mv3_db ${NC} \n";
compile_test "test_det_mv3_db"
make -j$(nproc)
./test_det_mv3_db \
${exe_dir}/test_det_mv3_db \
--modeldir=$DATA_DIR/ocr_det_mv3_db/ocr_det_mv3_db \
--gtest_output=xml:test_det_mv3_db.xml
--gtest_output=xml:${log_dir}/test_det_mv3_db.xml
if [ $? -ne 0 ]; then
echo "test_det_mv3_db runs failed" >> ${current_dir}/build/test_summary.txt
echo "test_det_mv3_db runs failed" >> ${exe_dir}/test_summary.txt
EXIT_CODE=1
fi
printf "${YELLOW} start test_LeViT ${NC} \n";
compile_test "test_LeViT"
./test_LeViT \
${exe_dir}/test_LeViT \
--modeldir=$DATA_DIR/LeViT/LeViT \
--gtest_output=xml:test_LeViT.xml
--gtest_output=xml:${log_dir}/test_LeViT.xml
if [ $? -ne 0 ]; then
echo "test_LeViT runs failed" >> ${current_dir}/build/test_summary.txt
echo "test_LeViT runs failed" >> ${exe_dir}/test_summary.txt
EXIT_CODE=1
fi
printf "${YELLOW} start test_ernie_text_cls ${NC} \n";
compile_test "test_ernie_text_cls"
./test_ernie_text_cls \
${exe_dir}/test_ernie_text_cls \
--modeldir=$DATA_DIR/ernie_text_cls/ernie_text_cls \
--gtest_output=xml:test_ernie_text_cls.xml
--gtest_output=xml:${log_dir}/test_ernie_text_cls.xml
if [ $? -ne 0 ]; then
echo "test_ernie_text_cls runs failed" >> ${current_dir}/build/test_summary.txt
echo "test_ernie_text_cls runs failed" >> ${exe_dir}/test_summary.txt
EXIT_CODE=1
fi
printf "${YELLOW} start test_yolov3 ${NC} \n";
compile_test "test_yolov3"
./test_yolov3 \
${exe_dir}/test_yolov3 \
--modeldir=$DATA_DIR/yolov3/yolov3 \
--gtest_output=xml:test_yolov3.xml
--gtest_output=xml:${log_dir}/test_yolov3.xml
if [ $? -ne 0 ]; then
echo "test_yolov3 runs failed" >> ${current_dir}/build/test_summary.txt
echo "test_yolov3 runs failed" >> ${exe_dir}/test_summary.txt
EXIT_CODE=1
fi
printf "${YELLOW} start test_ppyolo_mbv3 ${NC} \n";
compile_test "test_ppyolo_mbv3"
./test_ppyolo_mbv3 \
${exe_dir}/test_ppyolo_mbv3 \
--modeldir=$DATA_DIR/ppyolo_mbv3/ppyolo_mbv3 \
--gtest_output=xml:test_ppyolo_mbv3.xml
--gtest_output=xml:${log_dir}/test_ppyolo_mbv3.xml
if [ $? -ne 0 ]; then
echo "test_ppyolo_mbv3 runs failed" >> ${current_dir}/build/test_summary.txt
echo "test_ppyolo_mbv3 runs failed" >> ${exe_dir}/test_summary.txt
EXIT_CODE=1
fi
printf "${YELLOW} start test_ppyolov2_r50vd ${NC} \n";
compile_test "test_ppyolov2_r50vd"
./test_ppyolov2_r50vd \
${exe_dir}/test_ppyolov2_r50vd \
--modeldir=$DATA_DIR/ppyolov2_r50vd/ppyolov2_r50vd \
--gtest_output=xml:test_ppyolov2_r50vd.xml
--gtest_output=xml:${log_dir}/test_ppyolov2_r50vd.xml
if [ $? -ne 0 ]; then
echo "test_ppyolov2_r50vd runs failed" >> ${current_dir}/build/test_summary.txt
echo "test_ppyolov2_r50vd runs failed" >> ${exe_dir}/test_summary.txt
EXIT_CODE=1
fi
printf "${YELLOW} start test_resnet50_quant ${NC} \n";
compile_test "test_resnet50_quant"
./test_resnet50_quant \
${exe_dir}/test_resnet50_quant \
--int8dir=$DATA_DIR/resnet50_quant/resnet50_quant/resnet50_quant \
--modeldir=$DATA_DIR/resnet50/resnet50 \
--datadir=$DATA_DIR/resnet50_quant/resnet50_quant/imagenet-eval-binary/9.data \
--gtest_output=xml:test_resnet50_quant.xml
--gtest_output=xml:${log_dir}/test_resnet50_quant.xml
if [ $? -ne 0 ]; then
echo "test_resnet50_quant runs failed" >> ${current_dir}/build/test_summary.txt
echo "test_resnet50_quant runs failed" >> ${exe_dir}/test_summary.txt
EXIT_CODE=1
fi
cp ./*.xml ${log_dir};
fi
if [[ -f ${current_dir}/build/test_summary.txt ]];then
if [[ -f ${exe_dir}/test_summary.txt ]];then
echo "=====================test summary======================"
cat ${current_dir}/build/test_summary.txt
cat ${exe_dir}/test_summary.txt
echo "========================================================"
fi
echo "infer_ut script finished"
......
......@@ -271,6 +271,7 @@ if %errorlevel% NEQ 0 exit /b 1
call :cmake || goto cmake_error
call :build || goto build_error
call :test_inference || goto test_inference_error
call :test_inference_ut || goto test_inference_ut_error
call :zip_cc_file || goto zip_cc_file_error
call :zip_c_file || goto zip_c_file_error
goto:success
......@@ -738,6 +739,23 @@ goto:eof
:check_change_of_unittest_error
exit /b 1
rem ---------------------------------------------------------------------------------------------
:test_inference_ut
@ECHO OFF
echo ========================================
echo Step 7. Testing fluid library with infer_ut for inference ...
echo ========================================
cd %work_dir%\paddle\fluid\inference\tests\infer_ut
%cache_dir%\tools\busybox64.exe bash run.sh %work_dir:\=/% %WITH_MKL% %WITH_GPU% %cache_dir:\=/%/inference_demo %TENSORRT_ROOT% %MSVC_STATIC_CRT%
goto:eof
:test_inference_ut_error
::echo 1 > %cache_dir%\error_code.txt
::type %cache_dir%\error_code.txt
echo Testing fluid library with infer_ut for inference failed!
exit /b 1
rem ---------------------------------------------------------------------------------------------
:zip_cc_file
cd /d %work_dir%\%BUILD_DIR%
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册