未验证 提交 7b6dbd83 编写于 作者: L LoveAn 提交者: GitHub

Fix some problem and complete op map rule, test=document_fix (#29123)

上级 d0129fcd
...@@ -26,6 +26,9 @@ PADDLE_FILENAME_OP_MAP=( ...@@ -26,6 +26,9 @@ PADDLE_FILENAME_OP_MAP=(
["activation_op.cu"]="leaky_relu elu sqrt square pow exp abs log" ["activation_op.cu"]="leaky_relu elu sqrt square pow exp abs log"
["activation_op.h"]="relu leaky_relu elu sqrt square pow exp abs log" ["activation_op.h"]="relu leaky_relu elu sqrt square pow exp abs log"
["activation_op.cc"]="relu leaky_relu elu sqrt square pow exp abs log" ["activation_op.cc"]="relu leaky_relu elu sqrt square pow exp abs log"
["interpolate_op.h"]="bilinear_interp nearest_interp trilinear_interp bicubic_interp linear_interp"
["interpolate_op.cc"]="bilinear_interp nearest_interp trilinear_interp bicubic_interp linear_interp"
["interpolate_op.cu"]="bilinear_interp nearest_interp trilinear_interp bicubic_interp linear_interp"
) )
# Benchmark repo name -> op name # Benchmark repo name -> op name
...@@ -33,6 +36,14 @@ declare -A BENCHMARK_APINAME_OP_MAP ...@@ -33,6 +36,14 @@ declare -A BENCHMARK_APINAME_OP_MAP
BENCHMARK_APINAME_OP_MAP=( BENCHMARK_APINAME_OP_MAP=(
["argmin"]="arg_min" ["argmin"]="arg_min"
["argmax"]="arg_max" ["argmax"]="arg_max"
["cos_sim"]="cosine_similarity"
["elementwise_max"]="maximum"
["elementwise_min"]="minimum"
["bilinear_interp"]="interp_bilinear"
["nearest_interp"]="interp_nearest"
["trilinear_interp"]="interp_trilinear"
["bicubic_interp"]="interp_bicubic"
["linear_interp"]="interp_linear"
) )
# ops that will run benchmark test # ops that will run benchmark test
...@@ -55,6 +66,8 @@ function load_CHANGE_OP_MAP { ...@@ -55,6 +66,8 @@ function load_CHANGE_OP_MAP {
do do
# match directory limit # match directory limit
[[ "$change_file" =~ "paddle/fluid/operators/" ]] || continue [[ "$change_file" =~ "paddle/fluid/operators/" ]] || continue
# match file name limit
[[ "$change_file" =~ "_op." ]] || continue
LOG "[INFO] Found \"${change_file}\" changed." LOG "[INFO] Found \"${change_file}\" changed."
change_file_name=${change_file#*paddle/fluid/operators/} change_file_name=${change_file#*paddle/fluid/operators/}
if [ -n "${PADDLE_FILENAME_OP_MAP[$change_file_name]}" ] if [ -n "${PADDLE_FILENAME_OP_MAP[$change_file_name]}" ]
...@@ -62,11 +75,12 @@ function load_CHANGE_OP_MAP { ...@@ -62,11 +75,12 @@ function load_CHANGE_OP_MAP {
for op_name in ${PADDLE_FILENAME_OP_MAP[$change_file_name]} for op_name in ${PADDLE_FILENAME_OP_MAP[$change_file_name]}
do do
LOG "[INFO] Load op: \"${op_name}\"." LOG "[INFO] Load op: \"${op_name}\"."
CHANGE_OP_MAP[${op_name}]="dummy" CHANGE_OP_MAP[${op_name}]="$change_file"
done done
else else
change_file_name=${change_file_name##*/}
LOG "[INFO] Load op: \"${change_file_name%_op*}\"." LOG "[INFO] Load op: \"${change_file_name%_op*}\"."
CHANGE_OP_MAP[${change_file_name%_op*}]="dummy" CHANGE_OP_MAP[${change_file_name%_op*}]="$change_file"
fi fi
done done
[ ${#CHANGE_OP_MAP[*]} -eq 0 ] && LOG "[INFO] No op to test, skip this ci." && exit 0 [ ${#CHANGE_OP_MAP[*]} -eq 0 ] && LOG "[INFO] No op to test, skip this ci." && exit 0
...@@ -107,7 +121,7 @@ function load_BENCHMARK_OP_MAP { ...@@ -107,7 +121,7 @@ function load_BENCHMARK_OP_MAP {
# compile and install paddlepaddle # compile and install paddlepaddle
function compile_install_paddlepaddle { function compile_install_paddlepaddle {
LOG "[DEBUG] Compiling install package ..." LOG "[INFO] Compiling install package ..."
export WITH_GPU=ON export WITH_GPU=ON
export WITH_AVX=ON export WITH_AVX=ON
export WITH_MKL=ON export WITH_MKL=ON
...@@ -119,16 +133,17 @@ function compile_install_paddlepaddle { ...@@ -119,16 +133,17 @@ function compile_install_paddlepaddle {
export PYTHON_ABI=cp37-cp37m export PYTHON_ABI=cp37-cp37m
export CMAKE_BUILD_TYPE=Release export CMAKE_BUILD_TYPE=Release
[ -d build ] && rm -rf build [ -d build ] && rm -rf build
bash paddle/scripts/paddle_build.sh build bash paddle/scripts/paddle_build.sh build $(nproc)
[ $? -ne 0 ] && LOG "[FATAL] compile fail." && exit 7 [ $? -ne 0 ] && LOG "[FATAL] compile fail." && exit 7
LOG "[DEBUG] Uninstall Paddle ..." LOG "[INFO] Uninstall Paddle ..."
pip uninstall -y paddlepaddle paddlepaddle_gpu pip uninstall -y paddlepaddle paddlepaddle_gpu
LOG "[DEBUG] Install Paddle ..." LOG "[INFO] Install Paddle ..."
pip install build/python/dist/paddlepaddle_gpu-0.0.0-cp37-cp37m-linux_x86_64.whl pip install build/python/dist/paddlepaddle_gpu-0.0.0-cp37-cp37m-linux_x86_64.whl
} }
# run op benchmark test # run op benchmark test
function run_op_benchmark_test { function run_op_benchmark_test {
[ ${#BENCHMARK_OP_MAP[*]} -eq 0 ] && return
local logs_dir op_name branch_name api_info_file local logs_dir op_name branch_name api_info_file
api_info_file="$(pwd)/api_info.txt" api_info_file="$(pwd)/api_info.txt"
[ -f "$api_info_file" ] && rm -f $api_info_file [ -f "$api_info_file" ] && rm -f $api_info_file
...@@ -136,11 +151,10 @@ function run_op_benchmark_test { ...@@ -136,11 +151,10 @@ function run_op_benchmark_test {
do do
echo "$api_info" >> $api_info_file echo "$api_info" >> $api_info_file
done done
LOG "[INFO] Uninstall "
for branch_name in "develop" "test_pr" for branch_name in "develop" "test_pr"
do do
git checkout $branch_name git checkout $branch_name
[ $? -ne 0 ] && LOG "[FATAL] Missing branh ${branch_name}." && exit 7 [ $? -ne 0 ] && LOG "[FATAL] Missing branch ${branch_name}." && exit 7
LOG "[INFO] Now branch name is ${branch_name}." LOG "[INFO] Now branch name is ${branch_name}."
compile_install_paddlepaddle compile_install_paddlepaddle
logs_dir="$(pwd)/logs-${branch_name}" logs_dir="$(pwd)/logs-${branch_name}"
...@@ -171,7 +185,7 @@ function summary_problems { ...@@ -171,7 +185,7 @@ function summary_problems {
if [ -z "${BENCHMARK_OP_MAP[$op_name]}" ] if [ -z "${BENCHMARK_OP_MAP[$op_name]}" ]
then then
exit_code=8 exit_code=8
LOG "[WARNING] Missing test script of \"${op_name}\" in benchmark." LOG "[WARNING] Missing test script of \"${op_name}\"(${CHANGE_OP_MAP[$op_name]}) in benchmark."
fi fi
done done
[ $exit_code -ne 0 ] && exit $exit_code [ $exit_code -ne 0 ] && exit $exit_code
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册