thesis version
This commit is contained in:
102
scripts/benchmark
Executable file
102
scripts/benchmark
Executable file
@ -0,0 +1,102 @@
|
||||
#!/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
|
59
scripts/common.py
Normal file
59
scripts/common.py
Normal file
@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import matplotlib.lines as lines
|
||||
|
||||
def set_size(width, fraction=1):
|
||||
""" Set aesthetic figure dimensions to avoid scaling in latex.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
width: float
|
||||
Width in pts (\\the\\textwidth)
|
||||
fraction: float
|
||||
Fraction of the width which you wish the figure to occupy
|
||||
|
||||
Returns
|
||||
-------
|
||||
fig_dim: tuple
|
||||
Dimensions of figure in inches
|
||||
"""
|
||||
# Width of figure
|
||||
fig_width_pt = width * fraction
|
||||
|
||||
# Convert from pt to inches
|
||||
inches_per_pt = 1 / 72.27
|
||||
|
||||
# Golden ratio to set aesthetic figure height
|
||||
golden_ratio = (5 ** 0.5 - 1) / 2
|
||||
|
||||
# Figure width in inches
|
||||
fig_width_in = fig_width_pt * inches_per_pt
|
||||
# Figure height in inches
|
||||
fig_height_in = fig_width_in * golden_ratio
|
||||
|
||||
return fig_width_in, fig_height_in
|
||||
|
||||
|
||||
def config_plt():
|
||||
plt.rc('font', size=11, family='Latin Modern Roman')
|
||||
plt.rc('text', usetex=True)
|
||||
plt.rc('xtick', labelsize=11)
|
||||
plt.rc('ytick', labelsize=11)
|
||||
plt.rc('axes', labelsize=11)
|
||||
|
||||
|
||||
def get_colors(l, v):
|
||||
color_palette = [
|
||||
'#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd',
|
||||
'#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf',
|
||||
]
|
||||
return color_palette[l.index(v)], '#888888'
|
||||
|
||||
|
||||
def fix_log_rects(bar, e = 1e-4):
|
||||
for rect in bar.patches:
|
||||
if rect.get_y() == 0:
|
||||
rect.set_y(e)
|
||||
rect.set_height(rect.get_height() - e)
|
14
scripts/red_expr
Executable file
14
scripts/red_expr
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
cat|sed -r \
|
||||
-e 's/.*Ts = \{[A-Za-z0-9_]+<(.*)>\};.*/\1/g' \
|
||||
-e 's/Expression/E/g' \
|
||||
-e 's/op::Comma/#/g' \
|
||||
-e 's/op::Assign/=/g' \
|
||||
-e 's/op::Addition/+/g' \
|
||||
-e 's/op::Multiplication/*/g' \
|
||||
-e 's/IntToType<(.)ul>/\1/g' \
|
||||
-e 's/IteratorImpl<>/IT/g' \
|
||||
-e 's/IteratorImpl<(.) >/\1/g' \
|
||||
-e 's/int\*, //g' \
|
||||
-e 's/, IteratorImpl<> //g'
|
24
scripts/result_cores_1.plot
Executable file
24
scripts/result_cores_1.plot
Executable file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/gnuplot
|
||||
|
||||
set encoding iso_8859_1
|
||||
set terminal postscript eps enhanced
|
||||
set notitle
|
||||
set xlabel "Number of Cores"
|
||||
set ylabel "Execution Time"
|
||||
set output "./scripts/result_cores_1.eps"
|
||||
|
||||
set key top left
|
||||
set style line 1 lt 1 lw 3
|
||||
set style line 2 lt 7 lw 3
|
||||
set style line 3 lt 2 lw 3
|
||||
set style line 4 lt 1 lw 1
|
||||
set style line 5 lt 5 lw 3
|
||||
set style function lines
|
||||
|
||||
plot './scripts/result_cores_1.csv' using 1:3 with lines linestyle 1 title "sequential", \
|
||||
'./scripts/result_cores_1.csv' using 1:7 with lines linestyle 2 title "openmp", \
|
||||
'./scripts/result_cores_1.csv' using 1:11 with lines linestyle 3 title "tmp+openmp", \
|
||||
'./scripts/result_cores_1.csv' using 1:15 with lines linestyle 4 title "tmp+thread"
|
||||
|
||||
quit
|
||||
|
25
scripts/result_cores_2.plot
Executable file
25
scripts/result_cores_2.plot
Executable file
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/gnuplot
|
||||
|
||||
set encoding iso_8859_1
|
||||
set terminal postscript eps enhanced
|
||||
set notitle
|
||||
set xlabel "Number of Cores"
|
||||
set ylabel "Execution Time"
|
||||
set output "./scripts/result_cores_2.eps"
|
||||
|
||||
set key top left
|
||||
set style line 1 lt 1 lw 3
|
||||
set style line 2 lt 7 lw 3
|
||||
set style line 3 lt 2 lw 3
|
||||
set style line 4 lt 1 lw 1
|
||||
set style line 5 lt 5 lw 3
|
||||
set style function lines
|
||||
|
||||
plot './scripts/result_cores_2.csv' using 1:3 with lines linestyle 1 title "sequential", \
|
||||
'./scripts/result_cores_2.csv' using 1:7 with lines linestyle 2 title "openmp", \
|
||||
'./scripts/result_cores_2.csv' using 1:11 with lines linestyle 3 title "tmp+openmp", \
|
||||
'./scripts/result_cores_2.csv' using 1:15 with lines linestyle 4 title "tmp+thread"
|
||||
|
||||
|
||||
quit
|
||||
|
25
scripts/result_seq.plot
Executable file
25
scripts/result_seq.plot
Executable file
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/gnuplot
|
||||
|
||||
set encoding iso_8859_1
|
||||
set terminal postscript eps enhanced
|
||||
set notitle
|
||||
set xlabel "Array Size (log_{10})"
|
||||
set ylabel "Execution Time (log_{10})"
|
||||
set output "./scripts/result_seq.eps"
|
||||
|
||||
set key top left
|
||||
set style line 1 lt 1 lw 3
|
||||
set style line 2 lt 7 lw 3
|
||||
set style line 3 lt 2 lw 3
|
||||
set style line 4 lt 1 lw 1
|
||||
set style line 5 lt 5 lw 3
|
||||
set style function lines
|
||||
|
||||
set logscale xy 10
|
||||
|
||||
plot './scripts/result_seq.csv' using 1:3 with lines linestyle 1 title "sequential", \
|
||||
'./scripts/result_seq.csv' using 1:5 with lines linestyle 3 title "tmp+openmp", \
|
||||
'./scripts/result_seq.csv' using 1:7 with lines linestyle 4 title "tmp+thread"
|
||||
|
||||
quit
|
||||
|
26
scripts/result_sizes_1.plot
Executable file
26
scripts/result_sizes_1.plot
Executable file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/gnuplot
|
||||
|
||||
set encoding iso_8859_1
|
||||
set terminal postscript eps enhanced
|
||||
set notitle
|
||||
set xlabel "Array Size (log_{10})"
|
||||
set ylabel "Execution Time (log_{10})"
|
||||
set output "./scripts/result_sizes_1.eps"
|
||||
|
||||
set key top left
|
||||
set style line 1 lt 1 lw 3
|
||||
set style line 2 lt 7 lw 3
|
||||
set style line 3 lt 2 lw 3
|
||||
set style line 4 lt 1 lw 1
|
||||
set style line 5 lt 5 lw 3
|
||||
set style function lines
|
||||
|
||||
set logscale xy 10
|
||||
|
||||
plot './scripts/result_sizes_1.csv' using 1:3 with lines linestyle 1 title "sequential", \
|
||||
'./scripts/result_sizes_1.csv' using 1:7 with lines linestyle 2 title "openmp", \
|
||||
'./scripts/result_sizes_1.csv' using 1:11 with lines linestyle 3 title "tmp+openmp", \
|
||||
'./scripts/result_sizes_1.csv' using 1:15 with lines linestyle 4 title "tmp+thread"
|
||||
|
||||
quit
|
||||
|
27
scripts/result_sizes_2.plot
Executable file
27
scripts/result_sizes_2.plot
Executable file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/gnuplot
|
||||
|
||||
set encoding iso_8859_1
|
||||
set terminal postscript eps enhanced
|
||||
set notitle
|
||||
set xlabel "Array Size (log_{10})"
|
||||
set ylabel "Execution Time (log_{10})"
|
||||
set output "./scripts/result_sizes_2.eps"
|
||||
|
||||
set key top left
|
||||
set style line 1 lt 1 lw 3
|
||||
set style line 2 lt 7 lw 3
|
||||
set style line 3 lt 2 lw 3
|
||||
set style line 4 lt 1 lw 1
|
||||
set style line 5 lt 5 lw 3
|
||||
set style function lines
|
||||
|
||||
set logscale xy 10
|
||||
|
||||
plot './scripts/result_sizes_2.csv' using 1:3 with lines linestyle 1 title "sequential", \
|
||||
'./scripts/result_sizes_2.csv' using 1:7 with lines linestyle 2 title "openmp", \
|
||||
'./scripts/result_sizes_2.csv' using 1:11 with lines linestyle 3 title "tmp+openmp", \
|
||||
'./scripts/result_sizes_2.csv' using 1:15 with lines linestyle 4 title "tmp+thread"
|
||||
|
||||
|
||||
quit
|
||||
|
Reference in New Issue
Block a user