holobench 1.23.0__tar.gz → 1.25.0__tar.gz

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.
Files changed (48) hide show
  1. {holobench-1.23.0/holobench.egg-info → holobench-1.25.0}/PKG-INFO +1 -1
  2. {holobench-1.23.0 → holobench-1.25.0}/bencher/__init__.py +1 -1
  3. {holobench-1.23.0 → holobench-1.25.0}/bencher/bencher.py +46 -19
  4. {holobench-1.23.0 → holobench-1.25.0/holobench.egg-info}/PKG-INFO +1 -1
  5. {holobench-1.23.0 → holobench-1.25.0}/pyproject.toml +4 -1
  6. {holobench-1.23.0 → holobench-1.25.0}/test/test_bench_examples.py +8 -0
  7. {holobench-1.23.0 → holobench-1.25.0}/LICENSE +0 -0
  8. {holobench-1.23.0 → holobench-1.25.0}/README.md +0 -0
  9. {holobench-1.23.0 → holobench-1.25.0}/bencher/bench_cfg.py +0 -0
  10. {holobench-1.23.0 → holobench-1.25.0}/bencher/bench_plot_server.py +0 -0
  11. {holobench-1.23.0 → holobench-1.25.0}/bencher/bench_report.py +0 -0
  12. {holobench-1.23.0 → holobench-1.25.0}/bencher/bench_runner.py +0 -0
  13. {holobench-1.23.0 → holobench-1.25.0}/bencher/caching.py +0 -0
  14. {holobench-1.23.0 → holobench-1.25.0}/bencher/class_enum.py +0 -0
  15. {holobench-1.23.0 → holobench-1.25.0}/bencher/job.py +0 -0
  16. {holobench-1.23.0 → holobench-1.25.0}/bencher/optuna_conversions.py +0 -0
  17. {holobench-1.23.0 → holobench-1.25.0}/bencher/utils.py +0 -0
  18. {holobench-1.23.0 → holobench-1.25.0}/bencher/video_writer.py +0 -0
  19. {holobench-1.23.0 → holobench-1.25.0}/bencher/worker_job.py +0 -0
  20. {holobench-1.23.0 → holobench-1.25.0}/holobench.egg-info/SOURCES.txt +0 -0
  21. {holobench-1.23.0 → holobench-1.25.0}/holobench.egg-info/dependency_links.txt +0 -0
  22. {holobench-1.23.0 → holobench-1.25.0}/holobench.egg-info/not-zip-safe +0 -0
  23. {holobench-1.23.0 → holobench-1.25.0}/holobench.egg-info/requires.txt +0 -0
  24. {holobench-1.23.0 → holobench-1.25.0}/holobench.egg-info/top_level.txt +0 -0
  25. {holobench-1.23.0 → holobench-1.25.0}/package.xml +0 -0
  26. {holobench-1.23.0 → holobench-1.25.0}/resource/bencher +0 -0
  27. {holobench-1.23.0 → holobench-1.25.0}/setup.cfg +0 -0
  28. {holobench-1.23.0 → holobench-1.25.0}/setup.py +0 -0
  29. {holobench-1.23.0 → holobench-1.25.0}/test/test_bench_report.py +0 -0
  30. {holobench-1.23.0 → holobench-1.25.0}/test/test_bench_result_base.py +0 -0
  31. {holobench-1.23.0 → holobench-1.25.0}/test/test_bench_runner.py +0 -0
  32. {holobench-1.23.0 → holobench-1.25.0}/test/test_bencher.py +0 -0
  33. {holobench-1.23.0 → holobench-1.25.0}/test/test_cache.py +0 -0
  34. {holobench-1.23.0 → holobench-1.25.0}/test/test_class_enum.py +0 -0
  35. {holobench-1.23.0 → holobench-1.25.0}/test/test_combinations.py +0 -0
  36. {holobench-1.23.0 → holobench-1.25.0}/test/test_composable_container_base.py +0 -0
  37. {holobench-1.23.0 → holobench-1.25.0}/test/test_composable_container_video.py +0 -0
  38. {holobench-1.23.0 → holobench-1.25.0}/test/test_float_formatter.py +0 -0
  39. {holobench-1.23.0 → holobench-1.25.0}/test/test_job.py +0 -0
  40. {holobench-1.23.0 → holobench-1.25.0}/test/test_meta_tests.py +0 -0
  41. {holobench-1.23.0 → holobench-1.25.0}/test/test_parametrized_sweep.py +0 -0
  42. {holobench-1.23.0 → holobench-1.25.0}/test/test_plot_filter.py +0 -0
  43. {holobench-1.23.0 → holobench-1.25.0}/test/test_plot_server.py +0 -0
  44. {holobench-1.23.0 → holobench-1.25.0}/test/test_sample_cache.py +0 -0
  45. {holobench-1.23.0 → holobench-1.25.0}/test/test_sweep_base.py +0 -0
  46. {holobench-1.23.0 → holobench-1.25.0}/test/test_sweep_vars.py +0 -0
  47. {holobench-1.23.0 → holobench-1.25.0}/test/test_utils.py +0 -0
  48. {holobench-1.23.0 → holobench-1.25.0}/test/test_vars.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: holobench
