-
-
Notifications
You must be signed in to change notification settings - Fork 290
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
[WIP] Attempt to continue LRU cache for decoded chunks #1214
Closed
Closed
Changes from all commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
d62febb
first attempt at chunk_cache layer
shikharsg f796ea7
ChunkCache test with MockChunkCacheArray
shikharsg 32141a9
np.copy not needed when accessing a subset of a chunk
shikharsg b35139b
fixed 'Mm' dtype error for buffersize function
shikharsg 3c45176
renamed ChunkCache to LRUChunkCache
46dcf94
LRUChunkCache in zarr root namespace
c69c751
LRUChunkCache example
2cb143e
write caching of chunk should be done after encoding
2fb169e
ensure cached chunk has been round tripped through encode-decode if d…
31e4dfb
flake8 fixes
5559c4f
read write cache for 0-d arrays
2a0124a
added tutorial and api docs
6fac2ad
separated store tests from mutable mapping tests in test_storage.py
shikharsg 4e79d0b
fixed pickle, __delitem__ and ordered dict iteration bugs
shikharsg 5fd6fc8
documenting slowdown when using write cache with object arrays
shikharsg 422f9eb
factoring out mapping code from LRUStoreCache and LRUChunkCache
shikharsg 44cea83
consistent variable naming in _chunk_getitem
shikharsg 1b67e90
removed unnecesary code from _set_basic_selection_zd and added encode…
shikharsg 9b0cc29
flake 8 fixes
shikharsg 715f86d
Merge remote-tracking branch 'upstream/master' into chunk_cache
shikharsg 0013f95
fixed coverage
shikharsg b70c348
Merge branch 'chunk_cache' into master
shikharsg c4f2487
Merge pull request #4 from shikharsg/master
shikharsg 245f661
Merge branch 'master' into chunk_cache
shikharsg a2a05fb
Merge branch 'master' into chunk_cache
shikharsg b8b9056
Merge branch 'chunk_cache' into chunk_cache_mapping_refactor
shikharsg 04f0367
Merge pull request #3 from shikharsg/chunk_cache_mapping_refactor
shikharsg f19d43e
bug fix
shikharsg 52a43bf
Merge branch 'master' into chunk_cache
shikharsg 697d46e
python 2 and 3 compatibility
shikharsg 1e727c7
Merge branch 'master' into chunk_cache
shikharsg 377ece7
coverage fix and __init__.py LRUChunkCache import
shikharsg 3473adb
merged chunk_cache with master
shikharsg df84c89
flake8 fix
shikharsg 88fe66d
Merge branch 'master' into chunk_cache
a816014
Implemented https://github.com/zarr-developers/zarr/pull/306/files#r2…
8cc083b
cache tests refactor
23fcdea
fixed minor tests mistak
309cc48
Merge branch 'master' into chunk_cache
635ec87
flake8 fix
a85d156
Merge remote-tracking branch 'upstream/master' into chunk_cache
ef86184
merged with master
875c24f
added chunk cache to Group
dcd4ee7
merge with master
4a1baa9
added chunk_cache to all relevant function
e6540e1
Merge branch 'master' into chunk_cache
9f9d176
merge with master
6571382
fixed failing doctest
8c8a69f
Merge remote-tracking branch 'origin/master' into pr-306
joshmoore e0e5254
fixed setitem caching order
992b48a
Merge branch 'master' into chunk_cache
jakirkham 38ee622
refactor
8b6a699
Merge branch 'master' into chunk_cache
ba5c0ed
Merge 'origin/master' into pr-306
joshmoore 7cdce5f
Remove use of unittest
joshmoore 06c899b
Merge branch 'master' into chunk_cache
joshmoore c9be163
Merge remote-tracking branch 'origin/main' into chunk_cache
croth1 16793f5
code style cleanup
croth1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ def create(shape, chunks=True, dtype=None, compressor='default', | |
fill_value=0, order='C', store=None, synchronizer=None, | ||
overwrite=False, path=None, chunk_store=None, filters=None, | ||
cache_metadata=True, cache_attrs=True, read_only=False, | ||
object_codec=None, dimension_separator=None, write_empty_chunks=True, | ||
object_codec=None, dimension_separator=None, chunk_cache=None, write_empty_chunks=True, | ||
*, zarr_version=None, meta_array=None, **kwargs): | ||
"""Create an array. | ||
|
||
|
@@ -53,6 +53,15 @@ def create(shape, chunks=True, dtype=None, compressor='default', | |
chunk_store : MutableMapping, optional | ||
Separate storage for chunks. If not provided, `store` will be used | ||
for storage of both chunks and metadata. | ||
chunk_cache: MutableMapping, optional | ||
Mapping to store decoded chunks for caching. Can be used in repeated | ||
chunk access scenarios when decoding of data is computationally | ||
expensive. | ||
NOTE: When using the write cache feature with object arrays(i.e. | ||
when dtype of array is 'object' and when writing to the array with | ||
chunk_cache provided) could result in a slight slowdown as some | ||
dtypes, like VLenArray, have to go through the encode-decode phase | ||
before having the correct dtype. | ||
filters : sequence of Codecs, optional | ||
Sequence of filters to use to encode chunk data prior to compression. | ||
cache_metadata : bool, optional | ||
|
@@ -174,7 +183,8 @@ def create(shape, chunks=True, dtype=None, compressor='default', | |
# instantiate array | ||
z = Array(store, path=path, chunk_store=chunk_store, synchronizer=synchronizer, | ||
cache_metadata=cache_metadata, cache_attrs=cache_attrs, read_only=read_only, | ||
write_empty_chunks=write_empty_chunks, meta_array=meta_array) | ||
chunk_cache=chunk_cache, write_empty_chunks=write_empty_chunks, | ||
meta_array=meta_array) | ||
|
||
return z | ||
|
||
|
@@ -411,6 +421,7 @@ def open_array( | |
chunk_store=None, | ||
storage_options=None, | ||
partial_decompress=False, | ||
chunk_cache=None, | ||
write_empty_chunks=True, | ||
*, | ||
zarr_version=None, | ||
|
@@ -478,6 +489,16 @@ def open_array( | |
non-fill-value data are stored, at the expense of overhead associated | ||
with checking the data of each chunk. | ||
|
||
.. versionadded:: 2.7 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. needs to get updated |
||
chunk_cache: MutableMapping, optional | ||
Mapping to store decoded chunks for caching. Can be used in repeated | ||
chunk access scenarios when decoding of data is computationally | ||
expensive. | ||
NOTE: When using the write cache feature with object arrays(i.e. | ||
when dtype of array is 'object' and when writing to the array with | ||
chunk_cache provided) could result in a slight slowdown as some | ||
dtypes, like VLenArray, have to go through the encode-decode phase | ||
before having the correct dtype. | ||
.. versionadded:: 2.11 | ||
|
||
zarr_version : {None, 2, 3}, optional | ||
|
@@ -598,7 +619,8 @@ def open_array( | |
# instantiate array | ||
z = Array(store, read_only=read_only, synchronizer=synchronizer, | ||
cache_metadata=cache_metadata, cache_attrs=cache_attrs, path=path, | ||
chunk_store=chunk_store, write_empty_chunks=write_empty_chunks) | ||
chunk_store=chunk_store, chunk_cache=chunk_cache, | ||
write_empty_chunks=write_empty_chunks) | ||
|
||
return z | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 will need to get updated.