holobench 1.26.3__py3-none-any.whl → 1.28.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bencher/bench_report.py +6 -109
- bencher/bencher.py +48 -46
- bencher/variables/parametrised_sweep.py +3 -1
- {holobench-1.26.3.dist-info → holobench-1.28.0.dist-info}/METADATA +4 -4
- {holobench-1.26.3.dist-info → holobench-1.28.0.dist-info}/RECORD +10 -10
- {holobench-1.26.3.dist-info → holobench-1.28.0.dist-info}/WHEEL +1 -1
- {holobench-1.26.3.data → holobench-1.28.0.data}/data/share/ament_index/resource_index/packages/bencher +0 -0
- {holobench-1.26.3.data → holobench-1.28.0.data}/data/share/bencher/package.xml +0 -0
- {holobench-1.26.3.dist-info → holobench-1.28.0.dist-info}/LICENSE +0 -0
- {holobench-1.26.3.dist-info → holobench-1.28.0.dist-info}/top_level.txt +0 -0
bencher/bench_report.py
CHANGED
@@ -157,112 +157,9 @@ class BenchReport(BenchPlotServer):
|
|
157
157
|
|
158
158
|
return publish_url
|
159
159
|
|
160
|
-
|
161
|
-
# def
|
162
|
-
#
|
163
|
-
|
164
|
-
#
|
165
|
-
#
|
166
|
-
# # Don't pickle baz
|
167
|
-
# del state["pane"]
|
168
|
-
# return state
|
169
|
-
|
170
|
-
# def __setstate__(self, state):
|
171
|
-
# self.__dict__.update(state)
|
172
|
-
# # Add baz back since it doesn't exist in the pickle
|
173
|
-
# self.report = []
|
174
|
-
|
175
|
-
# def publish_old(
|
176
|
-
# self,
|
177
|
-
# directory: str = "bench_results",
|
178
|
-
# branch_name: str = "bench_results",
|
179
|
-
# url_postprocess: Callable = None,
|
180
|
-
# **kwargs,
|
181
|
-
# ) -> str:
|
182
|
-
# """Publish the results as an html file by committing it to the bench_results branch in the current repo. If you have set up your repo with github pages or equivalent then the html file will be served as a viewable webpage.
|
183
|
-
|
184
|
-
# Args:
|
185
|
-
# directory (str, optional): Directory to save the results. Defaults to "bench_results".
|
186
|
-
# branch_name (str, optional): Branch to publish on. Defaults to "bench_results".
|
187
|
-
# url_postprocess (Callable, optional): A function that maps the origin url to a github pages url. Pass your own function if you are using another git providers. Defaults to None.
|
188
|
-
|
189
|
-
# Returns:
|
190
|
-
# str: _description_
|
191
|
-
# """
|
192
|
-
|
193
|
-
# def get_output(cmd: str) -> str:
|
194
|
-
# return (
|
195
|
-
# subprocess.run(cmd.split(" "), stdout=subprocess.PIPE, check=False)
|
196
|
-
# .stdout.decode("utf=8")
|
197
|
-
# .strip()
|
198
|
-
# )
|
199
|
-
|
200
|
-
# def postprocess_url(publish_url: str, branch_name: str, report_path: str, **kwargs) -> str:
|
201
|
-
# # import re
|
202
|
-
|
203
|
-
# # return re.sub(
|
204
|
-
# # """((git|ssh|http(s)?)|(git@[\w\.-]+))(:(//)?)([\w\.@\:/\-~]+)(\.git)(/)?""",
|
205
|
-
# # """https://$7/""",
|
206
|
-
# # publish_url,
|
207
|
-
# # )
|
208
|
-
# # git@github.com:user/project.git
|
209
|
-
# # https://github.com/user/project.git
|
210
|
-
# # http://github.com/user/project.git
|
211
|
-
# # git@192.168.101.127:user/project.git
|
212
|
-
# # https://192.168.101.127/user/project.git
|
213
|
-
# # http://192.168.101.127/user/project.git
|
214
|
-
# # ssh://user@host.xz:port/path/to/repo.git/
|
215
|
-
# # ssh://user@host.xz/path/to/repo.git/
|
216
|
-
# # ssh://host.xz:port/path/to/repo.git/
|
217
|
-
# # ssh://host.xz/path/to/repo.git/
|
218
|
-
# # ssh://user@host.xz/path/to/repo.git/
|
219
|
-
# # ssh://host.xz/path/to/repo.git/
|
220
|
-
# # ssh://user@host.xz/~user/path/to/repo.git/
|
221
|
-
# # ssh://host.xz/~user/path/to/repo.git/
|
222
|
-
# # ssh://user@host.xz/~/path/to/repo.git
|
223
|
-
# # ssh://host.xz/~/path/to/repo.git
|
224
|
-
# # git://host.xz/path/to/repo.git/
|
225
|
-
# # git://host.xz/~user/path/to/repo.git/
|
226
|
-
# # http://host.xz/path/to/repo.git/
|
227
|
-
# # https://host.xz/path/to/repo.git/
|
228
|
-
# # https://regex101.com/r/qT7NP0/3
|
229
|
-
|
230
|
-
# return publish_url.replace(".git", f"/blob/{directory}/{report_path}")
|
231
|
-
|
232
|
-
# if url_postprocess is None:
|
233
|
-
# url_postprocess = postprocess_url
|
234
|
-
# current_branch = get_output("git symbolic-ref --short HEAD")
|
235
|
-
# logging.info(f"on branch: {current_branch}")
|
236
|
-
# stash_msg = get_output("git stash")
|
237
|
-
# logging.info(f"stashing current work :{stash_msg}")
|
238
|
-
# checkout_msg = get_output(f"git checkout -b {branch_name}")
|
239
|
-
# checkout_msg = get_output(f"git checkout {branch_name}")
|
240
|
-
# get_output("git pull")
|
241
|
-
|
242
|
-
# logging.info(f"checking out branch: {checkout_msg}")
|
243
|
-
# report_path = self.save(directory, in_html_folder=False)
|
244
|
-
# logging.info(f"created report at: {report_path.absolute()}")
|
245
|
-
# # commit_msg = f""
|
246
|
-
# logging.info("adding report to git")
|
247
|
-
# get_output(f"git add {report_path.absolute()}")
|
248
|
-
# get_output("git status")
|
249
|
-
# logging.info("committing report")
|
250
|
-
# cmd = f'git commit -m "generate_report:{self.bench_name}"'
|
251
|
-
# logging.info(cmd)
|
252
|
-
# get_output(cmd)
|
253
|
-
# logging.info("pushing report to origin")
|
254
|
-
# get_output(f"git push --set-upstream origin {branch_name}")
|
255
|
-
# logging.info("checking out original branch")
|
256
|
-
# get_output(f"git checkout {current_branch}")
|
257
|
-
# if "No local changes" not in stash_msg:
|
258
|
-
# logging.info("restoring work with git stash pop")
|
259
|
-
# get_output("git stash pop")
|
260
|
-
|
261
|
-
# publish_url = get_output("git remote get-url --push origin")
|
262
|
-
# logging.info(f"raw url:{publish_url}")
|
263
|
-
# publish_url = url_postprocess(
|
264
|
-
# publish_url, branch_name=branch_name, report_path=report_path, **kwargs
|
265
|
-
# )
|
266
|
-
# logging.info("Published report @")
|
267
|
-
# logging.info(publish_url)
|
268
|
-
# return publish_url
|
160
|
+
# @staticmethod
|
161
|
+
# def publish_github(github_user: str, repo_name: str, branch_name: str) -> Tuple[str, str]:
|
162
|
+
# return (
|
163
|
+
# f"https://github.com/{github_user}/{repo_name}.git",
|
164
|
+
# f"https://github.com/{github_user}/{repo_name}/blob/{branch_name}",
|
165
|
+
# )
|
bencher/bencher.py
CHANGED
@@ -280,40 +280,42 @@ class Bench(BenchPlotServer):
|
|
280
280
|
BenchResult: A class with all the data used to generate the results and the results
|
281
281
|
"""
|
282
282
|
|
283
|
+
input_vars_in = deepcopy(input_vars)
|
284
|
+
result_vars_in = deepcopy(result_vars)
|
285
|
+
const_vars_in = deepcopy(const_vars)
|
286
|
+
|
283
287
|
if self.worker_class_instance is not None:
|
284
|
-
if
|
288
|
+
if input_vars_in is None:
|
285
289
|
logging.info(
|
286
290
|
"No input variables passed, using all param variables in bench class as inputs"
|
287
291
|
)
|
288
292
|
if self.input_vars is None:
|
289
|
-
|
293
|
+
input_vars_in = self.worker_class_instance.get_inputs_only()
|
290
294
|
else:
|
291
|
-
|
292
|
-
for i in
|
295
|
+
input_vars_in = deepcopy(self.input_vars)
|
296
|
+
for i in input_vars_in:
|
293
297
|
logging.info(f"input var: {i.name}")
|
294
|
-
if
|
298
|
+
if result_vars_in is None:
|
295
299
|
logging.info(
|
296
300
|
"No results variables passed, using all result variables in bench class:"
|
297
301
|
)
|
298
302
|
if self.result_vars is None:
|
299
|
-
|
303
|
+
result_vars_in = self.worker_class_instance.get_results_only()
|
300
304
|
else:
|
301
|
-
|
305
|
+
result_vars_in = deepcopy(self.result_vars)
|
302
306
|
|
303
|
-
if
|
307
|
+
if const_vars_in is None:
|
304
308
|
if self.const_vars is None:
|
305
|
-
|
309
|
+
const_vars_in = self.worker_class_instance.get_input_defaults()
|
306
310
|
else:
|
307
|
-
|
311
|
+
const_vars_in = deepcopy(self.const_vars)
|
308
312
|
else:
|
309
|
-
if
|
310
|
-
|
311
|
-
if
|
312
|
-
|
313
|
-
if
|
314
|
-
|
315
|
-
else:
|
316
|
-
const_vars = deepcopy(const_vars)
|
313
|
+
if input_vars_in is None:
|
314
|
+
input_vars_in = []
|
315
|
+
if result_vars_in is None:
|
316
|
+
result_vars_in = []
|
317
|
+
if const_vars_in is None:
|
318
|
+
const_vars_in = []
|
317
319
|
|
318
320
|
if run_cfg is None:
|
319
321
|
if self.run_cfg is None:
|
@@ -328,9 +330,9 @@ class Bench(BenchPlotServer):
|
|
328
330
|
|
329
331
|
self.last_run_cfg = run_cfg
|
330
332
|
|
331
|
-
if isinstance(
|
333
|
+
if isinstance(input_vars_in, dict):
|
332
334
|
input_lists = []
|
333
|
-
for k, v in
|
335
|
+
for k, v in input_vars_in.items():
|
334
336
|
param_var = self.convert_vars_to_params(k, "input", run_cfg)
|
335
337
|
if isinstance(v, list):
|
336
338
|
assert len(v) > 0
|
@@ -340,56 +342,56 @@ class Bench(BenchPlotServer):
|
|
340
342
|
raise RuntimeError("Unsupported type")
|
341
343
|
input_lists.append(param_var)
|
342
344
|
|
343
|
-
|
345
|
+
input_vars_in = input_lists
|
344
346
|
else:
|
345
|
-
for i in range(len(
|
346
|
-
|
347
|
-
for i in range(len(
|
348
|
-
|
347
|
+
for i in range(len(input_vars_in)):
|
348
|
+
input_vars_in[i] = self.convert_vars_to_params(input_vars_in[i], "input", run_cfg)
|
349
|
+
for i in range(len(result_vars_in)):
|
350
|
+
result_vars_in[i] = self.convert_vars_to_params(result_vars_in[i], "result", run_cfg)
|
349
351
|
|
350
|
-
for r in
|
352
|
+
for r in result_vars_in:
|
351
353
|
logging.info(f"result var: {r.name}")
|
352
354
|
|
353
|
-
if isinstance(
|
354
|
-
|
355
|
+
if isinstance(const_vars_in, dict):
|
356
|
+
const_vars_in = list(const_vars_in.items())
|
355
357
|
|
356
|
-
for i in range(len(
|
358
|
+
for i in range(len(const_vars_in)):
|
357
359
|
# consts come as tuple pairs
|
358
|
-
cv_list = list(
|
360
|
+
cv_list = list(const_vars_in[i])
|
359
361
|
cv_list[0] = self.convert_vars_to_params(cv_list[0], "const", run_cfg)
|
360
|
-
|
362
|
+
const_vars_in[i] = cv_list
|
361
363
|
|
362
364
|
if title is None:
|
363
|
-
if len(
|
364
|
-
title = "Sweeping " + " vs ".join([i.name for i in
|
365
|
-
elif len(
|
365
|
+
if len(input_vars_in) > 0:
|
366
|
+
title = "Sweeping " + " vs ".join([i.name for i in input_vars_in])
|
367
|
+
elif len(const_vars_in) > 0:
|
366
368
|
title = "Constant Value"
|
367
|
-
if len(
|
369
|
+
if len(const_vars_in) > 1:
|
368
370
|
title += "s"
|
369
|
-
title += ": " + ", ".join([f"{c[0].name}={c[1]}" for c in
|
371
|
+
title += ": " + ", ".join([f"{c[0].name}={c[1]}" for c in const_vars_in])
|
370
372
|
else:
|
371
373
|
raise RuntimeError("you must pass a title, or define inputs or consts")
|
372
374
|
|
373
375
|
if run_cfg.level > 0:
|
374
376
|
inputs = []
|
375
|
-
print(
|
376
|
-
if len(
|
377
|
-
for i in
|
377
|
+
print(input_vars_in)
|
378
|
+
if len(input_vars_in) > 0:
|
379
|
+
for i in input_vars_in:
|
378
380
|
inputs.append(i.with_level(run_cfg.level))
|
379
|
-
|
381
|
+
input_vars_in = inputs
|
380
382
|
|
381
383
|
# if any of the inputs have been include as constants, remove those variables from the list of constants
|
382
384
|
with suppress(ValueError, AttributeError):
|
383
|
-
for i in
|
384
|
-
for c in
|
385
|
+
for i in input_vars_in:
|
386
|
+
for c in const_vars_in:
|
385
387
|
# print(i.hash_persistent())
|
386
388
|
if i.name == c[0].name:
|
387
|
-
|
389
|
+
const_vars_in.remove(c)
|
388
390
|
logging.info(f"removing {i.name} from constants")
|
389
391
|
|
390
392
|
result_hmaps = []
|
391
393
|
result_vars_only = []
|
392
|
-
for i in
|
394
|
+
for i in result_vars_in:
|
393
395
|
if isinstance(i, ResultHmap):
|
394
396
|
result_hmaps.append(i)
|
395
397
|
else:
|
@@ -409,10 +411,10 @@ class Bench(BenchPlotServer):
|
|
409
411
|
plot_callbacks = [BenchResult.to_auto_plots] if plot_callbacks else []
|
410
412
|
|
411
413
|
bench_cfg = BenchCfg(
|
412
|
-
input_vars=
|
414
|
+
input_vars=input_vars_in,
|
413
415
|
result_vars=result_vars_only,
|
414
416
|
result_hmaps=result_hmaps,
|
415
|
-
const_vars=
|
417
|
+
const_vars=const_vars_in,
|
416
418
|
bench_name=self.bench_name,
|
417
419
|
description=description,
|
418
420
|
post_description=post_description,
|
@@ -7,6 +7,7 @@ import panel as pn
|
|
7
7
|
|
8
8
|
from bencher.utils import make_namedtuple, hash_sha1
|
9
9
|
from bencher.variables.results import ALL_RESULT_TYPES, ResultHmap
|
10
|
+
from bencher.bench_cfg import BenchRunCfg
|
10
11
|
|
11
12
|
|
12
13
|
class ParametrizedSweep(Parameterized):
|
@@ -197,7 +198,8 @@ class ParametrizedSweep(Parameterized):
|
|
197
198
|
def plot_hmap(self, **kwargs):
|
198
199
|
return self.__call__(**kwargs)["hmap"]
|
199
200
|
|
200
|
-
|
201
|
+
# TODO Add type hints here and fix the circular imports
|
202
|
+
def to_bench(self, run_cfg: BenchRunCfg = None, report=None, name: str = None):
|
201
203
|
from bencher import Bench
|
202
204
|
|
203
205
|
assert isinstance(self, ParametrizedSweep)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: holobench
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.28.0
|
4
4
|
Summary: A package for benchmarking the performance of arbitrary functions
|
5
5
|
Author-email: Austin Gregg-Smith <blooop@gmail.com>
|
6
6
|
Project-URL: Repository, https://github.com/dyson-ai/bencher
|
@@ -9,7 +9,7 @@ Project-URL: Documentation, https://bencher.readthedocs.io/en/latest/
|
|
9
9
|
Description-Content-Type: text/markdown
|
10
10
|
License-File: LICENSE
|
11
11
|
Requires-Dist: holoviews <=1.19.0,>=1.15
|
12
|
-
Requires-Dist: numpy <=
|
12
|
+
Requires-Dist: numpy <=2.0.0,>=1.0
|
13
13
|
Requires-Dist: param <=2.1.0,>=1.13.0
|
14
14
|
Requires-Dist: hvplot <=0.10.0,>=0.8
|
15
15
|
Requires-Dist: matplotlib <=3.9.0,>=3.6.3
|
@@ -31,7 +31,7 @@ Requires-Dist: pylint <=3.2.3,>=2.17.7 ; extra == 'test'
|
|
31
31
|
Requires-Dist: pytest-cov <=5.0.0,>=4.1 ; extra == 'test'
|
32
32
|
Requires-Dist: pytest <=8.2.2,>=7.4 ; extra == 'test'
|
33
33
|
Requires-Dist: hypothesis <=6.103.2,>=6.82 ; extra == 'test'
|
34
|
-
Requires-Dist: ruff <=0.4.
|
34
|
+
Requires-Dist: ruff <=0.4.10,>=0.0.280 ; extra == 'test'
|
35
35
|
Requires-Dist: coverage <=7.5.3,>=7.2.7 ; extra == 'test'
|
36
36
|
|
37
37
|
# Bencher
|
@@ -90,4 +90,4 @@ Bencher is designed to work with stochastic pure functions with no side effects.
|
|
90
90
|
|
91
91
|
### Example Output
|
92
92
|
|
93
|
-
https://dyson-ai.github.io/bencher/
|
93
|
+
https://dyson-ai.github.io/bencher/
|
@@ -1,9 +1,9 @@
|
|
1
1
|
bencher/__init__.py,sha256=gywyMfCkWiguR86HWU63s06Ts9coSY_CK2ro2V7RIbI,1561
|
2
2
|
bencher/bench_cfg.py,sha256=8rvJyeQXalZmYF8Lb-NKb9RFJs0w08k9ogcZSR1rhgs,18413
|
3
3
|
bencher/bench_plot_server.py,sha256=D00_SOrHa2IT8zAjwetoNL6tEiHSHvXnbea9iElCLVk,4195
|
4
|
-
bencher/bench_report.py,sha256=
|
4
|
+
bencher/bench_report.py,sha256=95K4ubVGXyyGO40fsdFysgPmxrI6JbXpQKdMiahm7KI,6365
|
5
5
|
bencher/bench_runner.py,sha256=-SzAKd6QbPJ05KaW3vteFIkE-UtlFS55Ob9QeE5eRXw,6202
|
6
|
-
bencher/bencher.py,sha256
|
6
|
+
bencher/bencher.py,sha256=7L5h1vRSPwRcmp8iCNhFNLj1LoV-IhPr719BQBpdgvs,34883
|
7
7
|
bencher/caching.py,sha256=AusaNrzGGlj5m6zcwcqnTn55Mam2mQdF--oqelO806M,1627
|
8
8
|
bencher/class_enum.py,sha256=kYHW9qKkKcNdwaXizZL-fTptS_DUEGv4c88yCehk3gc,1492
|
9
9
|
bencher/job.py,sha256=swa0VwrZf41v7qNjreVDIYUU6r_dfuLipPZbg_w5x7c,6089
|
@@ -80,14 +80,14 @@ bencher/results/composable_container/composable_container_panel.py,sha256=HrOoeG
|
|
80
80
|
bencher/results/composable_container/composable_container_video.py,sha256=EHY2TIQM5ualrh_or-wzyErPWm25CaYdSdMotqo5wCo,7104
|
81
81
|
bencher/variables/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
82
82
|
bencher/variables/inputs.py,sha256=tASPqEN7j_uaj8vfM1nFEpgV8QXrxTH3LfltIbV0Gp4,6725
|
83
|
-
bencher/variables/parametrised_sweep.py,sha256=
|
83
|
+
bencher/variables/parametrised_sweep.py,sha256=n3IN396Rnr1pBJqoxnMLLqC3KIJmAF4-zHupj7CQB58,7394
|
84
84
|
bencher/variables/results.py,sha256=mjr34L27NFuXqUCI1GSO8srU8VFm8niTkaSZ1iPvvbY,7159
|
85
85
|
bencher/variables/sweep_base.py,sha256=cOybffErb3_QUsCfiZa0mlVy9tGDueqiElZmc363apE,6258
|
86
86
|
bencher/variables/time.py,sha256=A1QPYM-z2p-04hKcHG80u8njiKQ-2R2IHcjo7iB92_A,3136
|
87
|
-
holobench-1.
|
88
|
-
holobench-1.
|
89
|
-
holobench-1.
|
90
|
-
holobench-1.
|
91
|
-
holobench-1.
|
92
|
-
holobench-1.
|
93
|
-
holobench-1.
|
87
|
+
holobench-1.28.0.data/data/share/ament_index/resource_index/packages/bencher,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
88
|
+
holobench-1.28.0.data/data/share/bencher/package.xml,sha256=HxWM9qIEiLbE60tG0aKsS7q3UaSKDyCMD4-1nYw8vOs,1045
|
89
|
+
holobench-1.28.0.dist-info/LICENSE,sha256=dSHXTdRY4Y7qGFMv63UksV700iff7iE-p7GGs6Sbnvo,1065
|
90
|
+
holobench-1.28.0.dist-info/METADATA,sha256=ZdRokxk7t7l5wXwtHDycYoPffgRVD0yvca7JInGTHNg,5618
|
91
|
+
holobench-1.28.0.dist-info/WHEEL,sha256=cpQTJ5IWu9CdaPViMhC9YzF8gZuS5-vlfoFihTBC86A,91
|
92
|
+
holobench-1.28.0.dist-info/top_level.txt,sha256=rkP5-F_W08mOD-25ZPkt0HJsHxedb2EiRcRA7IP6Ceg,8
|
93
|
+
holobench-1.28.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|