Merge branch 'master' of github.com:RRZE-HPC/TheBandwidthBenchmark

This commit is contained in:
Jan Eitzinger
2019-08-27 08:03:01 +02:00
4 changed files with 167 additions and 1 deletions

73
MainMemory/bench.py Executable file
View File

@@ -0,0 +1,73 @@
#!/usr/bin/env python3
# =======================================================================================
#
# Author: Thomas Gruber (tg), thomas.gruber@googlemail.com
# Copyright (c) 2019 RRZE, University Erlangen-Nuremberg
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# =======================================================================================
import sys, subprocess, re
default_regex = "^(\w+):\s+([\d\.]+)"
default_smt = 2
if len(sys.argv) < 4 or len(sys.argv) > 5:
print("{} <command> <minthreads>-<maxthreads> <repeats> (<smt>)".format(sys.argv[0]))
print("Default <smt> value is {}".format(default_smt))
sys.exit(1)
cmd = str(sys.argv[1])
minthreads = maxthreads = 0
try:
minthreads, maxthreads = sys.argv[2].split("-")
minthreads = int(minthreads)
maxthreads = int(maxthreads)
if (minthreads == 0 or minthreads > maxthreads):
print("Cannot use threads range values: {} {}".format(minthreads, maxthreads))
sys.exit(1)
except:
print("<minthreads>-<maxthreads> option not readable: {}".format(sys.argv[2]))
sys.exit(1)
repeats = int(sys.argv[3])
smt = int(sys.argv[4]) if len(sys.argv) == 5 else default_smt
maximum = bestthreads = 0
bestkernel = "None"
for numthreads in range(int(minthreads), int(maxthreads)+1):
runcmd = "likwid-pin -c E:S0:{}:1:{} {}".format(numthreads, smt, cmd)
for rep in range(repeats):
p = subprocess.Popen(runcmd, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
shell=True)
p.wait()
if p.returncode == 0:
lines = [ l for l in p.stdout.read().decode('utf-8').split("\n") ]
for l in lines:
m = re.search(default_regex, l)
if m and maximum < float(m.group(2)):
maximum = float(m.group(2))
bestthreads = numthreads
bestkernel = m.group(1)
else:
print("Execution failed: {}".format(runcmd))
print("{} was best using {} threads: {}".format(bestkernel, bestthreads, maximum))

View File

@@ -22,7 +22,7 @@ if ( $ARGV[1] eq 'seq' ){
$type = 2;
}
print("# striad $numCores $SMT $ARGV[1]\n");
while ( $N < 8000000 ) {
my $result;
my $performance = '0.00';

View File

@@ -0,0 +1,15 @@
set terminal png size 1024,768 enhanced font ,12
set output 'striad.png'
set xlabel 'Size [kB]'
set xrange [100:]
set yrange [0:]
set ylabel 'Performance [MFLOP/s]'
cpuname = system("likwid-topology | grep 'CPU name' | cut -d ':' -f2 | sort -u | xargs")
numcores = system("grep 'striad' striad.dat | cut -d ' ' -f 3")
smt = system("grep 'striad' striad.dat | cut -d ' ' -f 4")
type = system("grep 'striad' striad.dat | cut -d ' ' -f 5")
set title sprintf("Benchmark of stream triad A[i] = B[i] + C[i] * D[i]\nType '%s', Threads %s, SMT %s, CPU %s", type, numcores, smt, cpuname)
set logscale x
plot 'striad.dat' u 1:2 w linespoints title 'striad'

78
MemoryHierarchy/bench.py Executable file
View File

@@ -0,0 +1,78 @@
#!/usr/bin/env python3
# =======================================================================================
#
# Author: Thomas Gruber (tg), thomas.gruber@googlemail.com
# Copyright (c) 2019 RRZE, University Erlangen-Nuremberg
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# =======================================================================================
import sys, subprocess, re
default_regex = "([0-9.]+) ([0-9.]+)"
default_smt = 2
striad_types = {"seq" : 0,
"tp" : 1,
"ws" : 2
}
start_N = 100
max_N = 8000000
scale_N = 1.2
if len(sys.argv) < 3 or len(sys.argv) > 4:
print("Usage: {} <numcores> <seq|tp|ws> (<smt>)".format(sys.argv[0]))
print("Default <smt> value is {}".format(default_smt))
sys.exit(1)
numcores = int(sys.argv[1])
striad_type = sys.argv[2]
striad_t = 0
if striad_type in striad_types:
striad_t = striad_types.get(striad_type)
else:
print("Invalid type for striad. Available types: {}".format(", ".join(striad_types.keys())))
sys.exit(1)
smt = int(sys.argv[3]) if len(sys.argv) == 4 else default_smt
print("# striad {} {} {}".format(numcores, smt, striad_type))
N = start_N
while N < max_N:
performance = 0
result = None
runcmd = "likwid-pin -c E:S0:{}:1:{} -q ./striad {} {}".format(numcores, smt,
striad_t, N)
while performance == 0:
p = subprocess.Popen(runcmd, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
shell=True)
p.wait()
if p.returncode == 0:
result = p.stdout.read().decode('utf-8').strip()
m = re.search(default_regex, result)
if m:
performance = float(m.group(2))
else:
print("Execution failed: {}".format(runcmd))
break
print(result)
sys.stdout.flush()
N = int(N * scale_N)