holobench 1.24.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.24.0/holobench.egg-info → holobench-1.25.0}/PKG-INFO +1 -1
  2. {holobench-1.24.0 → holobench-1.25.0}/bencher/__init__.py +1 -1
  3. {holobench-1.24.0 → holobench-1.25.0}/bencher/bencher.py +33 -23
  4. {holobench-1.24.0 → holobench-1.25.0/holobench.egg-info}/PKG-INFO +1 -1
  5. {holobench-1.24.0 → holobench-1.25.0}/pyproject.toml +1 -1
  6. {holobench-1.24.0 → holobench-1.25.0}/test/test_bench_examples.py +4 -0
  7. {holobench-1.24.0 → holobench-1.25.0}/LICENSE +0 -0
  8. {holobench-1.24.0 → holobench-1.25.0}/README.md +0 -0
  9. {holobench-1.24.0 → holobench-1.25.0}/bencher/bench_cfg.py +0 -0
  10. {holobench-1.24.0 → holobench-1.25.0}/bencher/bench_plot_server.py +0 -0
  11. {holobench-1.24.0 → holobench-1.25.0}/bencher/bench_report.py +0 -0
  12. {holobench-1.24.0 → holobench-1.25.0}/bencher/bench_runner.py +0 -0
  13. {holobench-1.24.0 → holobench-1.25.0}/bencher/caching.py +0 -0
  14. {holobench-1.24.0 → holobench-1.25.0}/bencher/class_enum.py +0 -0
  15. {holobench-1.24.0 → holobench-1.25.0}/bencher/job.py +0 -0
  16. {holobench-1.24.0 → holobench-1.25.0}/bencher/optuna_conversions.py +0 -0
  17. {holobench-1.24.0 → holobench-1.25.0}/bencher/utils.py +0 -0
  18. {holobench-1.24.0 → holobench-1.25.0}/bencher/video_writer.py +0 -0
  19. {holobench-1.24.0 → holobench-1.25.0}/bencher/worker_job.py +0 -0
  20. {holobench-1.24.0 → holobench-1.25.0}/holobench.egg-info/SOURCES.txt +0 -0
  21. {holobench-1.24.0 → holobench-1.25.0}/holobench.egg-info/dependency_links.txt +0 -0
  22. {holobench-1.24.0 → holobench-1.25.0}/holobench.egg-info/not-zip-safe +0 -0
  23. {holobench-1.24.0 → holobench-1.25.0}/holobench.egg-info/requires.txt +0 -0
  24. {holobench-1.24.0 → holobench-1.25.0}/holobench.egg-info/top_level.txt +0 -0
  25. {holobench-1.24.0 → holobench-1.25.0}/package.xml +0 -0
  26. {holobench-1.24.0 → holobench-1.25.0}/resource/bencher +0 -0
  27. {holobench-1.24.0 → holobench-1.25.0}/setup.cfg +0 -0
  28. {holobench-1.24.0 → holobench-1.25.0}/setup.py +0 -0
  29. {holobench-1.24.0 → holobench-1.25.0}/test/test_bench_report.py +0 -0
  30. {holobench-1.24.0 → holobench-1.25.0}/test/test_bench_result_base.py +0 -0
  31. {holobench-1.24.0 → holobench-1.25.0}/test/test_bench_runner.py +0 -0
  32. {holobench-1.24.0 → holobench-1.25.0}/test/test_bencher.py +0 -0
  33. {holobench-1.24.0 → holobench-1.25.0}/test/test_cache.py +0 -0
  34. {holobench-1.24.0 → holobench-1.25.0}/test/test_class_enum.py +0 -0
  35. {holobench-1.24.0 → holobench-1.25.0}/test/test_combinations.py +0 -0
  36. {holobench-1.24.0 → holobench-1.25.0}/test/test_composable_container_base.py +0 -0
  37. {holobench-1.24.0 → holobench-1.25.0}/test/test_composable_container_video.py +0 -0
  38. {holobench-1.24.0 → holobench-1.25.0}/test/test_float_formatter.py +0 -0
  39. {holobench-1.24.0 → holobench-1.25.0}/test/test_job.py +0 -0
  40. {holobench-1.24.0 → holobench-1.25.0}/test/test_meta_tests.py +0 -0
  41. {holobench-1.24.0 → holobench-1.25.0}/test/test_parametrized_sweep.py +0 -0
  42. {holobench-1.24.0 → holobench-1.25.0}/test/test_plot_filter.py +0 -0
  43. {holobench-1.24.0 → holobench-1.25.0}/test/test_plot_server.py +0 -0
  44. {holobench-1.24.0 → holobench-1.25.0}/test/test_sample_cache.py +0 -0
  45. {holobench-1.24.0 → holobench-1.25.0}/test/test_sweep_base.py +0 -0
  46. {holobench-1.24.0 → holobench-1.25.0}/test/test_sweep_vars.py +0 -0
  47. {holobench-1.24.0 → holobench-1.25.0}/test/test_utils.py +0 -0
  48. {holobench-1.24.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.24.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,13 +315,27 @@ class Bench(BenchPlotServer):
315
315
  else:
316
316
  const_vars = deepcopy(const_vars)
317
317
 
318
+ if run_cfg is None:
319
+ if self.run_cfg is None:
320
+ run_cfg = BenchRunCfg()
321
+ logging.info("Generate default run cfg")
322
+ else:
323
+ run_cfg = deepcopy(self.run_cfg)
324
+ logging.info("Copy run cfg from bench class")
325
+
326
+ if run_cfg.only_plot:
327
+ run_cfg.use_cache = True
328
+
329
+ self.last_run_cfg = run_cfg
330
+
318
331
  if isinstance(input_vars, dict):
319
332
  input_lists = []
320
333
  for k, v in input_vars.items():
321
- param_var = self.convert_vars_to_params(k, "input")
334
+ param_var = self.convert_vars_to_params(k, "input", run_cfg)
322
335
  if isinstance(v, list):
323
336
  assert len(v) > 0
324
337
  param_var = param_var.with_sample_values(v)
338
+
325
339
  else:
326
340
  raise RuntimeError("Unsupported type")
327
341
  input_lists.append(param_var)
@@ -329,9 +343,9 @@ class Bench(BenchPlotServer):
329
343
  input_vars = input_lists
330
344
  else:
331
345
  for i in range(len(input_vars)):
332
- input_vars[i] = self.convert_vars_to_params(input_vars[i], "input")
346
+ input_vars[i] = self.convert_vars_to_params(input_vars[i], "input", run_cfg)
333
347
  for i in range(len(result_vars)):
334
- result_vars[i] = self.convert_vars_to_params(result_vars[i], "result")
348
+ result_vars[i] = self.convert_vars_to_params(result_vars[i], "result", run_cfg)
335
349
 
336
350
  for r in result_vars:
337
351
  logging.info(f"result var: {r.name}")
@@ -342,22 +356,9 @@ class Bench(BenchPlotServer):
342
356
  for i in range(len(const_vars)):
343
357
  # consts come as tuple pairs
344
358
  cv_list = list(const_vars[i])
345
- cv_list[0] = self.convert_vars_to_params(cv_list[0], "const")
359
+ cv_list[0] = self.convert_vars_to_params(cv_list[0], "const", run_cfg)
346
360
  const_vars[i] = cv_list
347
361
 
348
- if run_cfg is None:
349
- if self.run_cfg is None:
350
- run_cfg = BenchRunCfg()
351
- logging.info("Generate default run cfg")
352
- else:
353
- run_cfg = deepcopy(self.run_cfg)
354
- logging.info("Copy run cfg from bench class")
355
-
356
- if run_cfg.only_plot:
357
- run_cfg.use_cache = True
358
-
359
- self.last_run_cfg = run_cfg
360
-
361
362
  if title is None:
362
363
  if len(input_vars) > 0:
363
364
  title = "Sweeping " + " vs ".join([i.name for i in input_vars])
@@ -485,7 +486,12 @@ class Bench(BenchPlotServer):
485
486
  self.results.append(bench_res)
486
487
  return bench_res
487
488
 
488
- 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:
489
495
  """check that a variable is a subclass of param
490
496
 
491
497
  Args:
@@ -497,10 +503,14 @@ class Bench(BenchPlotServer):
497
503
  """
498
504
  if isinstance(variable, str):
499
505
  variable = self.worker_class_instance.param.objects(instance=False)[variable]
500
- if isinstance(variable, tuple):
501
- variable = self.worker_class_instance.param.objects(instance=False)[
502
- variable[0]
503
- ].with_sample_values(variable[1])
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
504
514
  if not isinstance(variable, param.Parameter):
505
515
  raise TypeError(
506
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.24.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.24.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"
@@ -10,6 +10,7 @@ from bencher.example.example_float3D import example_floats3D
10
10
 
11
11
  from bencher.example.example_custom_sweep import example_custom_sweep
12
12
  from bencher.example.example_custom_sweep2 import example_custom_sweep2
13
+ from bencher.example.example_levels2 import example_levels2
13
14
  from bencher.example.example_workflow import example_floats2D_workflow, example_floats3D_workflow
14
15
  from bencher.example.example_holosweep import example_holosweep
15
16
  from bencher.example.example_holosweep_tap import example_holosweep_tap
@@ -89,6 +90,9 @@ class TestBenchExamples(unittest.TestCase):
89
90
  def test_example_custom2(self) -> None:
90
91
  self.examples_asserts(example_custom_sweep2(self.create_run_cfg()))
91
92
 
93
+ def test_example_level2(self) -> None:
94
+ self.examples_asserts(example_levels2(self.create_run_cfg()))
95
+
92
96
  def test_example_floats2D_workflow(self) -> None:
93
97
  self.examples_asserts(example_floats2D_workflow(self.create_run_cfg()))
94
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