Skip to content

Commit

Permalink
Merge branch 'master' of github.com:RRZE-HPC/kerncraft
Browse files Browse the repository at this point in the history
  • Loading branch information
cod3monk committed Dec 6, 2017
2 parents 2b10f91 + 05bd501 commit 29c6e88
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
6 changes: 3 additions & 3 deletions examples/kernels/himeno.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ float gosa, ss, s0, omega;
float a[4][L][M][N], b[3][L][M][N], c[3][L][M][N];
float p[L][M][N], bnd[L][M][N], wrk1[L][M][N], wrk2[L][M][N];

for(int i=1 ; i<L; i++)
for(int j=1 ; j<M ; j++)
for(int k=1 ; k<N ; k++){
for(int i=1 ; i<L-1; i++)
for(int j=1 ; j<M-1; j++)
for(int k=1 ; k<N-1; k++){
s0 = a[0][i][j][k]*p[i+1][j][k]
+ a[1][i][j][k]*p[i][j+1][k]
+ a[2][i][j][k]*p[i][j][k+1]
Expand Down
2 changes: 1 addition & 1 deletion kerncraft/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Kerncraft static analytical performance modeling framework and tool."""
__version__ = '0.5.9'
__version__ = '0.5.10'


def get_header_path():
Expand Down
4 changes: 2 additions & 2 deletions kerncraft/headers/dummy.c
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
void dummy(double* a) {}
int var_false = 0;
void dummy(void* a) {}
int var_false = 0;
2 changes: 1 addition & 1 deletion kerncraft/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ def as_code(self, type_='iaca'):
# add dummy function declaration
decl = c_ast.Decl('dummy', [], [], [], c_ast.FuncDecl(
c_ast.ParamList([c_ast.Typename(None, [], c_ast.PtrDecl(
[], c_ast.TypeDecl(None, [], c_ast.IdentifierType(['double']))))]),
[], c_ast.TypeDecl(None, [], c_ast.IdentifierType(['void']))))]),
c_ast.TypeDecl('dummy', [], c_ast.IdentifierType(['void']))),
None, None)
ast.ext.insert(0, decl)
Expand Down
11 changes: 7 additions & 4 deletions kerncraft/models/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from itertools import zip_longest
except ImportError:
from itertools import izip_longest as zip_longest
from pprint import pprint

import six
import sympy
Expand Down Expand Up @@ -272,6 +273,7 @@ def perfctr(self, cmd, group='MEM', cpu='S0:0', code_markers=True, pin=True):
def analyze(self):
"""Run analysis."""
bench = self.kernel.build(verbose=self.verbose > 1)
element_size = self.kernel.datatypes_size[self.kernel.datatype]

# Build arguments to pass to command:
args = [bench] + [six.text_type(s) for s in list(self.kernel.constants.values())]
Expand Down Expand Up @@ -325,7 +327,6 @@ def analyze(self):
event_counter_results[sym] = measured_ctrs[event][r]

# Analytical metrics needed for futher calculation
element_size = self.kernel.datatypes_size[self.kernel.datatype]
elements_per_cacheline = float(self.machine['cacheline size']) // element_size
total_iterations = self.kernel.iteration_length() * repetitions
total_cachelines = total_iterations/elements_per_cacheline
Expand Down Expand Up @@ -381,14 +382,13 @@ def analyze(self):

self.results['Runtime (per repetition) [s]'] = time_per_repetition
# TODO make more generic to support other (and multiple) constant names
# TODO support SP (devide by 4 instead of 8.0)
iterations_per_repetition = reduce(
operator.mul,
[self.kernel.subs_consts(max_-min_)/self.kernel.subs_consts(step)
for idx, min_, max_, step in self.kernel._loop_stack],
1)
self.results['Iterations per repetition'] = iterations_per_repetition
iterations_per_cacheline = float(self.machine['cacheline size'])/8.0
iterations_per_cacheline = float(self.machine['cacheline size'])/element_size
cys_per_repetition = time_per_repetition*float(self.machine['clock'])
self.results['Runtime (per cacheline update) [cy/CL]'] = \
(cys_per_repetition/iterations_per_repetition)*iterations_per_cacheline
Expand All @@ -405,6 +405,9 @@ def analyze(self):

def report(self, output_file=sys.stdout):
"""Report gathered analysis data in human readable form."""
if self.verbose > 1:
pprint(self.results)

if self.verbose > 0:
print('Runtime (per repetition): {:.2g} s'.format(
self.results['Runtime (per repetition) [s]']),
Expand All @@ -430,7 +433,7 @@ def report(self, output_file=sys.stdout):
file=output_file)
print('', file=output_file)

if self.no_phenoecm:
if not self.no_phenoecm:
print("Data Transfers:")
print("{:^8} |".format("cache"), end='')
for metrics in self.results['data transfers'].values():
Expand Down

0 comments on commit 29c6e88

Please sign in to comment.