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

Allow benchmarking from a matrix list file #503

Merged
merged 4 commits into from
Apr 24, 2020
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add some more configuration options to the benchmark script.
+ Add solvers and formats configuration options.
+ Add solver control options, with:
  + maximum number of iterations,
	+ solver precision,
	+ detailed run or not.
+ Fix some small issues with the matrix list file option.
  • Loading branch information
tcojean committed Apr 24, 2020
commit 1b172cd1f2418c284272ade0205972ec1cf0f17d
45 changes: 37 additions & 8 deletions benchmark/run_all_benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,26 @@ if [ ! "${PRECONDS}" ]; then
PRECONDS="none"
fi

if [ ! "${FORMATS}" ]; then
echo "FORMATS environment variable not set - assuming \"csr,coo,ell,hybrid,sellp\"" 1>&2
FORAMTS="csr,coo,ell,hybrid,sellp"
fi

if [ ! "${SOLVERS}" ]; then
echo "SOLVERS environment variable not set - assuming \"bicgstab,cg,cgs,fcg,gmres\"" 1>&2
SOLVERS="bicgstab,cg,cgs,fcg,gmres"
fi

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

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

if [ ! "${SYSTEM_NAME}" ]; then
echo "SYSTEM_MANE environment variable not set - assuming \"unknown\"" 1>&2
SYSTEM_NAME="unknown"
Expand All @@ -40,6 +60,14 @@ if [ ! "${DEVICE_ID}" ]; then
DEVICE_ID="0"
fi

# Control whether to run detailed benchmarks or not.
# Default setting is detailed=false. To activate, set DETAILED=1.
if [ "${DETAILED}" -eq 0 ]; then
DETAILED_STR="--detailed=false"
else
DETAILED_STR="--detailed=true"
fi

# This allows using a matrix list file for benchmarking.
# The file should contains a suitesparse matrix on each line.
# The allowed formats to target suitesparse matrix is:
Expand All @@ -50,7 +78,7 @@ fi
# thermal2
if [ ! "${MATRIX_LIST_FILE}" ]; then
use_matrix_list_file=0
else
elif [ -f "${MATRIX_LIST_FILE}" ]; then
use_matrix_list_file=1
fi
tcojean marked this conversation as resolved.
Show resolved Hide resolved

Expand Down Expand Up @@ -101,7 +129,7 @@ run_conversion_benchmarks() {
[ "${DRY_RUN}" == "true" ] && return
cp "$1" "$1.imd" # make sure we're not loosing the original input
./conversions/conversions --backup="$1.bkp" --double_buffer="$1.bkp2" \
--executor="${EXECUTOR}" --formats="csr,coo,hybrid,sellp,ell" \
--executor="${EXECUTOR}" --formats="${FORMATS}" \
--device_id="${DEVICE_ID}" \
<"$1.imd" 2>&1 >"$1"
keep_latest "$1" "$1.bkp" "$1.bkp2" "$1.imd"
Expand All @@ -117,7 +145,7 @@ run_spmv_benchmarks() {
[ "${DRY_RUN}" == "true" ] && return
cp "$1" "$1.imd" # make sure we're not loosing the original input
./spmv/spmv --backup="$1.bkp" --double_buffer="$1.bkp2" \
--executor="${EXECUTOR}" --formats="csr,coo,hybrid,sellp,ell" \
--executor="${EXECUTOR}" --formats="${FORMATS}" \
--device_id="${DEVICE_ID}" \
<"$1.imd" 2>&1 >"$1"
keep_latest "$1" "$1.bkp" "$1.bkp2" "$1.imd"
Expand All @@ -133,10 +161,10 @@ run_solver_benchmarks() {
[ "${DRY_RUN}" == "true" ] && return
cp "$1" "$1.imd" # make sure we're not loosing the original input
./solver/solver --backup="$1.bkp" --double_buffer="$1.bkp2" \
--executor="${EXECUTOR}" --solvers="cg,bicgstab,cgs,fcg" \
--executor="${EXECUTOR}" --solvers="${SOLVERS}" \
--preconditioners="${PRECONDS}" \
--max_iters=10000 --rel_res_goal=1e-6 \
--device_id="${DEVICE_ID}" \
--max_iters=${SOLVERS_MAX_ITERATIONS} --rel_res_goal=${SOLVERS_PRECISION} \
${DETAILED_STR} --device_id="${DEVICE_ID}" \
<"$1.imd" 2>&1 >"$1"
keep_latest "$1" "$1.bkp" "$1.bkp2" "$1.imd"
}
Expand Down Expand Up @@ -200,13 +228,14 @@ parse_matrix_list() {
local name=$(echo $mtx | cut -d"/" -f2)
id=$(${SSGET} -s "[ @name == $name ] && [ @group == $group ]")
else
echo -e "Could not recognize entry $mtx."
>&2 echo -e "Could not recognize entry $mtx."
fi
else
id=$mtx
fi
benchmark_list="$benchmark_list $id"
done
echo "$benchmark_list"
}

if [ $use_matrix_list_file -eq 1 ]; then
Expand All @@ -218,7 +247,7 @@ LOOP_START=$((1 + (${NUM_PROBLEMS}) * (${SEGMENT_ID} - 1) / ${SEGMENTS}))
LOOP_END=$((1 + (${NUM_PROBLEMS}) * (${SEGMENT_ID}) / ${SEGMENTS}))
for (( p=${LOOP_START}; p < ${LOOP_END}; ++p )); do
if [ $use_matrix_list_file -eq 1 ]; then
i=${MATRIX_LIST[$p]}
i=${MATRIX_LIST[$((p-1))]}
else
i=$p
fi
Expand Down