Skip to content
Snippets Groups Projects
Commit acf1d5ee authored by Jean-Matthieu Etancelin's avatar Jean-Matthieu Etancelin
Browse files

No commit message

No commit message
parent 1fc442ae
No related branches found
No related tags found
No related merge requests found
......@@ -14,7 +14,7 @@ class BenchmarkSuite:
def __init__(self, sizes, kernel_name,
versions, configs, test=False, true_res=None, arg_to_test=0,
inputs={}, file_name="Benchmarks_data",
precision='SP'):
precision='SP', nb_run=20):
"""
Creates a benchmak suite, that consists in a list of Benchmark.
......@@ -35,7 +35,9 @@ class BenchmarkSuite:
If no such file, a new database is created.
"""
self.pickle_file_name = file_name
if precision == 'DP':
if precision == 'SP':
self.pickle_file_name += '_SP'
else:
self.pickle_file_name += '_DP'
self.sizes = sizes
self.versions = versions
......@@ -46,6 +48,7 @@ class BenchmarkSuite:
self.arg_to_test = arg_to_test
self.kernel_name = kernel_name
self.precision = precision
self.nb_run = nb_run
if not self.test:
try:
......@@ -71,9 +74,14 @@ class BenchmarkSuite:
for v in self.versions:
if not v[1] in self.timings[self.kernel_name].keys():
self.timings[self.kernel_name][v[1]] = {}
for c in self.configs[v[1]]:
if not c[2] in self.timings[self.kernel_name][v[1]].keys():
self.timings[self.kernel_name][v[1]][c[2]] = {}
if isinstance(self.configs, dict):
for c in self.configs[v[1]]:
if not c[2] in self.timings[self.kernel_name][v[1]].keys():
self.timings[self.kernel_name][v[1]][c[2]] = {}
else:
for c in self.configs:
if not c[2] in self.timings[self.kernel_name][v[1]].keys():
self.timings[self.kernel_name][v[1]][c[2]] = {}
def launch(self):
"""
......@@ -86,7 +94,11 @@ class BenchmarkSuite:
self.true_res = {}
self.compute_true_res(self.sizes, self.true_res, self.inputs)
for v in self.versions:
for conf in self.configs[v[1]]:
if isinstance(self.configs, dict):
conf_list = self.configs[v[1]]
else:
conf_list = self.configs
for conf in conf_list:
try:
allowed_size = conf[3]
except IndexError:
......@@ -95,13 +107,14 @@ class BenchmarkSuite:
b = Benchmark(v[0], v[1], self.sizes,
lambda s: "-D WIDTH=" + str(s[0]) + conf[0](s),
inputs=self.inputs, allowed_size=allowed_size,
precision=self.precision)
precision=self.precision, nb_run=self.nb_run)
else:
b = Benchmark(v[0], v[1], self.sizes,
lambda s: "-D WIDTH=" + str(s[0]) + conf[0],
inputs=self.inputs, allowed_size=allowed_size,
precision=self.precision)
precision=self.precision, nb_run=self.nb_run)
b.kernelSetup = conf[1]
print self.kernel_name, v[1], conf[2]
if self.test:
b.test(self.true_res, self.arg_to_test)
else:
......@@ -290,7 +303,7 @@ class Benchmark:
if self.code is not None:
for size in self.sizes:
if self.is_size_allowed is None or self.is_size_allowed(size):
build_options = " -cl-opt-disable"
build_options = "" # " -cl-opt-disable"
if self.correctlyroundeddividesqrt:
build_options += " -cl-fp32-correctly-rounded-divide-sqrt "
if self.precision == 'SP':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment