未验证 提交 8094ac68 编写于 作者: L LoveAn 提交者: GitHub

Print ccache/clcache hit rate (#29341)

* test ccache hit statistics, test=develop

* test ccache hit statistics, test=develop

* add cache hit statistics, test=develop

* fix no percent symbol erro on windows, test=develop

* remove switch, test=develop
上级 5d530c93
......@@ -268,14 +268,21 @@ echo Build third_party successfully!
set build_times=1
:build_paddle
:: reset clcache zero stats for collect PR's actual hit rate
clcache.exe -z
echo Build Paddle the %build_times% time:
if "%WITH_CLCACHE%"=="OFF" (
msbuild /m:%PARALLEL_PROJECT_COUNT% /p:Configuration=Release /verbosity:minimal paddle.sln
) else (
msbuild /m:%PARALLEL_PROJECT_COUNT% /p:TrackFileAccess=false /p:CLToolExe=clcache.exe /p:CLToolPath=%PYTHON_ROOT%\Scripts /p:Configuration=Release /verbosity:minimal paddle.sln
)
set build_error=%ERRORLEVEL%
if %ERRORLEVEL% NEQ 0 (
:: ci will collect clcache hit rate
goto :collect_clcache_hits
if %build_error% NEQ 0 (
set /a build_times=%build_times%+1
if %build_times% GTR 1 (
exit /b 7
......@@ -613,6 +620,17 @@ echo "Windows %~3 Time: %cost_secs%s"
goto:eof
:collect_clcache_hits
for /f "tokens=2,4" %%i in ('clcache.exe -s ^| findstr "entries hits"') do set %%i=%%j
if %hits% EQU 0 (
echo "clcache hit rate: 0%%"
) else (
set /a rate=%hits%*10000/%entries%
echo "clcache hit rate: %rate:~0,-2%.%rate:~-2%%%"
)
goto:eof
rem ---------------------------------------------------------------------------------------------
:success
echo ========================================
......
......@@ -358,7 +358,14 @@ function build_base() {
make clean
fi
# reset ccache zero stats for collect PR's actual hit rate
ccache -z
make install -j ${parallel_number};build_error=$?
# ci will collect ccache hit rate
collect_ccache_hits
if [ "$build_error" != 0 ];then
exit 7;
fi
......@@ -425,10 +432,19 @@ EOF
if [[ "$ENABLE_MAKE_CLEAN" != "OFF" ]]; then
make clean
fi
# reset ccache zero stats for collect PR's actual hit rate
ccache -z
make install -j 8;build_error=$?
# ci will collect ccache hit rate
collect_ccache_hits
if [ "$build_error" != 0 ];then
exit 7;
fi
set -e
build_size
}
......@@ -1547,13 +1563,22 @@ EOF
startTime_s=`date +%s`
set +e
cmake .. -DWITH_DISTRIBUTE=OFF -DON_INFER=ON -DCUDA_ARCH_NAME=${CUDA_ARCH_NAME:-Auto};build_error=$?
# reset ccache zero stats for collect PR's actual hit rate
ccache -z
make -j ${parallel_number} fluid_lib_dist;build_error=$?
make -j ${parallel_number} inference_lib_dist;build_error=$?
# ci will collect ccache hit rate
collect_ccache_hits
if [ "$build_error" != 0 ];then
exit 7;
fi
endTime_s=`date +%s`
echo "Build Time: $[ $endTime_s - $startTime_s ]s"
build_size "paddle_inference"
}
......@@ -1625,6 +1650,13 @@ function example() {
fi
}
function collect_ccache_hits() {
rate=$(ccache -s | grep 'cache hit rate' | awk '{print $4}')
echo "ccache hit rate: ${rate}%"
}
function test_op_benchmark() {
bash ${PADDLE_ROOT}/tools/test_op_benchmark.sh
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册