From 7673449c23eabfcce9489f339252e3b64892f5f9 Mon Sep 17 00:00:00 2001 From: Ivan Butygin Date: Mon, 7 Nov 2022 22:11:27 +0100 Subject: [PATCH 01/24] Remove imports from black_scholes --- dpbench/benchmarks/black_scholes/__init__.py | 22 ----------- dpbench/infrastructure/benchmark.py | 39 ++++++++++++++++++-- dpbench/runner.py | 2 +- 3 files changed, 36 insertions(+), 27 deletions(-) diff --git a/dpbench/benchmarks/black_scholes/__init__.py b/dpbench/benchmarks/black_scholes/__init__.py index 44494b95..99901635 100644 --- a/dpbench/benchmarks/black_scholes/__init__.py +++ b/dpbench/benchmarks/black_scholes/__init__.py @@ -2,36 +2,14 @@ # # SPDX-License-Identifier: Apache 2.0 -from .black_scholes_dpnp import black_scholes as black_scholes_dpnp from .black_scholes_initialize import initialize -from .black_scholes_numba_dpex_k import ( - black_scholes as black_scholes_numba_dpex_k, -) -from .black_scholes_numba_dpex_n import ( - black_scholes as black_scholes_numba_dpex_n, -) -from .black_scholes_numba_dpex_p import ( - black_scholes as black_scholes_numba_dpex_p, -) -from .black_scholes_numba_n import black_scholes as black_scholes_numba_n -from .black_scholes_numba_np import black_scholes as black_scholes_numba_np -from .black_scholes_numba_npr import black_scholes as black_scholes_numba_npr from .black_scholes_numpy import black_scholes as black_scholes_numpy from .black_scholes_python import black_scholes as black_scholes_python -from .black_scholes_sycl_native_ext import black_scholes_sycl __all__ = [ "initialize", - "black_scholes_dpnp", - "black_scholes_numba_dpex_k", - "black_scholes_numba_dpex_n", - "black_scholes_numba_dpex_p", - "black_scholes_numba_n", - "black_scholes_numba_np", - "black_scholes_numba_npr", "black_scholes_numpy", "black_scholes_python", - "black_scholes_sycl", ] """ diff --git a/dpbench/infrastructure/benchmark.py b/dpbench/infrastructure/benchmark.py index 7bfe0871..206f8ffb 100644 --- a/dpbench/infrastructure/benchmark.py +++ b/dpbench/infrastructure/benchmark.py @@ -3,6 +3,7 @@ # # SPDX-License-Identifier: BSD-3-Clause +import importlib import json import logging import os @@ -468,7 +469,8 @@ def __init__(self, bench, impl_postfix, preset, repeat, timeout): with Manager() as manager: results_dict = manager.dict() p = Process( - target=tout.exit_after(timeout)(_exec), + # target=tout.exit_after(timeout)(_exec), + target=_exec, args=( self.bench, self.fmwrk, @@ -520,7 +522,10 @@ def __init__(self, bench, impl_postfix, preset, repeat, timeout): self.results.results.update( {outarr: npzfile[outarr]} ) - os.remove(output_npz) + try: + os.remove(output_npz) + except: + pass if results_dict["return-value"]: self.results.results.update( {"return-value": results_dict["return-value"]} @@ -786,13 +791,33 @@ def has_impl(self, impl_postfix: str): else: return False + def _get_updated_fnlist(self, impl_postfix: str): + name = self.bname + "_" + impl_postfix + for n, _ in self.impl_fnlist: + if n == name: + return self.impl_fnlist + + try: + mod = importlib.import_module( + "dpbench.benchmarks." + self.bname + "." + name + ) + except ImportError: + logging.exception("Cannot import " + name) + return None + + return self.impl_fnlist + [(name, getattr(mod, self.bname))] + def get_impl(self, impl_postfix: str): if not impl_postfix: return None + impl_fnlist = self._get_updated_fnlist(impl_postfix) + if impl_fnlist is None: + return None + fn = [ impl[1] - for impl in self.impl_fnlist + for impl in impl_fnlist if self.bname + "_" + impl_postfix == impl[0] ] if len(fn) > 1: @@ -812,7 +837,13 @@ def get_impl(self, impl_postfix: str): def get_framework(self, impl_postfix: str) -> Framework: try: - return self.impl_to_fw_map[self.bname + "_" + impl_postfix] + impl_fnlist = self._get_updated_fnlist(impl_postfix) + if impl_fnlist is None: + return None + + impl_to_fw_map = self._set_impl_to_framework_map(impl_fnlist) + + return impl_to_fw_map[self.bname + "_" + impl_postfix] except KeyError: logging.exception( "No framework found for the implementation " diff --git a/dpbench/runner.py b/dpbench/runner.py index a8ebaeac..8ca42aa3 100644 --- a/dpbench/runner.py +++ b/dpbench/runner.py @@ -19,7 +19,7 @@ def _print_results(result): + result.benchmark_impl_postfix + " ========================" ) - if result.error_state == 0: + if result.error_state == dpbi.enums.ErrorCodes.SUCCESS: print("implementation:", result.benchmark_impl_postfix) print("framework:", result.framework_name) print("framework version:", result.framework_version) From 116ef20648e043c12cb820936f1990461a895dbb Mon Sep 17 00:00:00 2001 From: Ivan Butygin Date: Sun, 20 Nov 2022 01:17:37 +0100 Subject: [PATCH 02/24] fix timeout --- dpbench/infrastructure/benchmark.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dpbench/infrastructure/benchmark.py b/dpbench/infrastructure/benchmark.py index 206f8ffb..381165d0 100644 --- a/dpbench/infrastructure/benchmark.py +++ b/dpbench/infrastructure/benchmark.py @@ -469,7 +469,6 @@ def __init__(self, bench, impl_postfix, preset, repeat, timeout): with Manager() as manager: results_dict = manager.dict() p = Process( - # target=tout.exit_after(timeout)(_exec), target=_exec, args=( self.bench, @@ -488,7 +487,7 @@ def __init__(self, bench, impl_postfix, preset, repeat, timeout): ), ) p.start() - res = p.join(timeout * 1.2) + res = p.join(timeout) if res is None and p.exitcode is None: logging.error( "Terminating process due to timeout in the execution " From 3156c96197d63811bb9adf04542076c686701cd7 Mon Sep 17 00:00:00 2001 From: Ivan Butygin Date: Sun, 20 Nov 2022 17:47:22 +0100 Subject: [PATCH 03/24] update refarence impls check --- dpbench/infrastructure/benchmark.py | 33 +++++++++++++++++------------ 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/dpbench/infrastructure/benchmark.py b/dpbench/infrastructure/benchmark.py index 381165d0..46a95e44 100644 --- a/dpbench/infrastructure/benchmark.py +++ b/dpbench/infrastructure/benchmark.py @@ -628,13 +628,19 @@ def _set_reference_implementation(self, impl_fnlist): impl_fnlist : The list of implementation function for the benchmark. """ + + ref_names = ["python", "numpy"] + + impl_fnlist = self.impl_fnlist + for name in ref_names: + impl_fnlist = self._get_updated_fnlist(name, impl_fnlist) + ref_impl_fn = None for fn in impl_fnlist: - if "python" in fn[0]: - ref_impl_fn = fn - elif "numpy" in fn[0]: - ref_impl_fn = fn + for name in ref_names: + if name in fn[0]: + ref_impl_fn = fn return ref_impl_fn @@ -790,11 +796,11 @@ def has_impl(self, impl_postfix: str): else: return False - def _get_updated_fnlist(self, impl_postfix: str): + def _get_updated_fnlist(self, impl_postfix: str, impl_fnlist): name = self.bname + "_" + impl_postfix - for n, _ in self.impl_fnlist: + for n, _ in impl_fnlist: if n == name: - return self.impl_fnlist + return impl_fnlist try: mod = importlib.import_module( @@ -802,15 +808,15 @@ def _get_updated_fnlist(self, impl_postfix: str): ) except ImportError: logging.exception("Cannot import " + name) - return None + return impl_fnlist - return self.impl_fnlist + [(name, getattr(mod, self.bname))] + return impl_fnlist + [(name, getattr(mod, self.bname))] def get_impl(self, impl_postfix: str): if not impl_postfix: return None - impl_fnlist = self._get_updated_fnlist(impl_postfix) + impl_fnlist = self._get_updated_fnlist(impl_postfix, self.impl_fnlist) if impl_fnlist is None: return None @@ -836,10 +842,9 @@ def get_impl(self, impl_postfix: str): def get_framework(self, impl_postfix: str) -> Framework: try: - impl_fnlist = self._get_updated_fnlist(impl_postfix) - if impl_fnlist is None: - return None - + impl_fnlist = self._get_updated_fnlist( + impl_postfix, self.impl_fnlist + ) impl_to_fw_map = self._set_impl_to_framework_map(impl_fnlist) return impl_to_fw_map[self.bname + "_" + impl_postfix] From a0b187cee7296b8f1a17c39ca8c01eb9998c06a7 Mon Sep 17 00:00:00 2001 From: Ivan Butygin Date: Sun, 20 Nov 2022 17:48:12 +0100 Subject: [PATCH 04/24] remove --- dpbench/benchmarks/black_scholes/__init__.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/dpbench/benchmarks/black_scholes/__init__.py b/dpbench/benchmarks/black_scholes/__init__.py index 99901635..478ce997 100644 --- a/dpbench/benchmarks/black_scholes/__init__.py +++ b/dpbench/benchmarks/black_scholes/__init__.py @@ -3,13 +3,9 @@ # SPDX-License-Identifier: Apache 2.0 from .black_scholes_initialize import initialize -from .black_scholes_numpy import black_scholes as black_scholes_numpy -from .black_scholes_python import black_scholes as black_scholes_python __all__ = [ "initialize", - "black_scholes_numpy", - "black_scholes_python", ] """ From 8255485b07b11c9b9488173eec6dfa463c6b5d9c Mon Sep 17 00:00:00 2001 From: Ivan Butygin Date: Sun, 20 Nov 2022 17:50:43 +0100 Subject: [PATCH 05/24] remove check --- dpbench/infrastructure/benchmark.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/dpbench/infrastructure/benchmark.py b/dpbench/infrastructure/benchmark.py index 46a95e44..ab470354 100644 --- a/dpbench/infrastructure/benchmark.py +++ b/dpbench/infrastructure/benchmark.py @@ -817,8 +817,6 @@ def get_impl(self, impl_postfix: str): return None impl_fnlist = self._get_updated_fnlist(impl_postfix, self.impl_fnlist) - if impl_fnlist is None: - return None fn = [ impl[1] From 961b09890cc1dd4bca5700408d884811bc7e4e0b Mon Sep 17 00:00:00 2001 From: Ivan Butygin Date: Mon, 5 Dec 2022 21:01:35 +0100 Subject: [PATCH 06/24] Fix all benchmarks run --- dpbench/benchmarks/black_scholes/__init__.py | 14 ++++++++++++++ dpbench/infrastructure/benchmark.py | 8 ++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/dpbench/benchmarks/black_scholes/__init__.py b/dpbench/benchmarks/black_scholes/__init__.py index 478ce997..1a44128c 100644 --- a/dpbench/benchmarks/black_scholes/__init__.py +++ b/dpbench/benchmarks/black_scholes/__init__.py @@ -4,8 +4,22 @@ from .black_scholes_initialize import initialize +all_benchmarks = [ + "dpnp", + "numba_dpex_k", + "numba_dpex_p", + "numba_dpex_n", + "numba_n", + "numba_np", + "numba_npr", + "numpy", + "python", + "sycl", +] + __all__ = [ "initialize", + "all_benchmarks", ] """ diff --git a/dpbench/infrastructure/benchmark.py b/dpbench/infrastructure/benchmark.py index ab470354..ed759e9e 100644 --- a/dpbench/infrastructure/benchmark.py +++ b/dpbench/infrastructure/benchmark.py @@ -938,11 +938,11 @@ def run( results.append(result) else: + mod = importlib.import_module("dpbench.benchmarks." + self.bname) + bench_list = mod.all_benchmarks + # Run the benchmark for all available implementations - for impl in self.get_impl_fnlist(): - impl_postfix = impl[0][ - (len(self.bname) - len(impl[0]) + 1) : # noqa: E203 - ] + for impl_postfix in bench_list: runner = BenchmarkRunner( bench=self, impl_postfix=impl_postfix, From c6c7ab7ad9fe7ef5b9449c66b6a268a0959e0703 Mon Sep 17 00:00:00 2001 From: Ivan Butygin Date: Tue, 6 Dec 2022 20:31:02 +0100 Subject: [PATCH 07/24] Try to fix SYCL wl --- dpbench/benchmarks/black_scholes/__init__.py | 6 ++++- dpbench/infrastructure/benchmark.py | 23 +++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/dpbench/benchmarks/black_scholes/__init__.py b/dpbench/benchmarks/black_scholes/__init__.py index 1a44128c..7f6d9cf1 100644 --- a/dpbench/benchmarks/black_scholes/__init__.py +++ b/dpbench/benchmarks/black_scholes/__init__.py @@ -4,6 +4,10 @@ from .black_scholes_initialize import initialize +# List of all available benchmarks, each element must either a postfix string +# (in this case specific benchmark module name will be deduced from postfix and +# benchmark name) or 2-element tuple where first elemtn is potfix and second is +# module name. all_benchmarks = [ "dpnp", "numba_dpex_k", @@ -14,7 +18,7 @@ "numba_npr", "numpy", "python", - "sycl", + ("sycl", "black_scholes_sycl_native_ext"), ] __all__ = [ diff --git a/dpbench/infrastructure/benchmark.py b/dpbench/infrastructure/benchmark.py index ed759e9e..af6f9713 100644 --- a/dpbench/infrastructure/benchmark.py +++ b/dpbench/infrastructure/benchmark.py @@ -796,8 +796,26 @@ def has_impl(self, impl_postfix: str): else: return False + def _get_impl_names(self): + mod = importlib.import_module("dpbench.benchmarks." + self.bname) + bench_list = mod.all_benchmarks + + result = {} + for bench in bench_list: + if isinstance(bench, tuple): + postfix = bench[0] + name = bench[1] + else: + postfix = bench + name = self.bname + "_" + postfix + + result[postfix] = name + + return result + def _get_updated_fnlist(self, impl_postfix: str, impl_fnlist): - name = self.bname + "_" + impl_postfix + name = self._get_impl_names()[impl_postfix] + for n, _ in impl_fnlist: if n == name: return impl_fnlist @@ -938,8 +956,7 @@ def run( results.append(result) else: - mod = importlib.import_module("dpbench.benchmarks." + self.bname) - bench_list = mod.all_benchmarks + bench_list = self._get_impl_names().keys() # Run the benchmark for all available implementations for impl_postfix in bench_list: From 38dd62db40aa707b9a6a1f48a1069cb6f1140a19 Mon Sep 17 00:00:00 2001 From: Ivan Butygin Date: Tue, 6 Dec 2022 20:39:25 +0100 Subject: [PATCH 08/24] typo --- dpbench/benchmarks/black_scholes/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpbench/benchmarks/black_scholes/__init__.py b/dpbench/benchmarks/black_scholes/__init__.py index 7f6d9cf1..b5adceae 100644 --- a/dpbench/benchmarks/black_scholes/__init__.py +++ b/dpbench/benchmarks/black_scholes/__init__.py @@ -6,7 +6,7 @@ # List of all available benchmarks, each element must either a postfix string # (in this case specific benchmark module name will be deduced from postfix and -# benchmark name) or 2-element tuple where first elemtn is potfix and second is +# benchmark name) or 2-element tuple where first element is potfix and second is # module name. all_benchmarks = [ "dpnp", From 717f97e9516bfa082dd036420c0e5c0f63abaaf6 Mon Sep 17 00:00:00 2001 From: Ivan Butygin Date: Tue, 6 Dec 2022 20:57:51 +0100 Subject: [PATCH 09/24] fixes to benchmark discovery --- dpbench/infrastructure/benchmark.py | 32 +++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/dpbench/infrastructure/benchmark.py b/dpbench/infrastructure/benchmark.py index af6f9713..05753814 100644 --- a/dpbench/infrastructure/benchmark.py +++ b/dpbench/infrastructure/benchmark.py @@ -753,9 +753,17 @@ def __init__(self, bmodule: object, bconfig_path: str = None): benchmark. If none is provided, the default config inside the package's bench_info directory is used. """ + self.bname = bmodule.__name__.split(".")[-1] self.bdata = dict() self.refdata = dict() + + bench_mod = importlib.import_module("dpbench.benchmarks." + self.bname) + if hasattr(bench_mod, "all_benchmarks"): + self.bench_list = bench_mod.all_benchmarks + else: + self.bench_list = None + try: self._load_benchmark_info(bconfig_path) self._set_data_initialization_fn(bmodule) @@ -797,11 +805,11 @@ def has_impl(self, impl_postfix: str): return False def _get_impl_names(self): - mod = importlib.import_module("dpbench.benchmarks." + self.bname) - bench_list = mod.all_benchmarks + if self.bench_list is None: + return None result = {} - for bench in bench_list: + for bench in self.bench_list: if isinstance(bench, tuple): postfix = bench[0] name = bench[1] @@ -814,7 +822,11 @@ def _get_impl_names(self): return result def _get_updated_fnlist(self, impl_postfix: str, impl_fnlist): - name = self._get_impl_names()[impl_postfix] + names = self._get_impl_names() + if names: + name = names[impl_postfix] + else: + name = name = self.bname + "_" + postfix for n, _ in impl_fnlist: if n == name: @@ -956,10 +968,18 @@ def run( results.append(result) else: - bench_list = self._get_impl_names().keys() + impl_fnlist = self.get_impl_fnlist() + + bench_list = self._get_impl_names() + if bench_list: + for postfix in bench_list.keys(): + impl_fnlist = self._get_updated_fnlist(postfix, impl_fnlist) # Run the benchmark for all available implementations - for impl_postfix in bench_list: + for impl in impl_fnlist: + impl_postfix = impl[0][ + (len(self.bname) - len(impl[0]) + 1) : # noqa: E203 + ] runner = BenchmarkRunner( bench=self, impl_postfix=impl_postfix, From 50ce0c92040528a39e3ccdd93b3ce727f0968700 Mon Sep 17 00:00:00 2001 From: Ivan Butygin Date: Tue, 6 Dec 2022 21:05:58 +0100 Subject: [PATCH 10/24] fix --- dpbench/infrastructure/benchmark.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpbench/infrastructure/benchmark.py b/dpbench/infrastructure/benchmark.py index 05753814..48b0af8c 100644 --- a/dpbench/infrastructure/benchmark.py +++ b/dpbench/infrastructure/benchmark.py @@ -826,7 +826,7 @@ def _get_updated_fnlist(self, impl_postfix: str, impl_fnlist): if names: name = names[impl_postfix] else: - name = name = self.bname + "_" + postfix + name = name = self.bname + "_" + impl_postfix for n, _ in impl_fnlist: if n == name: From b19294aaa655d72c8cb48316155a9118d78692ee Mon Sep 17 00:00:00 2001 From: Ivan Butygin Date: Tue, 6 Dec 2022 21:11:32 +0100 Subject: [PATCH 11/24] fix sycl bench name --- dpbench/benchmarks/black_scholes/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpbench/benchmarks/black_scholes/__init__.py b/dpbench/benchmarks/black_scholes/__init__.py index b5adceae..6b955eaf 100644 --- a/dpbench/benchmarks/black_scholes/__init__.py +++ b/dpbench/benchmarks/black_scholes/__init__.py @@ -18,7 +18,7 @@ "numba_npr", "numpy", "python", - ("sycl", "black_scholes_sycl_native_ext"), + ("sycl", "black_scholes_sycl_native_ext.black_scholes_sycl"), ] __all__ = [ From 37e5682894bb243223e5060a9119808b8c77344d Mon Sep 17 00:00:00 2001 From: Ivan Butygin Date: Tue, 6 Dec 2022 21:31:01 +0100 Subject: [PATCH 12/24] Check both `self.bname` and `self.bname + "_" + impl_postfix` --- dpbench/infrastructure/benchmark.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dpbench/infrastructure/benchmark.py b/dpbench/infrastructure/benchmark.py index 48b0af8c..c3fd4db3 100644 --- a/dpbench/infrastructure/benchmark.py +++ b/dpbench/infrastructure/benchmark.py @@ -840,7 +840,12 @@ def _get_updated_fnlist(self, impl_postfix: str, impl_fnlist): logging.exception("Cannot import " + name) return impl_fnlist - return impl_fnlist + [(name, getattr(mod, self.bname))] + func_names = [self.bname, self.bname + "_" + impl_postfix] + for func in func_names: + if hasattr(mod, func): + return impl_fnlist + [(name, getattr(mod, func))] + + return impl_fnlist def get_impl(self, impl_postfix: str): if not impl_postfix: From 79d46e10eb2256da3f42919bd23286cd10542a1f Mon Sep 17 00:00:00 2001 From: Ivan Butygin Date: Tue, 6 Dec 2022 21:31:11 +0100 Subject: [PATCH 13/24] Fix mod name --- dpbench/benchmarks/black_scholes/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpbench/benchmarks/black_scholes/__init__.py b/dpbench/benchmarks/black_scholes/__init__.py index 6b955eaf..b5adceae 100644 --- a/dpbench/benchmarks/black_scholes/__init__.py +++ b/dpbench/benchmarks/black_scholes/__init__.py @@ -18,7 +18,7 @@ "numba_npr", "numpy", "python", - ("sycl", "black_scholes_sycl_native_ext.black_scholes_sycl"), + ("sycl", "black_scholes_sycl_native_ext"), ] __all__ = [ From 42024d7f80e1a82c0df5f956433c315b41de1ad5 Mon Sep 17 00:00:00 2001 From: Ivan Butygin Date: Tue, 6 Dec 2022 21:50:44 +0100 Subject: [PATCH 14/24] log error --- dpbench/infrastructure/benchmark.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dpbench/infrastructure/benchmark.py b/dpbench/infrastructure/benchmark.py index c3fd4db3..dddeea4d 100644 --- a/dpbench/infrastructure/benchmark.py +++ b/dpbench/infrastructure/benchmark.py @@ -845,6 +845,9 @@ def _get_updated_fnlist(self, impl_postfix: str, impl_fnlist): if hasattr(mod, func): return impl_fnlist + [(name, getattr(mod, func))] + logging.error( + "Unable find benchmark function for " + impl_postfix + " postfix" + ) return impl_fnlist def get_impl(self, impl_postfix: str): From 2c0a470cf7bf26c48137c2cdfff46af2ecfa36b2 Mon Sep 17 00:00:00 2001 From: Ivan Butygin Date: Tue, 6 Dec 2022 21:51:00 +0100 Subject: [PATCH 15/24] Revert "Fix mod name" This reverts commit b8a09f383653d8f331b7a07b4c7537ceaa40ee7e. --- dpbench/benchmarks/black_scholes/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpbench/benchmarks/black_scholes/__init__.py b/dpbench/benchmarks/black_scholes/__init__.py index b5adceae..6b955eaf 100644 --- a/dpbench/benchmarks/black_scholes/__init__.py +++ b/dpbench/benchmarks/black_scholes/__init__.py @@ -18,7 +18,7 @@ "numba_npr", "numpy", "python", - ("sycl", "black_scholes_sycl_native_ext"), + ("sycl", "black_scholes_sycl_native_ext.black_scholes_sycl"), ] __all__ = [ From d7f1ce8b5c45155768c4f240617987c2c54bc95c Mon Sep 17 00:00:00 2001 From: Ivan Butygin Date: Tue, 6 Dec 2022 21:57:32 +0100 Subject: [PATCH 16/24] typo --- dpbench/infrastructure/benchmark.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpbench/infrastructure/benchmark.py b/dpbench/infrastructure/benchmark.py index dddeea4d..492f797a 100644 --- a/dpbench/infrastructure/benchmark.py +++ b/dpbench/infrastructure/benchmark.py @@ -846,7 +846,7 @@ def _get_updated_fnlist(self, impl_postfix: str, impl_fnlist): return impl_fnlist + [(name, getattr(mod, func))] logging.error( - "Unable find benchmark function for " + impl_postfix + " postfix" + "Unable to find benchmark function for " + impl_postfix + " postfix" ) return impl_fnlist From e5917ebe7f41db4eaa9441cf8abf522f204b2f1c Mon Sep 17 00:00:00 2001 From: Ivan Butygin Date: Tue, 6 Dec 2022 21:58:56 +0100 Subject: [PATCH 17/24] debug print --- dpbench/infrastructure/benchmark.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dpbench/infrastructure/benchmark.py b/dpbench/infrastructure/benchmark.py index 492f797a..ce8d95df 100644 --- a/dpbench/infrastructure/benchmark.py +++ b/dpbench/infrastructure/benchmark.py @@ -840,6 +840,8 @@ def _get_updated_fnlist(self, impl_postfix: str, impl_fnlist): logging.exception("Cannot import " + name) return impl_fnlist + print('0-0-0-0-0-0 ', dir(mod)) + func_names = [self.bname, self.bname + "_" + impl_postfix] for func in func_names: if hasattr(mod, func): From 2206909b28a4381d60e05d73e0accec32b03ae91 Mon Sep 17 00:00:00 2001 From: Ivan Butygin Date: Tue, 6 Dec 2022 22:15:13 +0100 Subject: [PATCH 18/24] more debug print --- dpbench/infrastructure/benchmark.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpbench/infrastructure/benchmark.py b/dpbench/infrastructure/benchmark.py index ce8d95df..6a332b96 100644 --- a/dpbench/infrastructure/benchmark.py +++ b/dpbench/infrastructure/benchmark.py @@ -840,7 +840,7 @@ def _get_updated_fnlist(self, impl_postfix: str, impl_fnlist): logging.exception("Cannot import " + name) return impl_fnlist - print('0-0-0-0-0-0 ', dir(mod)) + print("0-0-0-0-0-0 ", mod, dir(mod)) func_names = [self.bname, self.bname + "_" + impl_postfix] for func in func_names: From 3bf1fa32bfcb41a3ca0ac346e08a561d3f81ba24 Mon Sep 17 00:00:00 2001 From: Ivan Butygin Date: Tue, 6 Dec 2022 22:29:10 +0100 Subject: [PATCH 19/24] more debug print --- dpbench/infrastructure/benchmark.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dpbench/infrastructure/benchmark.py b/dpbench/infrastructure/benchmark.py index 6a332b96..f37e2880 100644 --- a/dpbench/infrastructure/benchmark.py +++ b/dpbench/infrastructure/benchmark.py @@ -822,12 +822,15 @@ def _get_impl_names(self): return result def _get_updated_fnlist(self, impl_postfix: str, impl_fnlist): + print("0-0-0-0-0-0 1 ", impl_postfix) names = self._get_impl_names() if names: name = names[impl_postfix] else: name = name = self.bname + "_" + impl_postfix + print("0-0-0-0-0-0 2 ", name) + for n, _ in impl_fnlist: if n == name: return impl_fnlist @@ -840,7 +843,7 @@ def _get_updated_fnlist(self, impl_postfix: str, impl_fnlist): logging.exception("Cannot import " + name) return impl_fnlist - print("0-0-0-0-0-0 ", mod, dir(mod)) + print("0-0-0-0-0-0 3 ", mod, dir(mod)) func_names = [self.bname, self.bname + "_" + impl_postfix] for func in func_names: From 0e153d4eeb73f36edfab2dfe90cf177bcd426eca Mon Sep 17 00:00:00 2001 From: Ivan Butygin Date: Wed, 7 Dec 2022 16:16:23 +0100 Subject: [PATCH 20/24] more debug print --- dpbench/infrastructure/benchmark.py | 1 + 1 file changed, 1 insertion(+) diff --git a/dpbench/infrastructure/benchmark.py b/dpbench/infrastructure/benchmark.py index f37e2880..0371e439 100644 --- a/dpbench/infrastructure/benchmark.py +++ b/dpbench/infrastructure/benchmark.py @@ -850,6 +850,7 @@ def _get_updated_fnlist(self, impl_postfix: str, impl_fnlist): if hasattr(mod, func): return impl_fnlist + [(name, getattr(mod, func))] + print("0-0-0-0-0-0 4 ", impl_postfix) logging.error( "Unable to find benchmark function for " + impl_postfix + " postfix" ) From a664640128982c7d8b21a7c5e3871a24c7202455 Mon Sep 17 00:00:00 2001 From: Ivan Butygin Date: Wed, 7 Dec 2022 16:42:50 +0100 Subject: [PATCH 21/24] test --- dpbench/benchmarks/black_scholes/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpbench/benchmarks/black_scholes/__init__.py b/dpbench/benchmarks/black_scholes/__init__.py index 6b955eaf..b5adceae 100644 --- a/dpbench/benchmarks/black_scholes/__init__.py +++ b/dpbench/benchmarks/black_scholes/__init__.py @@ -18,7 +18,7 @@ "numba_npr", "numpy", "python", - ("sycl", "black_scholes_sycl_native_ext.black_scholes_sycl"), + ("sycl", "black_scholes_sycl_native_ext"), ] __all__ = [ From fae752c2a30b8bc8418018767e036bddaeeec74a Mon Sep 17 00:00:00 2001 From: Ivan Butygin Date: Wed, 7 Dec 2022 16:58:04 +0100 Subject: [PATCH 22/24] test --- dpbench/benchmarks/black_scholes/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dpbench/benchmarks/black_scholes/__init__.py b/dpbench/benchmarks/black_scholes/__init__.py index b5adceae..34898655 100644 --- a/dpbench/benchmarks/black_scholes/__init__.py +++ b/dpbench/benchmarks/black_scholes/__init__.py @@ -18,7 +18,10 @@ "numba_npr", "numpy", "python", - ("sycl", "black_scholes_sycl_native_ext"), + ( + "sycl", + "black_scholes_sycl_native_ext.black_scholes_sycl._black_scholes_sycl", + ), ] __all__ = [ From ccae7aed3f591b054a5ebacc133fd1acc1948e14 Mon Sep 17 00:00:00 2001 From: Ivan Butygin Date: Wed, 7 Dec 2022 17:07:26 +0100 Subject: [PATCH 23/24] fix name --- dpbench/infrastructure/benchmark.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dpbench/infrastructure/benchmark.py b/dpbench/infrastructure/benchmark.py index 0371e439..094e903c 100644 --- a/dpbench/infrastructure/benchmark.py +++ b/dpbench/infrastructure/benchmark.py @@ -824,10 +824,11 @@ def _get_impl_names(self): def _get_updated_fnlist(self, impl_postfix: str, impl_fnlist): print("0-0-0-0-0-0 1 ", impl_postfix) names = self._get_impl_names() + canonical_name = self.bname + "_" + impl_postfix if names: name = names[impl_postfix] else: - name = name = self.bname + "_" + impl_postfix + name = canonical_name print("0-0-0-0-0-0 2 ", name) @@ -848,7 +849,7 @@ def _get_updated_fnlist(self, impl_postfix: str, impl_fnlist): func_names = [self.bname, self.bname + "_" + impl_postfix] for func in func_names: if hasattr(mod, func): - return impl_fnlist + [(name, getattr(mod, func))] + return impl_fnlist + [(canonical_name, getattr(mod, func))] print("0-0-0-0-0-0 4 ", impl_postfix) logging.error( From 6f283e81553bff3bac6aa61f2301e92174eecca0 Mon Sep 17 00:00:00 2001 From: Ivan Butygin Date: Wed, 7 Dec 2022 17:27:23 +0100 Subject: [PATCH 24/24] remove debug print --- dpbench/infrastructure/benchmark.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/dpbench/infrastructure/benchmark.py b/dpbench/infrastructure/benchmark.py index 094e903c..acae37f3 100644 --- a/dpbench/infrastructure/benchmark.py +++ b/dpbench/infrastructure/benchmark.py @@ -822,7 +822,6 @@ def _get_impl_names(self): return result def _get_updated_fnlist(self, impl_postfix: str, impl_fnlist): - print("0-0-0-0-0-0 1 ", impl_postfix) names = self._get_impl_names() canonical_name = self.bname + "_" + impl_postfix if names: @@ -830,8 +829,6 @@ def _get_updated_fnlist(self, impl_postfix: str, impl_fnlist): else: name = canonical_name - print("0-0-0-0-0-0 2 ", name) - for n, _ in impl_fnlist: if n == name: return impl_fnlist @@ -844,14 +841,11 @@ def _get_updated_fnlist(self, impl_postfix: str, impl_fnlist): logging.exception("Cannot import " + name) return impl_fnlist - print("0-0-0-0-0-0 3 ", mod, dir(mod)) - func_names = [self.bname, self.bname + "_" + impl_postfix] for func in func_names: if hasattr(mod, func): return impl_fnlist + [(canonical_name, getattr(mod, func))] - print("0-0-0-0-0-0 4 ", impl_postfix) logging.error( "Unable to find benchmark function for " + impl_postfix + " postfix" )