rosa/rtbenchmarks/run_rt_graspels

94 lines
2.0 KiB
Plaintext
Raw Permalink Normal View History

2021-05-10 16:14:24 +00:00
#!/bin/bash
# GRASP×ELS parameters
n=24 # 4,8,12,16,20
o=20 # 1,10,20,30,40,50 (n=4?)
i=20
seeds=(std::mt19937::default_seed 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29)
# Script shenanigans
root=.
cxx=g++
cxx_flags="-Wall -Wextra -DNDEBUG -O2 -pthread -I${root}/src -I${root}/inc -DGRASP_N=${n} -DELS_ITER_MAX=${o} -DELS_GEN=${i}"
ld_flags="-L${root}/release -ltsp"
src="${root}/bench/graspels/*.cpp"
# preload="LD_PRELOAD=~bachelet/local/kephren/lib64/libstdc++.so.6"
repeat=5
outdir="rtbenchmarks/data_graspels"
exe=bench_graspels
quit() {
rm "${exe}"
exit 0
}
trap quit SIGINT
# Utility
compile_link() {
function=$1; shift
ncores=$1; shift
in=$1; shift
data=$(echo "${root}/data/${in}"|sed "s,^$(pwd)/,,")
${cxx} ${cxx_flags} -DDATA_FILE="\"${data}\"" -DFUNC="${function}" -DNTHREADS="${ncores}" -o"${exe}" ${src} ${ld_flags}
}
run() {
coreset=$1; shift
for i in $(seq ${repeat}); do
seed=${seeds[$i-1]}
eval "${preload} taskset -c ${coreset} ./${exe} --seed '${seed}'"
done
}
# Functions
benchSeq() {
coreset=0
ncores=1
echo "---- benchSeq ----"
for dataset in dj38 qa194; do
echo "==== dataset: ${dataset}"
for function in hw_seq_v sk_seq; do
echo ">> function: ${function}"
compile_link "${function}" "${ncores}" "${dataset}"
run "${coreset}"|tee -a "${outdir}/rt_seq_${dataset}_${function}"
done
done
}
benchPar() {
# cores=(1 2 4 6 8 10 12 14 16 18)
cores=(1 2 4)
echo "---- benchPar ----"
for dataset in dj38 qa194; do
echo "==== dataset: ${dataset}"
for function in hw_par_v sk_par_firstlevel sk_par_staticpool sk_par_dynamicpool sk_par_thread; do
echo ">> function: ${function}"
for ncores in ${cores[@]}; do
echo "cores: ${ncores}"
maxcore=$((ncores*4 - 1))
coreset="$(seq -s, 0 4 ${maxcore})"
compile_link "${function}" "${ncores}" "${dataset}"
run "${coreset}"|tee -a "${outdir}/rt_cores_${dataset}_${function}"
done
done
done
}
# Script
benchSeq
benchPar
quit