Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add op benchmark run function log #35034

Merged
merged 2 commits into from
Aug 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions tools/test_ci_op_benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function LOG {

# Limit cu file directory
function match_cu_file_directory {
LOG "[INFO] run function match_cu_file_directory"
local sub_dir cu_file_dir
cu_file_dir=$(dirname ${1})
for sub_dir in "" "/elementwise" "/reduce_ops"
Expand All @@ -47,6 +48,7 @@ function match_cu_file_directory {

# Load 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
for change_file in $(grep -rl "${1}" paddle/fluid/operators)
do
Expand All @@ -68,6 +70,7 @@ function load_CHANGE_OP_FILES_by_header_file {

# Load op files that PR changes
function load_CHANGE_OP_FILES {
LOG "[INFO] run function load_CHANGE_OP_FILES"
local sub_dir change_file
# TODO(Avin0323): Need to filter the files added by the new OP.
for change_file in $(git diff --name-only origin/develop)
Expand Down Expand Up @@ -108,6 +111,7 @@ function prepare_benchmark_environment {

# Load unique op name from CHANGE_OP_FILES
function load_CHANGE_OP_MAP {
LOG "[INFO] run function load_CHANGE_OP_MAP"
local op_name change_file change_file_name
source benchmark/ci/scripts/op_benchmark.config
for change_file in ${CHANGE_OP_FILES[@]}
Expand All @@ -133,6 +137,7 @@ function load_CHANGE_OP_MAP {

# Load ops that will run benchmark test
function load_BENCHMARK_OP_MAP {
LOG "[INFO] run function load_BENCHMARK_OP_MAP"
local line op_name api_name
source benchmark/ci/scripts/op_benchmark.config
for line in $(cat api_info.txt)
Expand Down Expand Up @@ -173,6 +178,7 @@ function compile_install_paddlepaddle {
}

function build_whl {
LOG "[INFO] run function build_whl"
for branch_name in "develop" "test"
do
git checkout ${branch_name}
Expand All @@ -184,6 +190,7 @@ function build_whl {

# run op benchmark test
function run_op_benchmark_test {
LOG "[INFO] run function run_op_benchmark_test"
[ ${#BENCHMARK_OP_MAP[*]} -eq 0 ] && return
local logs_dir op_name branch_name api_info_file
[ -z "$VISIBLE_DEVICES" ] && export VISIBLE_DEVICES=0
Expand Down Expand Up @@ -219,6 +226,7 @@ function run_op_benchmark_test {

# check benchmark result
function check_op_benchmark_result {
LOG "[INFO] run function check_op_benchmark_result"
local logs_dir api_info_file check_status_code
# default 3 times
[ -z "${RETRY_TIMES}" ] && RETRY_TIMES=3
Expand Down Expand Up @@ -254,6 +262,7 @@ function check_op_benchmark_result {
}

function check_CHANGE_OP_MAP {
LOG "[INFO] run function check_CHANGE_OP_MAP"
for op_name in ${!CHANGE_OP_MAP[@]}
do
if [ -z "${BENCHMARK_OP_MAP[$op_name]}" ]
Expand All @@ -271,6 +280,7 @@ function check_CHANGE_OP_MAP {

# diff benchmakr result and miss op
function summary_problems {
LOG "[INFO] run function summary_problems"
local op_name exit_code
exit_code=0
if [ ${#BENCHMARK_OP_MAP[*]} -ne 0 ]
Expand All @@ -297,6 +307,8 @@ function cpu_op_benchmark {

function gpu_op_benchmark {
LOG "[INFO] Start run op benchmark gpu test ..."
load_CHANGE_OP_FILES
load_CHANGE_OP_MAP
load_BENCHMARK_OP_MAP
run_op_benchmark_test
summary_problems
Expand Down