未验证 提交 096b0f2e 编写于 作者: T tianshuo78520a 提交者: GitHub

Add op benchmark run function log (#35034)

* Add run function log

* test=document_fix
上级 4641e8fc
...@@ -36,6 +36,7 @@ function LOG { ...@@ -36,6 +36,7 @@ function LOG {
# Limit cu file directory # Limit cu file directory
function match_cu_file_directory { function match_cu_file_directory {
LOG "[INFO] run function match_cu_file_directory"
local sub_dir cu_file_dir local sub_dir cu_file_dir
cu_file_dir=$(dirname ${1}) cu_file_dir=$(dirname ${1})
for sub_dir in "" "/elementwise" "/reduce_ops" for sub_dir in "" "/elementwise" "/reduce_ops"
...@@ -47,6 +48,7 @@ function match_cu_file_directory { ...@@ -47,6 +48,7 @@ function match_cu_file_directory {
# Load op files by header file # Load op files by header file
function load_CHANGE_OP_FILES_by_header_file { function load_CHANGE_OP_FILES_by_header_file {
LOG "[INFO] run function load_CHANGE_OP_FILES_by_header_file"
local change_file local change_file
for change_file in $(grep -rl "${1}" paddle/fluid/operators) for change_file in $(grep -rl "${1}" paddle/fluid/operators)
do do
...@@ -68,6 +70,7 @@ function load_CHANGE_OP_FILES_by_header_file { ...@@ -68,6 +70,7 @@ function load_CHANGE_OP_FILES_by_header_file {
# Load op files that PR changes # Load op files that PR changes
function load_CHANGE_OP_FILES { function load_CHANGE_OP_FILES {
LOG "[INFO] run function load_CHANGE_OP_FILES"
local sub_dir change_file local sub_dir change_file
# TODO(Avin0323): Need to filter the files added by the new OP. # TODO(Avin0323): Need to filter the files added by the new OP.
for change_file in $(git diff --name-only origin/develop) for change_file in $(git diff --name-only origin/develop)
...@@ -108,6 +111,7 @@ function prepare_benchmark_environment { ...@@ -108,6 +111,7 @@ function prepare_benchmark_environment {
# Load unique op name from CHANGE_OP_FILES # Load unique op name from CHANGE_OP_FILES
function load_CHANGE_OP_MAP { function load_CHANGE_OP_MAP {
LOG "[INFO] run function load_CHANGE_OP_MAP"
local op_name change_file change_file_name local op_name change_file change_file_name
source benchmark/ci/scripts/op_benchmark.config source benchmark/ci/scripts/op_benchmark.config
for change_file in ${CHANGE_OP_FILES[@]} for change_file in ${CHANGE_OP_FILES[@]}
...@@ -133,6 +137,7 @@ function load_CHANGE_OP_MAP { ...@@ -133,6 +137,7 @@ function load_CHANGE_OP_MAP {
# Load ops that will run benchmark test # Load ops that will run benchmark test
function load_BENCHMARK_OP_MAP { function load_BENCHMARK_OP_MAP {
LOG "[INFO] run function load_BENCHMARK_OP_MAP"
local line op_name api_name local line op_name api_name
source benchmark/ci/scripts/op_benchmark.config source benchmark/ci/scripts/op_benchmark.config
for line in $(cat api_info.txt) for line in $(cat api_info.txt)
...@@ -173,6 +178,7 @@ function compile_install_paddlepaddle { ...@@ -173,6 +178,7 @@ function compile_install_paddlepaddle {
} }
function build_whl { function build_whl {
LOG "[INFO] run function build_whl"
for branch_name in "develop" "test" for branch_name in "develop" "test"
do do
git checkout ${branch_name} git checkout ${branch_name}
...@@ -184,6 +190,7 @@ function build_whl { ...@@ -184,6 +190,7 @@ function build_whl {
# run op benchmark test # run op benchmark test
function run_op_benchmark_test { function run_op_benchmark_test {
LOG "[INFO] run function run_op_benchmark_test"
[ ${#BENCHMARK_OP_MAP[*]} -eq 0 ] && return [ ${#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
[ -z "$VISIBLE_DEVICES" ] && export VISIBLE_DEVICES=0 [ -z "$VISIBLE_DEVICES" ] && export VISIBLE_DEVICES=0
...@@ -219,6 +226,7 @@ function run_op_benchmark_test { ...@@ -219,6 +226,7 @@ function run_op_benchmark_test {
# check benchmark result # check benchmark result
function check_op_benchmark_result { function check_op_benchmark_result {
LOG "[INFO] run function check_op_benchmark_result"
local logs_dir api_info_file check_status_code local logs_dir api_info_file check_status_code
# default 3 times # default 3 times
[ -z "${RETRY_TIMES}" ] && RETRY_TIMES=3 [ -z "${RETRY_TIMES}" ] && RETRY_TIMES=3
...@@ -254,6 +262,7 @@ function check_op_benchmark_result { ...@@ -254,6 +262,7 @@ function check_op_benchmark_result {
} }
function check_CHANGE_OP_MAP { function check_CHANGE_OP_MAP {
LOG "[INFO] run function check_CHANGE_OP_MAP"
for op_name in ${!CHANGE_OP_MAP[@]} for op_name in ${!CHANGE_OP_MAP[@]}
do do
if [ -z "${BENCHMARK_OP_MAP[$op_name]}" ] if [ -z "${BENCHMARK_OP_MAP[$op_name]}" ]
...@@ -271,6 +280,7 @@ function check_CHANGE_OP_MAP { ...@@ -271,6 +280,7 @@ function check_CHANGE_OP_MAP {
# diff benchmakr result and miss op # diff benchmakr result and miss op
function summary_problems { function summary_problems {
LOG "[INFO] run function summary_problems"
local op_name exit_code local op_name exit_code
exit_code=0 exit_code=0
if [ ${#BENCHMARK_OP_MAP[*]} -ne 0 ] if [ ${#BENCHMARK_OP_MAP[*]} -ne 0 ]
...@@ -297,6 +307,8 @@ function cpu_op_benchmark { ...@@ -297,6 +307,8 @@ function cpu_op_benchmark {
function gpu_op_benchmark { function gpu_op_benchmark {
LOG "[INFO] Start run op benchmark gpu test ..." LOG "[INFO] Start run op benchmark gpu test ..."
load_CHANGE_OP_FILES
load_CHANGE_OP_MAP
load_BENCHMARK_OP_MAP load_BENCHMARK_OP_MAP
run_op_benchmark_test run_op_benchmark_test
summary_problems summary_problems
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册