Skip to content

Commit

Permalink
call kernels with *args, not args
Browse files Browse the repository at this point in the history
  • Loading branch information
nschloe committed Jan 25, 2022
1 parent e1f50da commit 46084a0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
version := `python3 -c "from src.perfplot.__about__ import __version__; print(__version__)"`

default:
@echo "\"just publish\"?"

publish:
@if [ "$(git rev-parse --abbrev-ref HEAD)" != "main" ]; then exit 1; fi
gh release create
gh release create "v{{version}}"
flit publish

clean:
Expand Down
1 change: 1 addition & 0 deletions src/perfplot/__about__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.9.15"
3 changes: 1 addition & 2 deletions src/perfplot/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from .__about__ import __version__
from ._main import bench, live, plot, save, show

__version__ = "0.9.15"

__all__ = ["bench", "plot", "show", "save", "live", "__version__"]
6 changes: 4 additions & 2 deletions src/perfplot/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ def __next__(self):
data = None
if callable(self.setup):
data = self.setup(n)
if not isinstance(data, tuple):
data = (data,)

reference = None
timings = []
Expand All @@ -239,7 +241,7 @@ def __next__(self):
# up first. The actual times are only reached after a few hundred
# nanoseconds of computation. Most of the time it's okay though.
t0_ns = time.perf_counter_ns()
val = kernel(data)
val = kernel(*data)
t1_ns = time.perf_counter_ns()
t_ns = t1_ns - t0_ns

Expand Down Expand Up @@ -298,7 +300,7 @@ def _b(data, kernel: Callable, repeat: int):
while min_timing_ns <= required_timing_ns:
tm = np.array(
timeit.repeat(
stmt=lambda: kernel(data),
stmt=lambda: kernel(*data),
repeat=repeat,
number=number,
timer=time.perf_counter_ns,
Expand Down

0 comments on commit 46084a0

Please sign in to comment.