Skip to content

Use the Zarr's new getitems() API - #131

Merged
rapids-bot[bot] merged 23 commits into
rapidsai:branch-23.08from
madsbk:zarr_getitems
Jun 21, 2023
Merged

rapids-bot[bot] merged 23 commits into
rapidsai:branch-23.08from
madsbk:zarr_getitems

Conversation

@madsbk

@madsbk madsbk commented Sep 13, 2022 •

Copy link
Copy Markdown
Member

By using the new API in zarr-developers/zarr-python#1131, we do not have to guess whether to read into host or device memory. That is, no more filtering of specify keys like:

 if os.path.basename(fn) in [ 
     zarr.storage.array_meta_key, 
     zarr.storage.group_meta_key, 
     zarr.storage.attrs_key, 
 ]: 

Notice, this PR is on hold until Zarr v2.15 is released

Closes #119

UPDATE: Zarr v2.15 has been released

@madsbk madsbk added improvement Improves an existing functionality non-breaking Introduces a non-breaking change labels Sep 13, 2022
@madsbk
madsbk changed the base branch from branch-22.10 to branch-22.12 October 12, 2022 11:36
@jakirkham
jakirkham deleted the branch rapidsai:branch-23.08 January 4, 2023 21:49
@jakirkham jakirkham closed this Jan 4, 2023
@jakirkham jakirkham reopened this Jan 4, 2023
@jakirkham
jakirkham changed the base branch from branch-22.12 to branch-23.02 January 4, 2023 21:51
@madsbk
madsbk changed the base branch from branch-23.02 to branch-23.04 February 2, 2023 13:48
@madsbk
madsbk changed the base branch from branch-23.04 to branch-23.06 April 17, 2023 06:55
@madsbk madsbk mentioned this pull request Apr 18, 2023
@madsbk
madsbk force-pushed the zarr_getitems branch 2 times, most recently from aca8ed9 to dd82a5e Compare April 20, 2023 12:44
@madsbk madsbk closed this Apr 26, 2023
@madsbk
madsbk deleted the zarr_getitems branch April 26, 2023 11:01
@madsbk
madsbk restored the zarr_getitems branch April 26, 2023 11:03
@madsbk madsbk reopened this Apr 26, 2023
@madsbk madsbk mentioned this pull request Apr 28, 2023
@madsbk
madsbk marked this pull request as ready for review June 19, 2023 12:55
@madsbk
madsbk requested review from jakirkham and wence- June 19, 2023 12:55

@wence- wence- left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @madsbk, I think we can do a little bit of cleanup, to avoid repeating ourselves with the minimum supported version.

Comment thread python/benchmarks/single-node-io.py Resolved
Comment thread python/kvikio/zarr.py Resolved
Comment thread python/kvikio/zarr.py Resolved
Comment thread python/kvikio/zarr.py Resolved
Comment thread python/kvikio/zarr.py Resolved
Comment thread python/tests/test_zarr.py Resolved
Comment thread python/tests/test_zarr.py Resolved
Comment thread python/tests/test_zarr.py Resolved
Comment thread python/tests/test_zarr.py Resolved
Comment thread python/kvikio/zarr.py Outdated
Comment on lines +96 to +98
finally:
for f in files:
f.close()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idiomatic way to do this is...

import contextlib

...
with contextlib.ExitStack() as stack:
    for key in keys:
        f = stack.enter_context(kvikio.CuFile(filepath, "r"))
        ret[key] = ..
        io_results.append((f.pread(ret[key]), nbytes)
   for fut, nbytes in io_results:
        nbytes_read = fut.get()
        ...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll note that both the new code (and my proposed approach) leave dangling futures if the block produces an exception anywhere. I guess that is fine because that propagates and the program is hosed at that point anyway?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that is ok

@madsbk
madsbk requested a review from a team as a code owner June 20, 2023 12:29
@madsbk
madsbk requested a review from a team June 20, 2023 12:29
@madsbk
madsbk requested a review from a team as a code owner June 20, 2023 12:29
@madsbk
madsbk requested a review from wence- June 20, 2023 14:34
@madsbk

madsbk commented Jun 20, 2023

Copy link
Copy Markdown
Member Author

Thanks @wence-, I think I have addressed all of your issues.

@wence- wence- left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Mads.

@madsbk

madsbk commented Jun 21, 2023

Copy link
Copy Markdown
Member Author

/merge

@wence-

wence- commented Jun 21, 2023

Copy link
Copy Markdown
Contributor

I think we need to wait for the other codeowners to approve too.

@rapids-bot
rapids-bot Bot merged commit 56d48ef into rapidsai:branch-23.08 Jun 21, 2023
@jakirkham

Copy link
Copy Markdown
Member

Thanks all! 🙏

Great work 🥳

@madsbk
madsbk deleted the zarr_getitems branch June 23, 2023 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improves an existing functionality non-breaking Introduces a non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filter out Zarr's consolidated metadata (.zmetadata)

4 participants