-
Notifications
You must be signed in to change notification settings - Fork 26
Parallel access to b-tree and data via cat_ranges and threading #218
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
Merged
Merged
Changes from 21 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
9a99dce
One read for b-tree nodes
9d9afed
First cut at adding some parallelism in pyfive
cca72e5
controlling and logging parallelism
0fe1e80
Making parallelism actually work
e81c4f4
Merge branch 'btreespeed' into parallel
00e2f88
Optimize B-tree node reads and parallelize leaf fetches
17076cc
Merge branch 'main' into pbtree
d3b816f
pyfive
6327aa7
Implementing #issuecomment-4170115848
c8ed94e
Tiny optimisation in b-tree reading
494f481
Make dataset an ABC so other packages can register versions without s…
6b5ba3e
Making parallelism the default, the benefits are too incredible
56f3fb2
testing for parallel
a3cc121
UML for pyfive in this branch
6a4a0ef
revised class diagram
548e130
b-tree parallelism off by default
8b6890d
Merge branch 'main' into pbtree2
c518cb8
Fix ruff problem
4fe2831
run pre-commit
valeriupredoi 530c66a
run pre-commit on two test files
valeriupredoi d698b1d
Replace meaningless assert True with pytest.skip in test_duplicate_at…
Copilot c0a0b57
Modificaitons in response to review
0cbe504
Merge origin/pbtree2 - keep local improvements to btree_parallel para…
d0ab718
Fixing two blank lines at the end, because that seems to be causing p…
4f7878c
pre-commit magic that V made me do
b134783
I'm now confused about which files need to be in the repo and which d…
9c85ad3
Documentation addition and replacement of OrderedDicts with Dicts as …
c56e74c
apparently I am stupid, Dict instead of dict, and no testing. Bad.
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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,186 @@ | ||
| @startuml | ||
| skinparam classAttributeIconSize 0 | ||
| 'skinparam linetype ortho | ||
| 'Use portrait layout | ||
| top to bottom direction | ||
| skinparam ClassBackgroundColor palegoldenrod | ||
| skinparam ClassBorderColor Black | ||
|
|
||
|
|
||
|
|
||
| skinparam stereotypeCBackgroundColor white | ||
|
|
||
|
|
||
|
|
||
| !define BTREE_COLOR white | ||
| !define BTREE_STEREO <<(B,BTREE_COLOR)>> | ||
| !define HEAP_COLOR white | ||
| !define HEAP_STEREO <<(H,HEAP_COLOR)>> | ||
|
|
||
|
|
||
| ' ------------------------------------------------------------------ | ||
| ' Packages | ||
| ' ------------------------------------------------------------------ | ||
|
|
||
| package pyfive { | ||
|
|
||
| package "high_level" { | ||
| class File { | ||
| + filename : str | ||
| + mode : str | ||
| + __init__(filename, mode, metadata_buffer_size) | ||
| + close() | ||
| + __enter__() | ||
| + __exit__() | ||
| + consolidated_metadata : bool | ||
| } | ||
|
|
||
| class Group { | ||
| + name : str | ||
| + attrs : dict | ||
| + __init__(name, dataobjects, parent) | ||
| + __getitem__(name) | ||
| + visit(func) | ||
| + visititems(func, noindex) | ||
| + get_lazy_view(name) | ||
| } | ||
|
|
||
| class Dataset { | ||
| + name : str | ||
| + shape : tuple | ||
| + dtype : dtype | ||
| + size : int | ||
| + chunks : tuple | ||
| + __init__(name, datasetid, parent) | ||
| + __getitem__(args) | ||
| } | ||
| } | ||
|
|
||
| package "h5d" { | ||
| class ChunkRead { | ||
| + set_parallelism(thread_count, cat_range_allowed) | ||
| + _select_chunks(indexer, out, dtype) | ||
| } | ||
|
|
||
| class DatasetID { | ||
| + rank : int | ||
| + shape : tuple | ||
| + dtype : dtype | ||
| + chunks : tuple | ||
| + layout_class : int | ||
| + __init__(dataobjects) | ||
| + get_data(args, fillvalue) | ||
| + get_chunk_info(index) | ||
| + get_num_chunks() | ||
| + _build_index() | ||
| + _make_btree_fetch_fn() | ||
| } | ||
|
|
||
| ChunkRead <|- DatasetID | ||
| } | ||
|
|
||
| package "dataobjects" { | ||
| class DataObjects { | ||
| + offset : int | ||
| + is_group : bool | ||
| + is_dataset : bool | ||
| + get_attributes() | ||
| + get_links() | ||
| } | ||
| } | ||
|
|
||
| package "misc_low_level" { | ||
| class SuperBlock { | ||
| + version : int | ||
| + offset_to_dataobjects : int | ||
| } | ||
|
|
||
| class Heap HEAP_STEREO | ||
| class GlobalHeap HEAP_STEREO | ||
| class FractalHeap HEAP_STEREO | ||
| class SymbolTable | ||
|
|
||
| SymbolTable -[hidden]- Heap | ||
| SymbolTable -[hidden]- GlobalHeap | ||
| SymbolTable -[hidden]- FractalHeap | ||
| } | ||
|
|
||
| package "btree" { | ||
| class AbstractBTree BTREE_STEREO | ||
| class BTreeV1 BTREE_STEREO | ||
| class BTreeV1\nGroups BTREE_STEREO | ||
| class BTreeV1\nRawDataChunks BTREE_STEREO { | ||
| + fh : int | ||
| + offset : int | ||
| + dims : int | ||
| fetch_fn() | ||
| } | ||
| class BTreeV2 BTREE_STEREO | ||
| class BTreeV2\nGroupNames BTREE_STEREO | ||
| class BTreeV2\nGroupOrders BTREE_STEREO | ||
| class BTreeV2\nAttrCreationOrder BTREE_STEREO | ||
| class BTreeV2\nAttrNames BTREE_STEREO | ||
|
|
||
| BTreeV1 --|> AbstractBTree | ||
| BTreeV2 --|> AbstractBTree | ||
| BTreeV1\nGroups --|> BTreeV1 | ||
| BTreeV1\nRawDataChunks --|> BTreeV1 | ||
| BTreeV2\nGroupNames --|> BTreeV2 | ||
| BTreeV2\nGroupOrders --|> BTreeV2 | ||
| BTreeV2\nAttrCreationOrder -|> BTreeV2 | ||
| BTreeV2\nAttrNames --|> BTreeV2 | ||
|
|
||
|
|
||
| } | ||
|
|
||
| package "utilities" { | ||
| class MetadataBufferingWrapper | ||
| } | ||
|
|
||
| ' ------------------------------------------------------------------ | ||
| ' Relationships | ||
| ' ------------------------------------------------------------------ | ||
|
|
||
| ' High-Level Hierarchy | ||
| File --|> Group | ||
| Group o-- Dataset | ||
| Group o-- Group | ||
|
|
||
| ' Composition | ||
| File *-- SuperBlock : parses > | ||
| SuperBlock --> DataObjects : points to (root) | ||
| Group *-- DataObjects : uses > | ||
| Dataset *-- DatasetID : wraps > | ||
| DatasetID --> DataObjects : uses metadata > | ||
|
|
||
| ' Lower Level internal mechanics | ||
| DataObjects ..> Heap : reads names | ||
| DataObjects ..> GlobalHeap : reads strings | ||
| DataObjects ..> FractalHeap : reads messages | ||
| DataObjects ..> SymbolTable : reads entries | ||
|
|
||
| ' B-Tree usage | ||
| DataObjects ..> BTreeV1\nGroups : iterates children | ||
| DataObjects ..> BTreeV2\nGroupNames : iterates children | ||
| DataObjects ..> BTreeV2\nGroupOrders : iterates children | ||
| DataObjects ..> BTreeV2\nAttrCreationOrder : iterates attrs | ||
| DataObjects ..> BTreeV2\nAttrNames : iterates attrs | ||
| DatasetID ..> BTreeV1\nRawDataChunks : finds\ndata\nchunks | ||
| File ..> MetadataBufferingWrapper : wraps remote handles | ||
|
|
||
| note as N1 | ||
| b-tree | ||
| - built by <i>_build_index</i> | ||
| - parallelism passed | ||
| via the <i>fetch_fn</i> to | ||
| <i>BTreeV1RawDataChunks</i> | ||
| end note | ||
|
|
||
| DatasetID .. N1 | ||
| N1 .. BTreeV1\nRawDataChunks | ||
|
|
||
| } | ||
|
|
||
|
|
||
|
|
||
| @enduml |
This file contains hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.