-
Notifications
You must be signed in to change notification settings - Fork 8
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
How to reproducibly sample random inputs? #111
Comments
I just realized an easy workaround is to redefine the function we measure to include all the samples vecfoo(v) = foo.(v)
@b [sprand(T, n, n, p) for _ in 1:10] vecfoo |
So basically the following? inputs = [sprand(T, n, n, p) for _ in 1:10]
@b foo.($inputs)
@b bar.($inputs)
|
Yes. To benchmark the sum of the runtimes on a variety of reproducible random imputs you can use that construction. If you want detailed statistics based on the random choices (e.g. a histogram) you can benchmark each input separately: inputs = [sprand(T, n, n, p) for _ in 1:10]
foos = [(@b input foo seconds=.01) for input in inputs]
bars = [(@b input bar seconds=.01) for input in inputs]
ratios = [f.time/b.time for (f,b) in zip(foos, bars)] This could let you, for example, identify specific random inputs that foo is faster on and that bar is faster on. |
Thanks, this has given me plenty of ideas! :) |
I'm trying to benchmark and evaluate two methods on randomly sampled inputs.
However, the structure of the random inputs highly affects the performance of both methods. Is is possible to reproducibly sample the same inputs in two benchmark runs?
An example for such inputs would be random sparse matrices. Since these random matrices can be very ill-conditioned, I would like to evaluate both methods on the exact same sampled matrices.
I could pass a RNG, but that I guess that would sample the same matrix over-and-over again?
The text was updated successfully, but these errors were encountered: