-
Notifications
You must be signed in to change notification settings - Fork 12
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
Improve speed and RAM consumption of buffered slice writer #937
Conversation
Did you mix up old <> new? |
Oops, yes, I did. Corrected it now. |
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.
Looks good. I think the next iteration could include to read the input images in a chunked manner instead of having to read entire images at once.
assert np.all(data == written_data) | ||
|
||
|
||
def test_buffered_slice_writer_should_warn_about_unaligned_usage( |
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.
So, in test_buffered_slice_writer_along_different_axis
you aligned the offset and here are testing that unaligned screams?
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.
Yes, exactly.
I'm not sure if I understand correctly. The BufferedSliceWriter isn't responsible for reading images. Do you mean its interface should support sending chunks to it so that users of the Writer can read images in chunks? |
I know this isn't the responsibility of the BufferedSliceWriter. But when looking holistically at |
…o improve-buffered-slice-writer
Ah ok, sorry for the misunderstanding. Sounds good 👍 |
Description:
np.pad
is not necessary anymore, because a sufficiently sized buffer is created first into which the sections are written.BufferedSliceWriter
As a performance benchmark I created a WKW dataset with chunk_shape=(32, 32, 32) and chunks_per_shard=(32, 32, 32). Then, I wrote random data with shape (4096, 4096, 32) to it (multiple times).
So, the new approach only uses ~70% of the RAM for this benchmark. It should be close to 50%, but I measured the RAM with
time
which also measures the overall ram consumption of the entire python script and pytest environment in which I executed the benchmark.Issues:
Todos:
Make sure to delete unnecessary points or to check all before merging: