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
Next Next commit
Allow benchmarking from a matrix list file thanks to a new variable.
MATRIX_LIST_FILE
  • Loading branch information
tcojean committed Apr 24, 2020
commit d8d26b2c6cbe6e2b2b1a6d928aa2ddd852f364a0
48 changes: 47 additions & 1 deletion benchmark/run_all_benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@ if [ ! "${DEVICE_ID}" ]; then
DEVICE_ID="0"
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:
# id or group/name or name.
# Example:
# 1903
# Freescale/circuit5M
# thermal2
if [ ! "${MATRIX_LIST_FILE}" ]; then
use_matrix_list_file=0
else
use_matrix_list_file=1
fi
tcojean marked this conversation as resolved.
Show resolved Hide resolved


################################################################################
# Utilities
Expand Down Expand Up @@ -173,9 +187,41 @@ generate_suite_sparse_input() {
EOT
}

parse_matrix_list() {
local source_list_file=$1
local benchmark_list=""
local id=0
for mtx in $(cat ${source_list_file}); do
if [[ ! "$mtx" =~ ^[0-9]+$ ]]; then
if [[ "$mtx" =~ ^[a-zA-Z0-9_-]+$ ]]; then
id=$(${SSGET} -s "[ @name == $mtx ]")
elif [[ "$mtx" =~ ^[a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+$ ]]; then
local group=$(echo $mtx | cut -d"/" -f1)
local name=$(echo $mtx | cut -d"/" -f2)
tcojean marked this conversation as resolved.
Show resolved Hide resolved
id=$(${SSGET} -s "[ @name == $name ] && [ @group == $group ]")
else
echo -e "Could not recognize entry $mtx."
fi
else
id=$mtx
fi
benchmark_list="$benchmark_list $id"
done
}

if [ $use_matrix_list_file -eq 1 ]; then
MATRIX_LIST=($(parse_matrix_list $MATRIX_LIST_FILE))
NUM_PROBLEMS=${#MATRIX_LIST[@]}
fi

LOOP_START=$((1 + (${NUM_PROBLEMS}) * (${SEGMENT_ID} - 1) / ${SEGMENTS}))
LOOP_END=$((1 + (${NUM_PROBLEMS}) * (${SEGMENT_ID}) / ${SEGMENTS}))
for (( i=${LOOP_START}; i < ${LOOP_END}; ++i )); do
for (( p=${LOOP_START}; p < ${LOOP_END}; ++p )); do
if [ $use_matrix_list_file -eq 1 ]; then
i=${MATRIX_LIST[$p]}
else
i=$p
fi
if [ "${BENCHMARK}" == "preconditioner" ]; then
break
fi
Expand Down