3
- Version: 1.23.0
3
+ Version: 1.25.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
  Maintainer: austin.gregg-smith
@@ -6,7 +6,7 @@ from .variables.sweep_base import hash_sha1
6
6
  from .variables.inputs import IntSweep, FloatSweep, StringSweep, EnumSweep, BoolSweep, SweepBase
7
7
  from .variables.time import TimeSnapshot
8
8
 
9
- from .variables.inputs import box
9
+ from .variables.inputs import box, p
10
10
  from .variables.results import (
11
11
  ResultVar,
12
12
  ResultVec,
@@ -2,7 +2,7 @@ import logging
2
2
  from datetime import datetime
3
3
  from itertools import product, combinations
4
4
 
5
- from typing import Callable, List
5
+ from typing import Callable, List, Optional
6
6
  from copy import deepcopy
7
7
  import numpy as np
8
8
  import param
@@ -315,23 +315,6 @@ class Bench(BenchPlotServer):
315
315
  else:
316
316
  const_vars = deepcopy(const_vars)
317
317
 
318
- for i in range(len(input_vars)):
319
- input_vars[i] = self.convert_vars_to_params(input_vars[i], "input")
320
- for i in range(len(result_vars)):
321
- result_vars[i] = self.convert_vars_to_params(result_vars[i], "result")
322
-
323
- for r in result_vars:
324
- logging.info(f"result var: {r.name}")
325
-
326
- if isinstance(const_vars, dict):
327
- const_vars = list(const_vars.items())
328
-
329
- for i in range(len(const_vars)):
330
- # consts come as tuple pairs
331
- cv_list = list(const_vars[i])
332
- cv_list[0] = self.convert_vars_to_params(cv_list[0], "const")
333
- const_vars[i] = cv_list
334
-
335
318
  if run_cfg is None:
336
319
  if self.run_cfg is None:
337
320
  run_cfg = BenchRunCfg()
@@ -345,6 +328,37 @@ class Bench(BenchPlotServer):
345
328
 
346
329
  self.last_run_cfg = run_cfg
347
330
 
331
+ if isinstance(input_vars, dict):
332
+ input_lists = []
333
+ for k, v in input_vars.items():
334
+ param_var = self.convert_vars_to_params(k, "input", run_cfg)
335
+ if isinstance(v, list):
336
+ assert len(v) > 0
337
+ param_var = param_var.with_sample_values(v)
338
+
339
+ else:
340
+ raise RuntimeError("Unsupported type")
341
+ input_lists.append(param_var)
342
+
343
+ input_vars = input_lists
344
+ else:
345
+ for i in range(len(input_vars)):
346
+ input_vars[i] = self.convert_vars_to_params(input_vars[i], "input", run_cfg)
347
+ for i in range(len(result_vars)):
348
+ result_vars[i] = self.convert_vars_to_params(result_vars[i], "result", run_cfg)
349
+
350
+ for r in result_vars:
351
+ logging.info(f"result var: {r.name}")
352
+
353
+ if isinstance(const_vars, dict):
354
+ const_vars = list(const_vars.items())
355
+
356
+ for i in range(len(const_vars)):
357
+ # consts come as tuple pairs
358
+ cv_list = list(const_vars[i])
359
+ cv_list[0] = self.convert_vars_to_params(cv_list[0], "const", run_cfg)
360
+ const_vars[i] = cv_list
361
+
348
362
  if title is None:
349
363
  if len(input_vars) > 0:
350
364
  title = "Sweeping " + " vs ".join([i.name for i in input_vars])
@@ -472,7 +486,12 @@ class Bench(BenchPlotServer):
472
486
  self.results.append(bench_res)
473
487
  return bench_res
474
488
 
475
- def convert_vars_to_params(self, variable: param.Parameter, var_type: str):
489
+ def convert_vars_to_params(
490
+ self,
491
+ variable: param.Parameter | str | dict | tuple,
492
+ var_type: str,
493
+ run_cfg: Optional[BenchRunCfg],
494
+ ) -> param.Parameter:
476
495
  """check that a variable is a subclass of param
477
496
 
478
497
  Args:
@@ -484,6 +503,14 @@ class Bench(BenchPlotServer):
484
503
  """
485
504
  if isinstance(variable, str):
486
505
  variable = self.worker_class_instance.param.objects(instance=False)[variable]
506
+ if isinstance(variable, dict):
507
+ param_var = self.worker_class_instance.param.objects(instance=False)[variable["name"]]
508
+ if variable["values"] is not None:
509
+ param_var = param_var.with_sample_values(variable["values"])
510
+ if variable["max_level"] is not None:
511
+ if run_cfg is not None:
512
+ param_var = param_var.with_level(run_cfg.level, variable["max_level"])
513
+ variable = param_var
487
514
  if not isinstance(variable, param.Parameter):
488
515
  raise TypeError(
489
516
  f"You need to use {var_type}_vars =[{self.worker_input_cfg}.param.your_variable], instead of {var_type}_vars =[{self.worker_input_cfg}.your_variable]"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: holobench
3
- Version: 1.23.0
3
+ Version: 1.25.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
  Maintainer: austin.gregg-smith
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "holobench"
3
- version = "1.23.0"
3
+ version = "1.25.0"
4
4
 
5
5
  authors = [{ name = "Austin Gregg-Smith", email = "blooop@gmail.com" }]
6
6
  description = "A package for benchmarking the performance of arbitrary functions"
@@ -80,8 +80,11 @@ test = "pytest"
80
80
  coverage = "coverage run -m pytest && coverage xml -o coverage.xml"
81
81
  coverage-report = "coverage report -m"
82
82
  update-lock = "pixi update && git commit -a -m'update pixi.lock'"
83
+ fix = { depends_on = ["update-lock", "format", "ruff-lint"] }
83
84
  push = "git push"
84
85
  update-lock-push = { depends_on = ["update-lock", "push"] }
86
+ fix-commit-push = { depends_on = ["fix", "commit-format", "update-lock-push"] }
87
+
85
88
  ci-no-cover = { depends_on = ["style", "test"] }
86
89
  ci = { depends_on = [
87
90
  "format",
@@ -9,6 +9,8 @@ from bencher.example.example_time_event import run_example_time_event
9
9
  from bencher.example.example_float3D import example_floats3D
10
10
 
11
11
  from bencher.example.example_custom_sweep import example_custom_sweep
12
+ from bencher.example.example_custom_sweep2 import example_custom_sweep2
13
+ from bencher.example.example_levels2 import example_levels2
12
14
  from bencher.example.example_workflow import example_floats2D_workflow, example_floats3D_workflow
13
15
  from bencher.example.example_holosweep import example_holosweep
14
16
  from bencher.example.example_holosweep_tap import example_holosweep_tap
@@ -85,6 +87,12 @@ class TestBenchExamples(unittest.TestCase):
85
87
  def test_example_custom_sweep(self) -> None:
86
88
  self.examples_asserts(example_custom_sweep(self.create_run_cfg()))
87
89
 
90
+ def test_example_custom2(self) -> None:
91
+ self.examples_asserts(example_custom_sweep2(self.create_run_cfg()))
92
+
93
+ def test_example_level2(self) -> None:
94
+ self.examples_asserts(example_levels2(self.create_run_cfg()))
95
+
88
96
  def test_example_floats2D_workflow(self) -> None:
89
97
  self.examples_asserts(example_floats2D_workflow(self.create_run_cfg()))
90
98
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes