Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remember keyword parameters for tune! #337

Closed
wouterwln opened this issue Oct 11, 2023 · 3 comments
Closed

Remember keyword parameters for tune! #337

wouterwln opened this issue Oct 11, 2023 · 3 comments

Comments

@wouterwln
Copy link

When defining a benchmark suite, it might occur that, for in-place operations, we want to limit the amount of evals to 1. However, for other benchmarks in the same suite, we might want to tune these benchmarks, so it makes sense to call tune! on the entire suite. However, this tries to overwrite evals in the benchmarks for which we have defined it by hand. A MWE would be:

using BenchmarkTools

mutable struct foo
    data
end


function bar!(foo)
    foo.data .= 1
    foo.data = map(x -> (), foo.data)
end

suite = BenchmarkGroup()
suite["bar!"] = @benchmarkable bar!(f) setup=(f=foo(ones(10))) evals=1
tune!(suite)

If we call bar! on the same foo instance twice, this will throw an error because we convert the elements of foo.data to tuples, which we cannot set to 1 again. tune! tries to apply the bar! function twice to the same instance of foo, even though evals=1 is explicitly passed to the @benchmarkable. Hence, this suite can never be tune!d, which is kind of a shame. Is there a workaround around this?

@gdalle
Copy link
Collaborator

gdalle commented Oct 11, 2023

I think this is fixed by #318, can you check if the problem still occurs on master?

@wouterwln
Copy link
Author

You're right, and I now also see the duplicate issues ;). It's fixed on master. Thanks!

@gdalle
Copy link
Collaborator

gdalle commented Oct 11, 2023

I hope I can tag a release in the coming weeks but I'm a little short on bandwidth

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants