Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions c++/src/H5FaccProp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ FileAccPropList::getFamilyOffset() const
// Function: FileAccPropList::setCore
///\brief Modifies this file access property list to use the \c H5FD_CORE
/// driver.
///\param initial_size - IN: Specifies the initial size of the backing
/// memory buffer, in bytes
///\param increment - IN: Specifies how much memory to increase each
/// time more memory is needed, in bytes
///\param backing_store - IN: Indicating whether to write the file
Expand All @@ -207,9 +209,9 @@ FileAccPropList::getFamilyOffset() const
/// refer to the H5Pset_fapl_core API in the HDF5 C Reference Manual.
//--------------------------------------------------------------------------
void
FileAccPropList::setCore(size_t increment, bool backing_store) const
FileAccPropList::setCore(size_t initial_size, size_t increment, bool backing_store) const
{
herr_t ret_value = H5Pset_fapl_core(id, increment, backing_store);
herr_t ret_value = H5Pset_fapl_core(id, initial_size, increment, backing_store);
if (ret_value < 0) {
throw PropListIException("FileAccPropList::setCore", "H5Pset_fapl_core failed");
}
Expand All @@ -218,15 +220,16 @@ FileAccPropList::setCore(size_t increment, bool backing_store) const
//--------------------------------------------------------------------------
// Function: FileAccPropList::getCore
///\brief Queries core file driver properties.
///\param initial_size - OUT: Initial size of the backing memory buffer, in bytes
///\param increment - OUT: Size of memory increment, in bytes
///\param backing_store - OUT: Indicating whether to write the file
/// contents to disk when the file is closed
///\exception H5::PropListIException
//--------------------------------------------------------------------------
void
FileAccPropList::getCore(size_t &increment, bool &backing_store) const
FileAccPropList::getCore(size_t &initial_size, size_t &increment, bool &backing_store) const
{
herr_t ret_value = H5Pget_fapl_core(id, &increment, &backing_store);
herr_t ret_value = H5Pget_fapl_core(id, &initial_size, &increment, &backing_store);
if (ret_value < 0) {
throw PropListIException("FileAccPropList::getCore", "H5Pget_fapl_core failed");
}
Expand Down
4 changes: 2 additions & 2 deletions c++/src/H5FaccProp.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ class H5CPP_DLL FileAccPropList : public PropList {

// Modifies this file access property list to use the H5FD_CORE
// driver.
void setCore(size_t increment, bool backing_store) const;
void setCore(size_t initial_size, size_t increment, bool backing_store) const;

// Queries H5FD_CORE driver properties.
void getCore(size_t &increment, bool &backing_store) const;
void getCore(size_t &initial_size, size_t &increment, bool &backing_store) const;

// Sets this file access properties list to the family driver.
void setFamily(hsize_t memb_size, const FileAccPropList &memb_plist) const;
Expand Down
2 changes: 2 additions & 0 deletions docs/doxygen/H5version_doxygen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ list (APPEND _doxygen_predefined_entries
"H5Ovisit=H5Ovisit3"
"H5Ovisit_by_name=H5Ovisit_by_name3"
"H5Pencode=H5Pencode2"
"H5Pget_fapl_core=H5Pget_fapl_core2"
"H5Pget_filter=H5Pget_filter2"
"H5Pget_filter_by_id=H5Pget_filter_by_id2"
"H5Pinsert=H5Pinsert2"
"H5Pregister=H5Pregister2"
"H5Pset_fapl_core=H5Pset_fapl_core2"
"H5Rdereference=H5Rdereference2"
"H5Rget_obj_type=H5Rget_obj_type2"
"H5Sencode=H5Sencode2"
Expand Down
2 changes: 1 addition & 1 deletion docs/doxygen/dox/ModifiedRegionWrites.dox
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

* The Core VFD is configured via the following API call:
* \code
* herr_t H5Pset_fapl_core(hid_t fapl_id, size_t increment, bool backing_store)
* herr_t H5Pset_fapl_core(hid_t fapl_id, size_t initial_size, size_t increment, bool backing_store)
* \endcode
*
* The backing_store parameter sets whether or not changes are propagated to physical storage on
Expand Down
20 changes: 13 additions & 7 deletions fortran/src/H5Pf.c
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,7 @@ h5pget_alignment_c(hid_t_f *prp_id, hsize_t_f *threshold, hsize_t_f *alignment)
* to use malloc() and free()
* INPUTS
* prp_id - property list identifier
* initial_size - Initial size of the backing memory buffer in bytes
* increment - File block size in bytes
* flag - Boolean flag indicating whether to write the
* file contents to disk when the file is closed.
Expand All @@ -867,22 +868,24 @@ h5pget_alignment_c(hid_t_f *prp_id, hsize_t_f *threshold, hsize_t_f *alignment)
* SOURCE
*/
int_f
h5pset_fapl_core_c(hid_t_f *prp_id, size_t_f *increment, int_f *flag)
h5pset_fapl_core_c(hid_t_f *prp_id, size_t_f *initial_size, size_t_f *increment, int_f *flag)
/******/
{
int ret_value = -1;
hid_t c_prp_id;
herr_t ret = -1;
size_t c_initial_size;
size_t c_increment;
bool c_backing_store;
c_initial_size = (size_t)*initial_size;
c_increment = (size_t)*increment;
c_backing_store = (bool)*flag;

/*
* Call H5Pset_fapl_core function.
*/
c_prp_id = (hid_t)*prp_id;
ret = H5Pset_fapl_core(c_prp_id, c_increment, c_backing_store);
ret = H5Pset_fapl_core(c_prp_id, c_initial_size, c_increment, c_backing_store);
if (ret < 0)
return ret_value;
ret_value = 0;
Expand All @@ -897,29 +900,32 @@ h5pset_fapl_core_c(hid_t_f *prp_id, size_t_f *increment, int_f *flag)
* property list is set to the core drive
* INPUTS
* prp_id - property list identifier
* Outputs initial_size - Initial size of the backing memory buffer in bytes
* Outputs increment - File block size in bytes
* RETURNS
* 0 on success, -1 on failure
* SOURCE
*/
int_f
h5pget_fapl_core_c(hid_t_f *prp_id, size_t_f *increment, int_f *flag)
h5pget_fapl_core_c(hid_t_f *prp_id, size_t_f *initial_size, size_t_f *increment, int_f *flag)
/******/
{
int ret_value = -1;
hid_t c_prp_id;
herr_t ret = -1;
size_t c_increment = 0;
herr_t ret = -1;
size_t c_initial_size = 0;
size_t c_increment = 0;
bool c_backing_store;
*flag = 0;
/*
* Call H5Pset_fapl_core function.
*/
c_prp_id = (hid_t)*prp_id;
ret = H5Pget_fapl_core(c_prp_id, &c_increment, &c_backing_store);
ret = H5Pget_fapl_core(c_prp_id, &c_initial_size, &c_increment, &c_backing_store);
if (ret < 0)
return ret_value;
*increment = (size_t_f)c_increment;
*initial_size = (size_t_f)c_initial_size;
*increment = (size_t_f)c_increment;
if (c_backing_store > 0)
*flag = 1;
ret_value = 0;
Expand Down
19 changes: 12 additions & 7 deletions fortran/src/H5Pff.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1121,32 +1121,35 @@ END SUBROUTINE h5pget_alignment_f
!! \brief Modifies the file access property list to use the H5FD_CORE driver.
!!
!! \param prp_id File access property list identifier.
!! \param initial_size Initial size, in bytes, of the backing memory buffer.
!! \param increment Size, in bytes, of memory increments.
!! \param backing_store Boolean flag indicating whether to write the file contents to disk when the file is closed.
!! \param hdferr \fortran_error
!!
!! See C API: @ref H5Pset_fapl_core()
!!
SUBROUTINE h5pset_fapl_core_f(prp_id, increment, backing_store, hdferr)
SUBROUTINE h5pset_fapl_core_f(prp_id, initial_size, increment, backing_store, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: prp_id
INTEGER(SIZE_T), INTENT(IN) :: initial_size
INTEGER(SIZE_T), INTENT(IN) :: increment
LOGICAL, INTENT(IN) :: backing_store
INTEGER, INTENT(OUT) :: hdferr
INTEGER :: backing_store_flag
INTERFACE
INTEGER FUNCTION h5pset_fapl_core_c(prp_id, increment, backing_store_flag) &
INTEGER FUNCTION h5pset_fapl_core_c(prp_id, initial_size, increment, backing_store_flag) &
BIND(C,NAME='h5pset_fapl_core_c')
IMPORT :: HID_T, SIZE_T
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: prp_id
INTEGER(SIZE_T), INTENT(IN) :: initial_size
INTEGER(SIZE_T), INTENT(IN) :: increment
INTEGER :: backing_store_flag
END FUNCTION h5pset_fapl_core_c
END INTERFACE
backing_store_flag = 0
IF(backing_store) backing_store_flag = 1
hdferr = h5pset_fapl_core_c(prp_id, increment, backing_store_flag)
hdferr = h5pset_fapl_core_c(prp_id, initial_size, increment, backing_store_flag)
END SUBROUTINE h5pset_fapl_core_f

!>
Expand All @@ -1155,32 +1158,35 @@ END SUBROUTINE h5pset_fapl_core_f
!! \brief Queries core file driver properties.
!!
!! \param prp_id File access property list identifier.
!! \param initial_size Initial size, in bytes, of the backing memory buffer.
!! \param increment Size, in bytes, of memory increments.
!! \param backing_store Boolean flag indicating whether to write the file contents to disk when the file is closed.
!! \param hdferr \fortran_error
!!
!! See C API: @ref H5Pget_fapl_core()
!!
SUBROUTINE h5pget_fapl_core_f(prp_id, increment, backing_store, hdferr)
SUBROUTINE h5pget_fapl_core_f(prp_id, initial_size, increment, backing_store, hdferr)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: prp_id
INTEGER(SIZE_T), INTENT(OUT) :: initial_size
INTEGER(SIZE_T), INTENT(OUT) :: increment
LOGICAL, INTENT(OUT) :: backing_store
INTEGER, INTENT(OUT) :: hdferr
INTEGER :: backing_store_flag

INTERFACE
INTEGER FUNCTION h5pget_fapl_core_c(prp_id, increment, backing_store_flag) &
INTEGER FUNCTION h5pget_fapl_core_c(prp_id, initial_size, increment, backing_store_flag) &
BIND(C,NAME='h5pget_fapl_core_c')
IMPORT :: HID_T,SIZE_T
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: prp_id
INTEGER(SIZE_T), INTENT(OUT) :: initial_size
INTEGER(SIZE_T), INTENT(OUT) :: increment
INTEGER :: backing_store_flag
END FUNCTION h5pget_fapl_core_c
END INTERFACE

hdferr = h5pget_fapl_core_c(prp_id, increment, backing_store_flag)
hdferr = h5pget_fapl_core_c(prp_id, initial_size, increment, backing_store_flag)
backing_store =.FALSE.
IF (backing_store_flag .EQ. 1) backing_store =.TRUE.
END SUBROUTINE h5pget_fapl_core_f
Expand Down Expand Up @@ -7012,4 +7018,3 @@ END FUNCTION H5Pget_actual_selection_io_mode
END SUBROUTINE h5pget_actual_selection_io_mode_f

END MODULE H5P

4 changes: 2 additions & 2 deletions fortran/src/H5f90proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,8 @@ H5FC_DLL int_f h5pget_fapl_sec2_c(hid_t_f *prp_id, int_f *sec2);
#endif
H5FC_DLL int_f h5pset_alignment_c(hid_t_f *prp_id, hsize_t_f *threshold, hsize_t_f *alignment);
H5FC_DLL int_f h5pget_alignment_c(hid_t_f *prp_id, hsize_t_f *threshold, hsize_t_f *alignment);
H5FC_DLL int_f h5pget_fapl_core_c(hid_t_f *prp_id, size_t_f *increment, int_f *flag);
H5FC_DLL int_f h5pset_fapl_core_c(hid_t_f *prp_id, size_t_f *increment, int_f *flag);
H5FC_DLL int_f h5pget_fapl_core_c(hid_t_f *prp_id, size_t_f *initial_size, size_t_f *increment, int_f *flag);
H5FC_DLL int_f h5pset_fapl_core_c(hid_t_f *prp_id, size_t_f *initial_size, size_t_f *increment, int_f *flag);
H5FC_DLL int_f h5pset_fapl_family_c(hid_t_f *prp_id, hsize_t_f *memb_size, hid_t_f *memb_plist);
H5FC_DLL int_f h5pget_fapl_family_c(hid_t_f *prp_id, hsize_t_f *memb_size, hid_t_f *memb_plist);
H5FC_DLL int_f h5pset_cache_c(hid_t_f *prp_id, int_f *mdc_nelmts, size_t_f *rdcc_nelmts,
Expand Down
2 changes: 1 addition & 1 deletion hl/src/H5LT.c
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags)
alloc_incr = min_incr;

/* Configure FAPL to use the core file driver */
if (H5Pset_fapl_core(fapl, alloc_incr, false) < 0)
if (H5Pset_fapl_core(fapl, 0, alloc_incr, false) < 0)
goto out;

/* Set callbacks for file image ops ONLY if the file image is NOT copied */
Expand Down
26 changes: 18 additions & 8 deletions java/hdf/hdf5lib/H5.java
Original file line number Diff line number Diff line change
Expand Up @@ -17230,6 +17230,8 @@ public static void H5Pset_copy_object(long ocp_plist_id, int copy_options) throw
*
* @param fapl_id
* IN: File access property list identifier
* @param initial_size
* OUT: initial size of the backing memory buffer
* @param increment
* OUT: how much to grow the memory each time
* @param backing_store
Expand All @@ -17238,23 +17240,28 @@ public static void H5Pset_copy_object(long ocp_plist_id, int copy_options) throw
* @exception HDF5LibraryException
* Error from the HDF5 Library.
* @exception NullPointerException
* increment or backing_store is null.
* initial_size, increment, or backing_store is null.
*
**/
public static void H5Pget_fapl_core(long fapl_id, long[] increment, boolean[] backing_store)
public static void H5Pget_fapl_core(long fapl_id, long[] initial_size, long[] increment,
boolean[] backing_store)
throws HDF5LibraryException, NullPointerException
{
if (increment == null || increment.length < 1 || backing_store == null || backing_store.length < 1) {
throw new NullPointerException("increment or backing_store is null or has insufficient length");
if (initial_size == null || initial_size.length < 1 || increment == null || increment.length < 1 ||
backing_store == null || backing_store.length < 1) {
throw new NullPointerException(
"initial_size, increment, or backing_store is null or has insufficient length");
}

try (Arena arena = Arena.ofConfined()) {
MemorySegment initial_size_segment = arena.allocate(ValueLayout.JAVA_LONG, 1);
MemorySegment increment_segment = arena.allocate(ValueLayout.JAVA_LONG, 1);
MemorySegment backing_store_segment = arena.allocate(ValueLayout.JAVA_BOOLEAN, 1);
int retVal = org.hdfgroup.javahdf5.hdf5_h.H5Pget_fapl_core(fapl_id, increment_segment,
backing_store_segment);
int retVal = org.hdfgroup.javahdf5.hdf5_h.H5Pget_fapl_core(
fapl_id, initial_size_segment, increment_segment, backing_store_segment);
if (retVal < 0)
h5libraryError();
initial_size[0] = initial_size_segment.get(ValueLayout.JAVA_LONG, 0);
increment[0] = increment_segment.get(ValueLayout.JAVA_LONG, 0);
backing_store[0] = backing_store_segment.get(ValueLayout.JAVA_BOOLEAN, 0);
}
Expand All @@ -17267,6 +17274,8 @@ public static void H5Pget_fapl_core(long fapl_id, long[] increment, boolean[] ba
*
* @param fapl_id
* IN: File access property list identifier
* @param initial_size
* IN: initial size of the backing memory buffer
* @param increment
* IN: how much to grow the memory each time
* @param backing_store
Expand All @@ -17278,10 +17287,11 @@ public static void H5Pget_fapl_core(long fapl_id, long[] increment, boolean[] ba
* Error from the HDF5 Library.
*
**/
public static int H5Pset_fapl_core(long fapl_id, long increment, boolean backing_store)
public static int H5Pset_fapl_core(long fapl_id, long initial_size, long increment, boolean backing_store)
throws HDF5LibraryException
{
int retVal = org.hdfgroup.javahdf5.hdf5_h.H5Pset_fapl_core(fapl_id, increment, backing_store);
int retVal =
org.hdfgroup.javahdf5.hdf5_h.H5Pset_fapl_core(fapl_id, initial_size, increment, backing_store);
if (retVal < 0) {
h5libraryError();
}
Expand Down
10 changes: 7 additions & 3 deletions java/jtest/TestH5Pffm.java
Original file line number Diff line number Diff line change
Expand Up @@ -1588,17 +1588,21 @@ public void testH5Pset_fapl_core()
assertTrue("H5Pcreate fapl failed", isValidId(fapl));

// Set core (memory) VFD with 1MB increment and backing store enabled
long initialSize = 0;
long increment = 1024 * 1024; // 1MB increments
boolean backingStore = true; // Enable backing store
int result = hdf5_h.H5Pset_fapl_core(fapl, increment, backingStore);
int result = hdf5_h.H5Pset_fapl_core(fapl, initialSize, increment, backingStore);
assertTrue("H5Pset_fapl_core failed", isSuccess(result));

// Get core VFD settings
MemorySegment initialSizeSeg = arena.allocate(ValueLayout.JAVA_LONG);
MemorySegment incrementSeg = arena.allocate(ValueLayout.JAVA_LONG);
MemorySegment backingStoreSeg = arena.allocate(ValueLayout.JAVA_BOOLEAN);
result = hdf5_h.H5Pget_fapl_core(fapl, incrementSeg, backingStoreSeg);
result = hdf5_h.H5Pget_fapl_core(fapl, initialSizeSeg, incrementSeg, backingStoreSeg);
assertTrue("H5Pget_fapl_core failed", isSuccess(result));

long retInitialSize = initialSizeSeg.get(ValueLayout.JAVA_LONG, 0);
assertEquals("Initial size should match", initialSize, retInitialSize);
long retIncrement = incrementSeg.get(ValueLayout.JAVA_LONG, 0);
assertEquals("Increment should match", increment, retIncrement);

Expand Down Expand Up @@ -1702,7 +1706,7 @@ public void testH5Pget_driver()
assertTrue("Default driver ID should be valid", isValidId(driverId));

// Set core VFD
int result = hdf5_h.H5Pset_fapl_core(fapl, 1024, false);
int result = hdf5_h.H5Pset_fapl_core(fapl, 0, 1024, false);
assertTrue("H5Pset_fapl_core failed", isSuccess(result));

// Get driver again (should be core)
Expand Down
10 changes: 7 additions & 3 deletions java/src-jni/hdf/hdf5lib/H5.java
Original file line number Diff line number Diff line change
Expand Up @@ -11457,6 +11457,8 @@ public synchronized static native void H5Pset_copy_object(long ocp_plist_id, int
*
* @param fapl_id
* IN: File access property list identifier
* @param initial_size
* OUT: initial size of the backing memory buffer
* @param increment
* OUT: how much to grow the memory each time
* @param backing_store
Expand All @@ -11466,8 +11468,8 @@ public synchronized static native void H5Pset_copy_object(long ocp_plist_id, int
* Error from the HDF5 Library.
*
**/
public synchronized static native void H5Pget_fapl_core(long fapl_id, long[] increment,
boolean[] backing_store)
public synchronized static native void H5Pget_fapl_core(long fapl_id, long[] initial_size,
long[] increment, boolean[] backing_store)
throws HDF5LibraryException, NullPointerException;

/**
Expand All @@ -11477,6 +11479,8 @@ public synchronized static native void H5Pget_fapl_core(long fapl_id, long[] inc
*
* @param fapl_id
* IN: File access property list identifier
* @param initial_size
* IN: initial size of the backing memory buffer
* @param increment
* IN: how much to grow the memory each time
* @param backing_store
Expand All @@ -11488,7 +11492,7 @@ public synchronized static native void H5Pget_fapl_core(long fapl_id, long[] inc
* Error from the HDF5 Library.
*
**/
public synchronized static native int H5Pset_fapl_core(long fapl_id, long increment,
public synchronized static native int H5Pset_fapl_core(long fapl_id, long initial_size, long increment,
boolean backing_store)
throws HDF5LibraryException, NullPointerException;

Expand Down
Loading
Loading