-
Notifications
You must be signed in to change notification settings - Fork 521
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
Subfiling #2227
Open
nadvornikjiri
wants to merge
10
commits into
h5py:master
Choose a base branch
from
nadvornikjiri:subfiling
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Subfiling #2227
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0447a96
Initial version of the subfiling low-level API support in HDF5 1.14
nadvornikjiri e975260
Changed back the header to hdf5.h extern
nadvornikjiri 03a0978
Added MPI markers
nadvornikjiri ac8897e
Update h5py/h5fd.pyx
nadvornikjiri 96beb8b
Update h5py/h5p.pyx
nadvornikjiri f186e2d
Build is now working with 1.14 and subfiling VFD enabled
nadvornikjiri 0227294
Subfiling VFD properties are now accepted by the File high level api,…
nadvornikjiri c3e4310
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] e4bb3a4
Fixed long vs int for stripe size
nadvornikjiri 5789c12
Merge branch 'subfiling' of github.com:nadvornikjiri/h5py into subfiling
nadvornikjiri File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,6 +115,7 @@ def registered_drivers(): | |
def make_fapl(driver, libver, rdcc_nslots, rdcc_nbytes, rdcc_w0, locking, | ||
page_buf_size, min_meta_keep, min_raw_keep, | ||
alignment_threshold, alignment_interval, meta_block_size, | ||
ioc_selection, stripe_size, stripe_count, ioc_thread_pool_size, | ||
**kwds): | ||
""" Set up a file access property list """ | ||
plist = h5p.create(h5p.FILE_ACCESS) | ||
|
@@ -176,9 +177,36 @@ def make_fapl(driver, libver, rdcc_nslots, rdcc_nbytes, rdcc_w0, locking, | |
else: | ||
set_fapl(plist, **kwds) | ||
|
||
# Subfiling parameter setting must be done after calling H5Pset_mpi_params or H5P_set_fapl_mpio | ||
if ioc_selection or stripe_size or stripe_count or ioc_thread_pool_size: | ||
make_subfiling_fapl(plist, ioc_thread_pool_size, ioc_selection, stripe_count, stripe_size) | ||
|
||
return plist | ||
|
||
|
||
def make_subfiling_fapl(plist, ioc_thread_pool_size, ioc_selection, stripe_count, stripe_size): | ||
ioc_config = plist.get_fapl_ioc() | ||
subf_config = plist.get_fapl_subfiling() | ||
if ioc_thread_pool_size: | ||
ioc_config.thread_pool_size = ioc_thread_pool_size | ||
if stripe_size: | ||
subf_config.stripe_size = stripe_size * 1024 * 1024 | ||
if stripe_count: | ||
subf_config.stripe_count = stripe_count | ||
if ioc_selection: | ||
if ioc_selection == "one_per_node": | ||
ioc_selection_enum = h5fd.IOC_ONE_PER_NODE | ||
elif ioc_selection == "every_nth_rank": | ||
ioc_selection_enum = h5fd.IOC_EVERY_NTH_RANK | ||
elif ioc_selection == "total": | ||
ioc_selection_enum = h5fd.IOC_TOTAL | ||
else: | ||
raise NotImplementedError("Unsupported IO concentrator allocation mode.") | ||
subf_config.ioc_selection = ioc_selection_enum | ||
plist.set_fapl_ioc(subf_config.ioc_fapl_id, ioc_config) | ||
plist.set_fapl_subfiling(subf_config) | ||
|
||
|
||
def make_fcpl(track_order=False, fs_strategy=None, fs_persist=False, | ||
fs_threshold=1, fs_page_size=None): | ||
""" Set up a file creation property list """ | ||
|
@@ -376,7 +404,8 @@ def __init__(self, name, mode='r', driver=None, libver=None, userblock_size=None | |
rdcc_nslots=None, rdcc_nbytes=None, rdcc_w0=None, track_order=None, | ||
fs_strategy=None, fs_persist=False, fs_threshold=1, fs_page_size=None, | ||
page_buf_size=None, min_meta_keep=0, min_raw_keep=0, locking=None, | ||
alignment_threshold=1, alignment_interval=1, meta_block_size=None, **kwds): | ||
alignment_threshold=1, alignment_interval=1, meta_block_size=None, | ||
ioc_selection=None, stripe_size=None, stripe_count=None, ioc_thread_pool_size=None, **kwds): | ||
Comment on lines
+407
to
+408
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. Generally the driver-specific options go into |
||
"""Create a new file object. | ||
|
||
See the h5py user guide for a detailed explanation of the options. | ||
|
@@ -493,6 +522,22 @@ def __init__(self, name, mode='r', driver=None, libver=None, userblock_size=None | |
Set the current minimum size, in bytes, of new metadata block allocations. | ||
See https://portal.hdfgroup.org/display/HDF5/H5P_SET_META_BLOCK_SIZE | ||
|
||
ioc_selection | ||
Set IO concentrator method for different allocations of MPI ranks as I/O concentrators. Can be set | ||
to h5py.h5fd.IOC_<method> constants (e.g. IOC_ONE_PER_NODE) | ||
See https://docs.hdfgroup.org/hdf5/develop/_h5_f_dsubfiling_8h.html#a2bcf2d531a0668895308692b0c1108d7 | ||
|
||
stripe_count | ||
Set the parameter for Subfiling stripe count. | ||
See https://docs.hdfgroup.org/hdf5/develop/struct_h5_f_d__subfiling__params__t.html | ||
|
||
stripe_size | ||
Set the parameter for Subfiling stripe size. | ||
See https://docs.hdfgroup.org/hdf5/develop/struct_h5_f_d__subfiling__params__t.html | ||
|
||
ioc_thread_pool_size | ||
Set the parameter for the IOC. | ||
|
||
Additional keywords | ||
Passed on to the selected file driver. | ||
""" | ||
|
@@ -560,6 +605,8 @@ def __init__(self, name, mode='r', driver=None, libver=None, userblock_size=None | |
alignment_threshold=alignment_threshold, | ||
alignment_interval=alignment_interval, | ||
meta_block_size=meta_block_size, | ||
ioc_selection=ioc_selection, stripe_size=stripe_size, stripe_count=stripe_count, | ||
ioc_thread_pool_size=ioc_thread_pool_size, | ||
**kwds) | ||
fcpl = make_fcpl(track_order=track_order, fs_strategy=fs_strategy, | ||
fs_persist=fs_persist, fs_threshold=fs_threshold, | ||
|
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
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.
Minor thing, but it might be nicer to express this as an (Python stdlib) Enum, rather than switch on strings?
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.
@aragilar Thanks for the style comment, though if you mean the Python Enum, that one is never used within h5py library, so I'd rather go for consistency than cleanliness. Others might suggest better but what I see the most common is something like this?
Anyway I expect that there will be more cleaning up once the code is working :).