pfor/scripts/benchmark

103 lines
2.8 KiB
Plaintext
Raw Normal View History

2021-05-10 16:11:23 +00:00
#!/bin/bash
binary=./release/benchmarks/basic
[ -x "${binary}" ] || exit 1
#### Utilities
measure() {
coreset=$1
size=$2
method=$3
sample=$4
ncores=$5
t=$(eval "taskset -c ${coreset} ${binary} ${size} ${method} ${sample}"|cut -d' ' -f2)
echo "${t}"
}
csv() {
echo "$*"|tr ' ' ','
}
## benchmarks
#### No parallelism, sequential/generic, variable array sizes
bSeq() {
method=0
sizes=(100 1000 10000 100000 1000000)
coreset=0
cores=1
for size in ${sizes[@]}; do
ts_seq=($(measure "${coreset}" "${size}" seq $method $cores))
ts_gen_omp=($(measure "${coreset}" "${size}" gen_omp $method $cores))
ts_gen_thread=($(measure "${coreset}" "${size}" gen_thread $method $cores))
echo "$size ; $ts_seq ; $ts_gen_omp ; $ts_gen_thread"
done
}
#### Fixed coreset, omp/generic, variable array sizes
bSizes() {
method=$1
sizes=(100 1000 10000 100000 1000000)
coreset="0,4,8,12,16,20,24,28"
cores=8
for size in ${sizes[@]}; do
ts_seq=($(measure "${coreset}" "${size}" seq $method $cores))
ts_omp=($(measure "${coreset}" "${size}" omp $method $cores))
ts_gen_omp=($(measure "${coreset}" "${size}" gen_omp $method $cores))
ts_gen_thread=($(measure "${coreset}" "${size}" gen_thread $method $cores))
ts_omp2=`bc <<< "scale=6; $ts_omp/$cores"`
ts_gen_omp2=`bc <<< "scale=6; $ts_gen_omp/$cores"`
ts_gen_thread2=`bc <<< "scale=6; $ts_gen_thread/$cores"`
echo "$size ; $ts_seq ; $ts_omp ; $ts_omp2 ; $ts_gen_omp ; $ts_gen_omp2 ; $ts_gen_thread ; $ts_gen_thread2"
done
}
#### Fixed array size, omp/generic, variable coresets
bCores() {
method=$1
size=100000
coresets=("0" "0,4" "0,4,8,12" "0,4,8,12,16,20" "0,4,8,12,16,20,24,28" "0,4,8,12,16,20,24,28,32,36" "0,4,8,12,16,20,24,28,32,36,40,44" "0,4,8,12,16,20,24,28,32,36,40,44,48,52" "0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60")
cores=1
for coreset in ${coresets[@]}; do
ts_seq=($(measure "${coreset}" "${size}" seq $method $cores))
ts_omp=($(measure "${coreset}" "${size}" omp $method $cores))
ts_gen_omp=($(measure "${coreset}" "${size}" gen_omp $method $cores))
ts_gen_thread=($(measure "${coreset}" "${size}" gen_thread $method $cores))
ts_omp2=`bc <<< "scale=6; $ts_omp/$cores"`
ts_gen_omp2=`bc <<< "scale=6; $ts_gen_omp/$cores"`
ts_gen_thread2=`bc <<< "scale=6; $ts_gen_thread/$cores"`
echo "$cores ; $ts_seq ; $ts_omp ; $ts_omp2 ; $ts_gen_omp ; $ts_gen_omp2 ; $ts_gen_thread ; $ts_gen_thread2"
if [ $cores == 1 ]; then
cores=2
else
cores=$[cores+2]
fi
done
}
bCores 1 | tee ./scripts/result_cores_1.csv
./scripts/result_cores_1.plot
bCores 2 | tee scripts/result_cores_2.csv
./scripts/result_cores_2.plot
bSizes 1 | tee scripts/result_sizes_1.csv
./scripts/result_sizes_1.plot
bSizes 2 | tee scripts/result_sizes_2.csv
./scripts/result_sizes_2.plot
bSeq | tee scripts/result_seq.csv
./scripts/result_seq.plot