-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
BENCH: Add a benchmark comparing block to copy in the 3D case #11965
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
Conversation
There are already benchmarks for block in another file - can extend those instead of making a new suite? |
Sorry, I'm really bad at navigating this codebase. Thanks!. |
I'd recommend that before adding a new benchmark / test, you search the existing benchmarks / tests folders for places that already call the function you want to profile/test. |
I had found the ones for masked arrays, but not the ones for dense arrays. :/ |
fe9c3d4
to
412d4fb
Compare
if mode == 'block': | ||
np.block(self.block) | ||
else: | ||
np.concatenate(self.arr_list) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the goal here of testing concatenate within an np.block
test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And why use a mode
parameter rather than a separate benchmark function? Does this give a more useful asv result if the asv name is the same?
Some comments answering those questions in the code might be a good thing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is mostly so that we can directly compare the performance of block
and concatenate
on the same graph. I forget where, but you can see some graphs. Therefore, when creating the new algorithm, we should be able to stop optimizing once we are close to the performance of concatenate
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would look something like this
http://pandas.pydata.org/speed/dask/#array.TestSubs.time_subs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like a good reason to me
# allows us to directly compare the benchmark of block | ||
# to that of `concatenate` with the ASV framework. | ||
# block and concatenate will be plotted on the same graph | ||
# as opposed to being displayed as seperate benchmarks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: separate
567e774
to
68a0972
Compare
Thanks for having me extend this benchmark @eric-wieser I think we can essentially use this benchmark's algorithm with a reshape to get block done in 1 shot. |
I find it very unlikely that that would work. You're right that we could do it in one allocation, but it will require some careful juggling of slices. |
@pv: Is there any easy way to make this continue the existing benchmark graphs, rather than resulting in a benchmark with a new name? |
I don't think there is. |
Apparently there is a way to build history for a nee benchmark. But I’m not too sure how |
@eric-wieser I would almost like to change this from calling concatenate to calling The goal is to show that blocking is a memory bandwidth limited algorithm. Anyway, PR #11971 gets pretty close to the
|
Is this ready to be merged? |
a23a5f4
to
c2086e7
Compare
@mattip: My worry here is that we break contiguity in our benchmark history by doing this - something we deliberately considered when we introduced the |
@eric-wieser why is there going to be a new name for the benchmark? Do additional parameters trigger a new name? |
@hmaarrfk: Yes, I believe they do |
:( |
An easy workaround would be to just expose the test twice, once under the old name and once under the new name. Failing that, we might want to look into patching asv to allow a |
What happens when we add a new benchmark? Is history created automatically or will it start from "this new commit" |
@eric-wieser, If we don't want to create a new benchmark, we would need to run the command:
to rebuild the history for all the commits that currently have benchmarks. I'm not sure if that is a possiility. |
c2086e7
to
f37b0c6
Compare
rebased off master |
As discussed at the Oct 17 weekly status meeting, the general opinion was that breaking continuity is not a PR blocker. It is relatively easy to rerun newer benchmarks on older code to determine a baseline and compare across the gap, especially since this PR only touches the benchmark itself. |
Thanks @hmaarrfk |
Enhances the existing block3D benchmark to show the performance difference between block and direct memory of each individual blocks.
The way the test is written, a secondary plot on the same graph showing block should show
copy
allowing us to easily compare the two.This should help motivate the design for an improved blocking algorithm for case where users are blocking 3D cubes.