-
-
Notifications
You must be signed in to change notification settings - Fork 356
Expose chunk-level HDF5 APIs (H5Dchunk_iter, direct chunk I/O) to Java (JNI + FFM) #6547
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
Open
mkitti
wants to merge
18
commits into
HDFGroup:develop
Choose a base branch
from
mkitti:h5dchunk_java
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
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
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
b340f0b
Expose H5Dchunk_iter, H5Dget_num_chunks, H5Dget_chunk_info in JNI Jav…
mkitti 87fde45
Expose H5Dchunk_iter, H5Dget_num_chunks, H5Dget_chunk_info in FFM Jav…
mkitti 4062dd5
Expose direct chunk I/O and inspection functions in JNI Java bindings
mkitti ed41afa
Expose direct chunk I/O and inspection functions in FFM Java bindings
mkitti 08e1300
Cut per-chunk callback overhead in JNI H5Dchunk_iter, add benchmark w…
mkitti d428354
Add benchmark warm-up and shared-arena diagnostic to FFM chunk perf test
mkitti 24e9353
Add H5Dchunk_iter_all bulk chunk enumeration to JNI Java bindings
mkitti 96d25ed
Add H5Dchunk_iter_all bulk chunk enumeration to FFM Java bindings
mkitti bd18245
Apply clang-format to JNI chunk-function changes
mkitti 991e37c
Apply clang-format to FFM chunk-function changes
mkitti cf9500a
Add missing JUnit-TestH5DChunkIterPerf.txt reference file (JNI)
mkitti 478414c
Add missing JUnit-TestH5DChunkIterPerf.txt reference file (FFM)
mkitti 84d5cc6
Fix stale JUnit-TestH5D.txt reference file (JNI)
mkitti 9f8a8cc
Merge branch 'develop' into h5dchunk_java
mkitti 5ba51ff
Fix stale JUnit-TestH5D.txt reference file (FFM)
mkitti c8609f3
Merge branch 'develop' into h5dchunk_java
mkitti 10e5bba
Address Copilot review comments on PR #6547
mkitti 58d84d9
Merge remote-tracking branch 'origin/develop' into h5dchunk_java
mkitti 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
Some comments aren't visible on the classic Files Changed page.
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,50 @@ | ||
| /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | ||
| * Copyright by The HDF Group. * | ||
| * All rights reserved. * | ||
| * * | ||
| * This file is part of HDF5. The full HDF5 copyright notice, including * | ||
| * terms governing use, modification, and redistribution, is contained in * | ||
| * the LICENSE file, which can be found at the root of the source code * | ||
| * distribution tree, or in https://www.hdfgroup.org/licenses. * | ||
| * If you do not have access to either file, you may request a copy from * | ||
| * help@hdfgroup.org. * | ||
| * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | ||
|
|
||
| package hdf.hdf5lib.callbacks; | ||
|
|
||
| import static org.hdfgroup.javahdf5.hdf5_h.*; | ||
|
|
||
| import java.lang.foreign.MemorySegment; | ||
|
|
||
| import org.hdfgroup.javahdf5.*; | ||
|
|
||
| /** | ||
| * Information class for the chunk iterator callback for H5Dchunk_iter. | ||
| * | ||
| */ | ||
| public interface H5D_chunk_iter_cb extends org.hdfgroup.javahdf5.H5D_chunk_iter_op_t.Function { | ||
| /** | ||
| * @ingroup JCALLBK | ||
| * | ||
| * application callback for each chunk of a chunked dataset | ||
| * | ||
| * @param offset the logical position of the chunk's first element in units of dataset | ||
| * elements, as a view over native memory owned by the underlying H5Dchunk_iter | ||
| * call. It is only valid for the duration of this callback invocation -- read | ||
| * the values out (e.g. via offset.toArray(ValueLayout.JAVA_LONG)) if they need | ||
| * to be retained after the callback returns. | ||
| * @param filter_mask bitmask indicating the filters used when the chunk was written | ||
| * @param addr the chunk address in the file, taking the user block (if any) into account | ||
| * @param size the chunk size in bytes, 0 if the chunk does not exist | ||
| * @param op_data the operator data passed in to H5Dchunk_iter | ||
| * | ||
| * @return operation status | ||
| * A. Zero causes the iterator to continue, returning zero when all | ||
| * chunks have been processed. | ||
| * B. Positive causes the iterator to immediately return that positive | ||
| * value, indicating short-circuit success. | ||
| * C. Negative causes the iterator to immediately return that value, | ||
| * indicating failure. | ||
| */ | ||
| int apply(MemorySegment offset, int filter_mask, long addr, long size, MemorySegment op_data); | ||
| } |
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,24 @@ | ||
| /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | ||
| * Copyright by The HDF Group. * | ||
| * All rights reserved. * | ||
| * * | ||
| * This file is part of HDF5. The full HDF5 copyright notice, including * | ||
| * terms governing use, modification, and redistribution, is contained in * | ||
| * the LICENSE file, which can be found at the root of the source code * | ||
| * distribution tree, or in https://www.hdfgroup.org/licenses. * | ||
| * If you do not have access to either file, you may request a copy from * | ||
| * help@hdfgroup.org. * | ||
| * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | ||
|
|
||
| package hdf.hdf5lib.callbacks; | ||
|
|
||
| /** | ||
| * Data class for chunk iterator callback for H5Dchunk_iter. | ||
| * | ||
| */ | ||
| public interface H5D_chunk_iter_t { | ||
| /** | ||
| * public ArrayList iterdata = new ArrayList(); | ||
| * Any derived interfaces must define the single public variable as above. | ||
| */ | ||
| } |
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,61 @@ | ||
| /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | ||
| * Copyright by The HDF Group. * | ||
| * All rights reserved. * | ||
| * * | ||
| * This file is part of HDF5. The full HDF5 copyright notice, including * | ||
| * terms governing use, modification, and redistribution, is contained in * | ||
| * the LICENSE file, which can be found at the root of the source code * | ||
| * distribution tree, or in https://www.hdfgroup.org/licenses. * | ||
| * If you do not have access to either file, you may request a copy from * | ||
| * help@hdfgroup.org. * | ||
| * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | ||
|
|
||
| package hdf.hdf5lib.structs; | ||
|
|
||
| import java.io.Serializable; | ||
|
|
||
| /** | ||
| * Bulk result of H5Dchunk_iter_all(), holding information about every chunk of a chunked dataset. | ||
| * | ||
| * To avoid one Java object allocation per chunk, the per-chunk fields are stored as parallel | ||
| * primitive arrays rather than an array of per-chunk objects; use {@link #getOffset(int, int)} to | ||
| * read a single chunk's offset coordinate. | ||
| * | ||
| */ | ||
| public class H5D_chunk_info_t implements Serializable { | ||
| private static final long serialVersionUID = -8091628506238589401L; | ||
|
|
||
| /** Number of dimensions (rank) of the dataset; used to interpret offset. */ | ||
| public final int rank; | ||
| /** Flattened chunk offsets: chunk i's coordinate in dimension d is offset[i * rank + d]. */ | ||
| public final long[] offset; | ||
| /** Bitmask indicating the filters used when each chunk was written; filterMask[i] for chunk i. */ | ||
| public final int[] filterMask; | ||
| /** Chunk address in the file for each chunk; addr[i] for chunk i. */ | ||
| public final long[] addr; | ||
| /** Chunk size in bytes for each chunk, 0 if the chunk does not exist; size[i] for chunk i. */ | ||
| public final long[] size; | ||
|
|
||
| public H5D_chunk_info_t(int rank, long[] offset, int[] filterMask, long[] addr, long[] size) | ||
| { | ||
| this.rank = rank; | ||
| this.offset = offset; | ||
| this.filterMask = filterMask; | ||
| this.addr = addr; | ||
| this.size = size; | ||
| } | ||
|
|
||
| /** | ||
| * @return the number of chunks described by this object. | ||
| */ | ||
| public int getNumChunks() { return filterMask.length; } | ||
|
|
||
| /** | ||
| * @param chunkIndex | ||
| * index of the chunk, between 0 and getNumChunks() - 1. | ||
| * @param dim | ||
| * dimension, between 0 and rank - 1. | ||
| * @return the logical position of the given chunk's first element in dimension dim. | ||
| */ | ||
| public long getOffset(int chunkIndex, int dim) { return offset[chunkIndex * rank + dim]; } | ||
| } |
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.
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.
I would consider dropping these unless they're necessary. They're really only useful for the
H5Dget_chunk_index_type()function and that is meant to be an internal API (if one can even call an API internal). It's not really a function meant to be called or used for anything.