holobench 1.23.0__py3-none-any.whl → 1.25.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/__init__.py CHANGED
@@ -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,
bencher/bencher.py CHANGED
@@ -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,9 +1,9 @@
1
- bencher/__init__.py,sha256=XCrJ5Nbw3k1J6j8qVEf6kH5sMmECIXzII-t9SdB8gEI,1558
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
4
  bencher/bench_report.py,sha256=jh3T_q9KByZDeMPMf0KNJojZukxRzkfaYGeuWQU8MKM,10528
5
5
  bencher/bench_runner.py,sha256=-SzAKd6QbPJ05KaW3vteFIkE-UtlFS55Ob9QeE5eRXw,6202
6
- bencher/bencher.py,sha256=SlSje8ZvWdRnmRs4ZLXGx3bDQRMHkDOgvyBIsLClUTE,33400
6
+ bencher/bencher.py,sha256=45CaQhe9ATh4zdUBwWER_9qQWoc_U6rGeZbPa0bCXEc,34545
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
@@ -11,10 +11,10 @@ bencher/optuna_conversions.py,sha256=an-LfPsQXyyvhIZnG8Wl1RQVYMvJj7WOi3YNqoUnuxQ
11
11
  bencher/utils.py,sha256=9KAThtIG8jNd0nd4Wft8miNM_yHWmZUkIBfJh19pzgI,6480
12
12
  bencher/video_writer.py,sha256=B-V1tALd3oPDytaAsl8I6qUztDQlFbkp9gSYco-ah44,2175
13
13
  bencher/worker_job.py,sha256=FREi0yWQACFmH86R1j-LH72tALEFkKhLDmmoGQY9Jh4,1571
14
- holobench-1.23.0.data/data/share/ament_index/resource_index/packages/bencher,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
- holobench-1.23.0.data/data/share/bencher/package.xml,sha256=HxWM9qIEiLbE60tG0aKsS7q3UaSKDyCMD4-1nYw8vOs,1045
16
- holobench-1.23.0.dist-info/LICENSE,sha256=dSHXTdRY4Y7qGFMv63UksV700iff7iE-p7GGs6Sbnvo,1065
17
- holobench-1.23.0.dist-info/METADATA,sha256=UrC2MLXikRWBDwgLOqPo0OFgM6079n6ciWTnkktDZX4,5691
18
- holobench-1.23.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
19
- holobench-1.23.0.dist-info/top_level.txt,sha256=rkP5-F_W08mOD-25ZPkt0HJsHxedb2EiRcRA7IP6Ceg,8
20
- holobench-1.23.0.dist-info/RECORD,,
14
+ holobench-1.25.0.data/data/share/ament_index/resource_index/packages/bencher,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
+ holobench-1.25.0.data/data/share/bencher/package.xml,sha256=HxWM9qIEiLbE60tG0aKsS7q3UaSKDyCMD4-1nYw8vOs,1045
16
+ holobench-1.25.0.dist-info/LICENSE,sha256=dSHXTdRY4Y7qGFMv63UksV700iff7iE-p7GGs6Sbnvo,1065
17
+ holobench-1.25.0.dist-info/METADATA,sha256=pExSccJNRC6UWisUwAdp5PmWCNVhm1VvkhZ-gShZtw8,5691
18
+ holobench-1.25.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
19
+ holobench-1.25.0.dist-info/top_level.txt,sha256=rkP5-F_W08mOD-25ZPkt0HJsHxedb2EiRcRA7IP6Ceg,8
20
+ holobench-1.25.0.dist-info/RECORD,,