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

Various benchmark improvements #812

Merged
merged 10 commits into from
Jul 6, 2021
3 changes: 1 addition & 2 deletions benchmark/conversions/conversions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ int main(int argc, char *argv[])
try {
auto matrix_from =
share(formats::matrix_factory.at(format_from)(exec, data));
for (const auto &format : formats::matrix_factory) {
const auto format_to = std::get<0>(format);
for (const auto &format_to : formats) {
pratikvn marked this conversation as resolved.
Show resolved Hide resolved
upsj marked this conversation as resolved.
Show resolved Hide resolved
if (format_from == format_to) {
continue;
}
Expand Down
24 changes: 21 additions & 3 deletions benchmark/run_all_benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ if [ ! "${FORMATS}" ]; then
FORMATS="csr,coo,ell,hybrid,sellp"
fi

if [ ! "${ELL_IMBALANCE_LIMIT}" ]; then
echo "ELL_IMBALANCE_LIMIT environment variable not set - assuming 100" 1>&2
ELL_IMBALANCE_LIMIT=100
upsj marked this conversation as resolved.
Show resolved Hide resolved
fi

if [ ! "${SOLVERS}" ]; then
SOLVERS="bicgstab,cg,cgs,fcg,gmres,cb_gmres_reduce1,idr"
echo "SOLVERS environment variable not set - assuming \"${SOLVERS}\"" 1>&2
Expand Down Expand Up @@ -67,7 +72,7 @@ fi

if [ ! "${SOLVERS_JACOBI_MAX_BS}" ]; then
SOLVERS_JACOBI_MAX_BS="32"
"SOLVERS_JACOBI_MAX_BS environment variable not set - assuming \"${SOLVERS_JACOBI_MAX_BS}\"" 1>&2
echo "SOLVERS_JACOBI_MAX_BS environment variable not set - assuming \"${SOLVERS_JACOBI_MAX_BS}\"" 1>&2
fi

if [ ! "${BENCHMARK_PRECISION}" ]; then
Expand Down Expand Up @@ -191,6 +196,17 @@ compute_matrix_statistics() {
}


remove_ell_worstcase() {
local IMBALANCE=$(jq '.[0].problem.row_distribution | .max / (.median + 1) | floor' $1)
# if the imbalance is too large, remove ELL formats from the list.
if [[ "${IMBALANCE}" -gt "${ELL_IMBALANCE_LIMIT}" ]]; then
echo -n $FORMATS | tr ',' '\n' | grep -vE '^ell' | tr '\n' ',' | sed 's/,$//'
else
echo -n $FORMATS
fi
}


# Runs the conversion benchmarks for all matrix formats by using file $1 as the
# input, and updating it with the results. Backups are created after each
# benchmark run, to prevent data loss in case of a crash. Once the benchmarking
Expand All @@ -199,8 +215,9 @@ compute_matrix_statistics() {
run_conversion_benchmarks() {
[ "${DRY_RUN}" == "true" ] && return
cp "$1" "$1.imd" # make sure we're not loosing the original input
local LOCAL_FORMATS=$(remove_ell_worstcase "$1")
./conversions/conversions${BENCH_SUFFIX} --backup="$1.bkp" --double_buffer="$1.bkp2" \
--executor="${EXECUTOR}" --formats="${FORMATS}" \
--executor="${EXECUTOR}" --formats="${LOCAL_FORMATS}" \
--device_id="${DEVICE_ID}" --gpu_timer=${GPU_TIMER} \
<"$1.imd" 2>&1 >"$1"
keep_latest "$1" "$1.bkp" "$1.bkp2" "$1.imd"
Expand All @@ -214,9 +231,10 @@ run_conversion_benchmarks() {
# taken as the final result.
run_spmv_benchmarks() {
[ "${DRY_RUN}" == "true" ] && return
local LOCAL_FORMATS=$(remove_ell_worstcase "$1")
cp "$1" "$1.imd" # make sure we're not loosing the original input
./spmv/spmv${BENCH_SUFFIX} --backup="$1.bkp" --double_buffer="$1.bkp2" \
--executor="${EXECUTOR}" --formats="${FORMATS}" \
--executor="${EXECUTOR}" --formats="${LOCAL_FORMATS}" \
--device_id="${DEVICE_ID}" --gpu_timer=${GPU_TIMER} \
<"$1.imd" 2>&1 >"$1"
keep_latest "$1" "$1.bkp" "$1.bkp2" "$1.imd"
Expand Down