thesis version
This commit is contained in:
2
rtbenchmarks/.gitignore
vendored
Normal file
2
rtbenchmarks/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
data_basic/
|
||||
data_imgpro/
|
113
rtbenchmarks/plot_basic
Executable file
113
rtbenchmarks/plot_basic
Executable file
@ -0,0 +1,113 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os, sys
|
||||
sys.path.append(os.path.abspath(os.path.dirname(os.path.abspath(__file__))+"/../scripts"))
|
||||
|
||||
import fileinput
|
||||
import numpy as np
|
||||
import matplotlib as mpl
|
||||
|
||||
show = len(sys.argv) > 1 and sys.argv[1] == 'show'
|
||||
if not show:
|
||||
mpl.use('pgf')
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import matplotlib.lines as lines
|
||||
from common import set_size, config_plt, get_colors, fix_log_rects
|
||||
|
||||
config_plt()
|
||||
|
||||
|
||||
def loadData(fn):
|
||||
content = []
|
||||
|
||||
with open(fn) as f:
|
||||
content = f.readlines()
|
||||
|
||||
values = {}
|
||||
for line in content:
|
||||
n, method, sample, ncores, strtime = [x for x in line.split(':')]
|
||||
time = float(strtime)
|
||||
if method != "seq":
|
||||
time = time/float(ncores)
|
||||
if not n in values:
|
||||
values[n] = []
|
||||
values[n].append(time);
|
||||
|
||||
return values
|
||||
|
||||
|
||||
def figSize(title, xlabel, xticks, output, datasrcs, error=False):
|
||||
fig = plt.figure()
|
||||
|
||||
plt.title(title)
|
||||
plt.xlabel(xlabel)
|
||||
plt.ylabel(u"temps (s)")
|
||||
plt.xticks(xticks)
|
||||
plt.xscale('log')
|
||||
plt.yscale('log')
|
||||
|
||||
nd = len(datasrcs)
|
||||
|
||||
width = 3.5
|
||||
pos = .5-.5*nd
|
||||
for f, label in datasrcs:
|
||||
values = loadData(f)
|
||||
barcolor, errcolor = get_colors(['seq', 'omp', 'gen_omp', 'gen_thread'], label)
|
||||
|
||||
for k, a in values.items():
|
||||
x = int(k)
|
||||
m = np.mean(a)
|
||||
s = 2.5758 * np.std(a) / np.sqrt(len(a)) # confiance 99 %
|
||||
|
||||
x = x * ((20+width)/(20-width))**pos
|
||||
|
||||
p = np.log10(x)
|
||||
lwidth = width * 10**(p-1)
|
||||
|
||||
bar = plt.bar(x, m, width=lwidth, color=barcolor, label=label)
|
||||
fix_log_rects(bar, 1e-4)
|
||||
|
||||
if error:
|
||||
plt.errorbar(x, m, s, elinewidth=1.5, capsize=2, ecolor=errcolor)
|
||||
label=''
|
||||
|
||||
pos = pos + 1
|
||||
|
||||
plt.legend(bbox_to_anchor=(.38, 1))
|
||||
|
||||
fig.set_size_inches(set_size(455.24408, .8))
|
||||
if not show:
|
||||
plt.savefig(output, format='pdf', bbox_inches='tight')
|
||||
return plt
|
||||
|
||||
|
||||
# script
|
||||
plts = []
|
||||
|
||||
plt = figSize(u"", u"taille des données", [1e2, 1e3, 1e4, 1e5, 1e6, 1e7],
|
||||
"plots/rt_seq.pdf", [
|
||||
['data_basic/rt_seq_seq', 'seq'],
|
||||
['data_basic/rt_seq_gen_omp', 'gen_omp'],
|
||||
['data_basic/rt_seq_gen_thread', 'gen_thread'],
|
||||
],
|
||||
error=True
|
||||
)
|
||||
plts.append(plt)
|
||||
|
||||
for cores in [1, 2, 4, 6, 8, 10, 12, 14, 16, 18]:
|
||||
plt = figSize(u"", u"taille des données", [1e2, 1e3, 1e4, 1e5, 1e6, 1e7],
|
||||
"plots/rt_par_"+str(cores)+".pdf", [
|
||||
['data_basic/rt_size_'+str(cores)+'_seq', 'seq'],
|
||||
['data_basic/rt_size_'+str(cores)+'_omp', 'omp'],
|
||||
['data_basic/rt_size_'+str(cores)+'_gen_omp', 'gen_omp'],
|
||||
['data_basic/rt_size_'+str(cores)+'_gen_thread', 'gen_thread'],
|
||||
],
|
||||
error=True
|
||||
)
|
||||
plts.append(plt)
|
||||
|
||||
if show:
|
||||
for plt in plts:
|
||||
plt.show()
|
147
rtbenchmarks/plot_imgpro
Executable file
147
rtbenchmarks/plot_imgpro
Executable file
@ -0,0 +1,147 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os, sys
|
||||
sys.path.append(os.path.abspath(os.path.dirname(os.path.abspath(__file__))+"/../scripts"))
|
||||
|
||||
import fileinput
|
||||
import numpy as np
|
||||
import matplotlib as mpl
|
||||
|
||||
show = len(sys.argv) > 1 and sys.argv[1] == 'show'
|
||||
if not show:
|
||||
mpl.use('pgf')
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import matplotlib.lines as lines
|
||||
from common import set_size, config_plt, get_colors
|
||||
|
||||
config_plt()
|
||||
|
||||
|
||||
def loadData(fn):
|
||||
content = []
|
||||
|
||||
with open(fn) as f:
|
||||
content = f.readlines()
|
||||
|
||||
values = {}
|
||||
for line in content:
|
||||
method, ncores, strtime = [x for x in line.split(':')]
|
||||
time = float(strtime)
|
||||
if method != "seq":
|
||||
time = time/float(ncores)
|
||||
if not ncores in values:
|
||||
values[ncores] = []
|
||||
values[ncores].append(time);
|
||||
|
||||
return values
|
||||
|
||||
|
||||
def figCores(title, xlabel, xticks, output, datasrcs, error=False):
|
||||
fig = plt.figure()
|
||||
|
||||
plt.title(title)
|
||||
plt.xlabel(xlabel)
|
||||
plt.ylabel(u"temps (s)")
|
||||
plt.xticks(xticks)
|
||||
|
||||
nd = len(datasrcs)
|
||||
|
||||
width = .4
|
||||
pos = .5-.5*nd
|
||||
for f, label in datasrcs:
|
||||
values = loadData(f)
|
||||
barcolor, errcolor = get_colors(['seq', 'omp', 'gen_omp', 'gen_thread'], label)
|
||||
|
||||
if "1" in values:
|
||||
values.pop("1")
|
||||
|
||||
for k, a in values.items():
|
||||
x = int(k)
|
||||
m = np.mean(a)
|
||||
s = 2.5758 * np.std(a) / np.sqrt(len(a)) # confiance 99 %
|
||||
|
||||
x = x + pos*width
|
||||
|
||||
plt.bar(x, m, width=width, color=barcolor, label=label)
|
||||
if error:
|
||||
plt.errorbar(x, m, s, elinewidth=.8, capsize=1, ecolor=errcolor)
|
||||
label=''
|
||||
|
||||
pos = pos + 1
|
||||
|
||||
plt.legend(bbox_to_anchor=(1, 1))
|
||||
|
||||
fig.set_size_inches(set_size(455.24408, .8))
|
||||
if not show:
|
||||
plt.savefig(output, format='pdf', bbox_inches='tight')
|
||||
return plt
|
||||
|
||||
|
||||
def figSpeedUp(title, xlabel, xticks, output, basetime, datasrcs):
|
||||
fig = plt.figure()
|
||||
|
||||
plt.title(title)
|
||||
plt.xlabel(xlabel)
|
||||
plt.ylabel(u"accélération")
|
||||
plt.xticks(xticks)
|
||||
|
||||
nd = len(datasrcs)
|
||||
|
||||
width = .4
|
||||
pos = .5-.5*nd
|
||||
for f, label in datasrcs:
|
||||
values = loadData(f)
|
||||
barcolor, errcolor = get_colors(['seq', 'omp', 'gen_omp', 'gen_thread'], label)
|
||||
|
||||
if "1" in values:
|
||||
values.pop("1")
|
||||
|
||||
for k, a in values.items():
|
||||
x = int(k)
|
||||
m = basetime/np.mean(a)
|
||||
|
||||
x = x + pos*width
|
||||
|
||||
plt.bar(x, m, width=width, color=barcolor, label=label)
|
||||
label=''
|
||||
|
||||
pos = pos + 1
|
||||
|
||||
plt.legend(bbox_to_anchor=(0.38, 1))
|
||||
|
||||
fig.set_size_inches(set_size(455.24408, .8))
|
||||
if not show:
|
||||
plt.savefig(output, format='pdf', bbox_inches='tight')
|
||||
return plt
|
||||
|
||||
|
||||
# script
|
||||
values = loadData('data_imgpro/rt_cores_seq')
|
||||
basetime = np.mean(values["1"])
|
||||
plts = []
|
||||
|
||||
plt = figCores(u"", u"nombre de cœurs", [2, 4, 6, 8, 10, 12, 14, 16, 18],
|
||||
"plots/rt_cores.pdf", [
|
||||
# ['data_imgpro/rt_cores_seq', 'seq'],
|
||||
['data_imgpro/rt_cores_gen_omp', 'omp'],
|
||||
['data_imgpro/rt_cores_gen_omp', 'gen_omp'],
|
||||
['data_imgpro/rt_cores_gen_thread', 'gen_thread'],
|
||||
],
|
||||
error=False
|
||||
)
|
||||
plts.append(plt)
|
||||
|
||||
plt = figSpeedUp(u"", u"nombre de cœurs", [2, 4, 6, 8, 10, 12, 14, 16, 18],
|
||||
"plots/rt_speedup.pdf", basetime, [
|
||||
['data_imgpro/rt_cores_gen_omp', 'omp'],
|
||||
['data_imgpro/rt_cores_gen_omp', 'gen_omp'],
|
||||
['data_imgpro/rt_cores_gen_thread', 'gen_thread'],
|
||||
]
|
||||
)
|
||||
plts.append(plt)
|
||||
|
||||
if show:
|
||||
for plt in plts:
|
||||
plt.show()
|
79
rtbenchmarks/run_rt_basic
Executable file
79
rtbenchmarks/run_rt_basic
Executable file
@ -0,0 +1,79 @@
|
||||
#!/bin/bash
|
||||
|
||||
binary=./release/benchmarks/basic
|
||||
preload="LD_PRELOAD=~bachelet/local/kephren/lib64/libstdc++.so.6"
|
||||
repeat=20
|
||||
|
||||
outdir="rtbenchmarks/data_basic"
|
||||
|
||||
[ -x "${binary}" ] || exit 1
|
||||
|
||||
run() {
|
||||
coreset=$1
|
||||
size=$2
|
||||
method=$3
|
||||
sample=$4
|
||||
ncores=$5
|
||||
prefix="${size}:${method}:${sample}:${ncores}"
|
||||
|
||||
for i in $(seq ${repeat}); do
|
||||
t=$(eval "${preload} taskset -c ${coreset} ${binary} ${size} ${method} ${sample} ${ncores}"|cut -d' ' -f2)
|
||||
echo "${prefix}:${t}"
|
||||
done
|
||||
}
|
||||
|
||||
benchSeq() {
|
||||
sizes=(100 1000 10000 100000 1000000 10000000)
|
||||
|
||||
coreset=0
|
||||
sample=0 # seq
|
||||
ncores=1
|
||||
|
||||
echo "---- benchSeq ----"
|
||||
|
||||
for method in seq omp gen_omp gen_thread; do
|
||||
echo "==== ${method}"
|
||||
for size in ${sizes[@]}; do
|
||||
run "${coreset}" "${size}" "${method}" "${sample}" "${ncores}"
|
||||
done|tee "${outdir}/rt_seq_${method}"
|
||||
done
|
||||
}
|
||||
|
||||
benchCores() {
|
||||
cores=(1 2 4 6 8 10 12 14 16 18)
|
||||
|
||||
size=10000000
|
||||
sample=1 # par
|
||||
|
||||
echo "---- benchCores ----"
|
||||
|
||||
for method in omp gen_omp gen_thread; do
|
||||
echo "==== ${method}"
|
||||
for ncores in ${cores[@]}; do
|
||||
maxcore=$((ncores*4 - 1))
|
||||
coreset="$(seq -s, 0 4 ${maxcore})"
|
||||
run "${coreset}" "${size}" "${method}" "${sample}" "${ncores}"
|
||||
done|tee "${outdir}/rt_cores_${method}"
|
||||
done
|
||||
}
|
||||
|
||||
benchSize() {
|
||||
sizes=(100 1000 10000 100000 1000000 10000000)
|
||||
ncores=$1
|
||||
|
||||
maxcore=$((ncores*4 - 1))
|
||||
coreset="$(seq -s, 0 4 ${maxcores})"
|
||||
|
||||
sample=1 # par
|
||||
|
||||
echo "---- benchSize (ncores: ${ncores}) ----"
|
||||
|
||||
for method in seq omp gen_omp gen_thread; do
|
||||
echo "==== ${method}"
|
||||
for size in ${sizes[@]}; do
|
||||
run "${coreset}" "${size}" "${method}" "${sample}" "${ncores}"
|
||||
done|tee "${outdir}/rt_size_${ncores}_${method}"
|
||||
done
|
||||
}
|
||||
|
||||
eval "$*"
|
38
rtbenchmarks/run_rt_imgpro
Executable file
38
rtbenchmarks/run_rt_imgpro
Executable file
@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
|
||||
binary=./release/benchmarks/imgpro
|
||||
preload="LD_PRELOAD=~bachelet/local/kephren/lib64/libstdc++.so.6"
|
||||
repeat=20
|
||||
|
||||
outdir="rtbenchmarks/data_imgpro"
|
||||
|
||||
[ -x "${binary}" ] || exit 1
|
||||
|
||||
run() {
|
||||
coreset=$1
|
||||
method=$2
|
||||
ncores=$3
|
||||
prefix="${method}:${ncores}"
|
||||
|
||||
for i in $(seq ${repeat}); do
|
||||
t=$(eval "${preload} taskset -c ${coreset} ${binary} ${size} ${method} ${sample} ${ncores}"|cut -d' ' -f2)
|
||||
echo "${prefix}:${t}"
|
||||
done
|
||||
}
|
||||
|
||||
benchCores() {
|
||||
cores=(1 2 4 6 8 10 12 14 16 18)
|
||||
|
||||
echo "---- benchCores ----"
|
||||
|
||||
for method in seq omp gen_omp gen_thread; do
|
||||
echo "==== ${method}"
|
||||
for ncores in ${cores[@]}; do
|
||||
maxcore=$((ncores*4 - 1))
|
||||
coreset="$(seq -s, 0 4 ${maxcore})"
|
||||
run "${coreset}" "${method}" "${ncores}"
|
||||
done|tee "${outdir}/rt_cores_${method}"
|
||||
done
|
||||
}
|
||||
|
||||
eval "$*"
|
Reference in New Issue
Block a user