From 688074781ac7be2b7e799e8804378ba1f1563db1 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 9 Jan 2019 06:31:02 -0800 Subject: Fortran wrappers for dataset obj header minimization API calls. --- fortran/src/H5Fff.F90 | 93 ++++++++++++++++++++++++++++++++++++++ fortran/src/H5Pff.F90 | 91 ++++++++++++++++++++++++++++++++++++- fortran/src/hdf5_fortrandll.def.in | 4 ++ fortran/test/tH5F.F90 | 1 - fortran/test/tH5P.F90 | 52 +++++++++++++++++++++ release_docs/RELEASE.txt | 14 +++++- src/H5Fpublic.h | 2 +- 7 files changed, 252 insertions(+), 5 deletions(-) diff --git a/fortran/src/H5Fff.F90 b/fortran/src/H5Fff.F90 index 358e421..bf797b2 100644 --- a/fortran/src/H5Fff.F90 +++ b/fortran/src/H5Fff.F90 @@ -874,4 +874,97 @@ CONTAINS END SUBROUTINE h5fget_file_image_f +!****s* H5F (F03)/h5fget_dset_no_attrs_hint_f_F03 +! +! NAME +! h5fget_dset_no_attrs_hint_f +! +! PURPOSE +! Gets the value of the "minimize dataset headers" value which creates +! smaller dataset object headers when its set and no attributes are present. +! +! INPUTS +! file_id - Target file identifier. +! +! OUTPUTS +! minimize - Value of the setting. +! hdferr - error code: +! 0 on success and -1 on failure +! +! AUTHOR +! Dana Robinson +! January 2019 +! +! Fortran2003 Interface: + SUBROUTINE h5fget_dset_no_attrs_hint_f(file_id, minimize, hdferr) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: file_id + LOGICAL , INTENT(OUT) :: minimize + INTEGER , INTENT(OUT) :: hdferr +!***** + LOGICAL(C_BOOL) :: c_minimize + + INTERFACE + INTEGER FUNCTION h5fget_dset_no_attrs_hint_c(file_id, minimize) BIND(C, NAME='H5Fget_dset_no_attrs_hint') + IMPORT :: HID_T, C_BOOL + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: file_id + LOGICAL(C_BOOL), INTENT(OUT) :: minimize + END FUNCTION h5fget_dset_no_attrs_hint_c + END INTERFACE + + hdferr = INT(h5fget_dset_no_attrs_hint_c(file_id, c_minimize)) + + ! Transfer value of C C_BOOL type to Fortran LOGICAL + minimize = c_minimize + + END SUBROUTINE h5fget_dset_no_attrs_hint_f + +!****s* H5F (F03)/h5fset_dset_no_attrs_hint_f_F03 +! +! NAME +! h5fset_dset_no_attrs_hint_f +! +! PURPOSE +! Sets the value of the "minimize dataset headers" value which creates +! smaller dataset object headers when its set and no attributes are present. +! +! INPUTS +! file_id - Target file identifier. +! minimize - Value of the setting. +! +! OUTPUTS +! hdferr - error code: +! 0 on success and -1 on failure +! +! AUTHOR +! Dana Robinson +! January 2019 +! +! Fortran2003 Interface: + SUBROUTINE h5fset_dset_no_attrs_hint_f(file_id, minimize, hdferr) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: file_id + LOGICAL , INTENT(IN) :: minimize + INTEGER , INTENT(OUT) :: hdferr +!***** + LOGICAL(C_BOOL) :: c_minimize + + INTERFACE + INTEGER FUNCTION h5fset_dset_no_attrs_hint_c(file_id, minimize) BIND(C, NAME='H5Fset_dset_no_attrs_hint') + IMPORT :: HID_T, C_BOOL + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: file_id + LOGICAL(C_BOOL), INTENT(IN), VALUE :: minimize + END FUNCTION h5fset_dset_no_attrs_hint_c + END INTERFACE + + ! Transfer value of Fortran LOGICAL to C C_BOOL type + c_minimize = minimize + + hdferr = INT(h5fset_dset_no_attrs_hint_c(file_id, c_minimize)) + + END SUBROUTINE h5fset_dset_no_attrs_hint_f + END MODULE H5F + diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index 455c72e..13a2953 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -8023,8 +8023,97 @@ SUBROUTINE h5pget_virtual_dsetname_f(dcpl_id, index, name, hdferr, name_len) END SUBROUTINE h5pget_virtual_dsetname_f +!****s* H5P (F03)/h5pget_dset_no_attrs_hint_f_F03 +! +! NAME +! h5pget_dset_no_attrs_hint_f +! +! PURPOSE +! Gets the value of the "minimize dataset headers" value which creates +! smaller dataset object headers when its set and no attributes are present. +! +! INPUTS +! dcpl_id - Target dataset creation property list identifier. +! +! OUTPUTS +! minimize - Value of the setting. +! hdferr - error code: +! 0 on success and -1 on failure +! +! AUTHOR +! Dana Robinson +! January 2019 +! +! Fortran2003 Interface: + SUBROUTINE h5pget_dset_no_attrs_hint_f(dcpl_id, minimize, hdferr) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: dcpl_id + LOGICAL , INTENT(OUT) :: minimize + INTEGER , INTENT(OUT) :: hdferr +!***** + LOGICAL(C_BOOL) :: c_minimize -END MODULE H5P + INTERFACE + INTEGER FUNCTION h5pget_dset_no_attrs_hint_c(dcpl_id, minimize) BIND(C, NAME='H5Pget_dset_no_attrs_hint') + IMPORT :: HID_T, C_BOOL + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: dcpl_id + LOGICAL(C_BOOL), INTENT(OUT) :: minimize + END FUNCTION h5pget_dset_no_attrs_hint_c + END INTERFACE + + hdferr = INT(h5pget_dset_no_attrs_hint_c(dcpl_id, c_minimize)) + ! Transfer value of C C_BOOL type to Fortran LOGICAL + minimize = c_minimize + END SUBROUTINE h5pget_dset_no_attrs_hint_f + +!****s* H5P (F03)/h5pset_dset_no_attrs_hint_f_F03 +! +! NAME +! h5pset_dset_no_attrs_hint_f +! +! PURPOSE +! Sets the value of the "minimize dataset headers" value which creates +! smaller dataset object headers when its set and no attributes are present. +! +! INPUTS +! dcpl_id - Target dataset creation property list identifier. +! minimize - Value of the setting. +! +! OUTPUTS +! hdferr - error code: +! 0 on success and -1 on failure +! +! AUTHOR +! Dana Robinson +! January 2019 +! +! Fortran2003 Interface: + SUBROUTINE h5pset_dset_no_attrs_hint_f(dcpl_id, minimize, hdferr) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: dcpl_id + LOGICAL , INTENT(IN) :: minimize + INTEGER , INTENT(OUT) :: hdferr +!***** + LOGICAL(C_BOOL) :: c_minimize + + INTERFACE + INTEGER FUNCTION h5pset_dset_no_attrs_hint_c(dcpl_id, minimize) BIND(C, NAME='H5Pset_dset_no_attrs_hint') + IMPORT :: HID_T, C_BOOL + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: dcpl_id + LOGICAL(C_BOOL), INTENT(IN), VALUE :: minimize + END FUNCTION h5pset_dset_no_attrs_hint_c + END INTERFACE + + ! Transfer value of Fortran LOGICAL to C C_BOOL type + c_minimize = minimize + + hdferr = INT(h5pset_dset_no_attrs_hint_c(dcpl_id, c_minimize)) + + END SUBROUTINE h5pset_dset_no_attrs_hint_f + +END MODULE H5P diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in index 3a5a91f..f36a5c8 100644 --- a/fortran/src/hdf5_fortrandll.def.in +++ b/fortran/src/hdf5_fortrandll.def.in @@ -98,6 +98,8 @@ H5F_mp_H5FIS_HDF5_F H5F_mp_H5FGET_NAME_F H5F_mp_H5FGET_FILESIZE_F H5F_mp_H5FGET_FILE_IMAGE_F +H5F_mp_H5FGET_DSET_NO_ATTRS_HINT_F +H5F_mp_H5FSET_DSET_NO_ATTRS_HINT_F ; H5G H5G_mp_H5GOPEN_F H5G_mp_H5GCREATE_F @@ -328,6 +330,8 @@ H5P_mp_H5PGET_VIRTUAL_VSPACE_F H5P_mp_H5PGET_VIRTUAL_SRCSPACE_F H5P_mp_H5PGET_VIRTUAL_FILENAME_F H5P_mp_H5PGET_VIRTUAL_DSETNAME_F +H5P_mp_H5PGET_DSET_NO_ATTRS_HINT_F +H5P_mp_H5PSET_DSET_NO_ATTRS_HINT_F ; Parallel @H5_NOPAREXP@H5P_mp_H5PSET_FAPL_MPIO_F @H5_NOPAREXP@H5P_mp_H5PGET_FAPL_MPIO_F diff --git a/fortran/test/tH5F.F90 b/fortran/test/tH5F.F90 index ee386dd..75a7748 100644 --- a/fortran/test/tH5F.F90 +++ b/fortran/test/tH5F.F90 @@ -841,5 +841,4 @@ CONTAINS END SUBROUTINE file_space - END MODULE TH5F diff --git a/fortran/test/tH5P.F90 b/fortran/test/tH5P.F90 index 563926b..ed35b63 100644 --- a/fortran/test/tH5P.F90 +++ b/fortran/test/tH5P.F90 @@ -444,6 +444,7 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) INTEGER(size_t) rdcc_nelmts INTEGER(size_t) rdcc_nbytes REAL :: rdcc_w0 + LOGICAL :: minimize ! Flag for minimized headers CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) IF (error .NE. 0) THEN @@ -648,6 +649,57 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) CALL verify("H5Pget_chunk_cache_f", INT(nbytes_2), INT(nbytes_4), total_error) CALL verify("H5Pget_chunk_cache_f", w0_3, w0_4, total_error) + ! Check that the dataset object header minimization hint + ! can be set and retrieved. + + ! H5P version + ! Check the default value + minimize = .TRUE. + CALL h5pget_dset_no_attrs_hint_f(dcpl, minimize, error) + CALL check("h5pget_dset_no_attrs_hint_f",error,total_error) + if(error .eq. 0 .and. minimize .neqv. .FALSE.) then + total_error = total_error + 1 + write(*,*) "Default dataset minimize flag was incorrect (H5P)" + endif + + ! Check setter + minimize = .TRUE. + CALL h5pset_dset_no_attrs_hint_f(dcpl, minimize, error) + CALL check("h5pset_dset_no_attrs_hint_f",error,total_error) + + ! Check getter + minimize = .FALSE. + CALL h5pget_dset_no_attrs_hint_f(dcpl, minimize, error) + CALL check("h5pget_dset_no_attrs_hint_f",error,total_error) + if(error .eq. 0 .and. minimize .neqv. .TRUE.) then + total_error = total_error + 1 + write(*,*) "Unable to get correct dataset minimize flag (H5P)" + endif + + ! H5F version + ! Check the default value + minimize = .TRUE. + CALL h5fget_dset_no_attrs_hint_f(fid, minimize, error) + CALL check("h5fget_dset_no_attrs_hint_f",error,total_error) + if(error .eq. 0 .and. minimize .neqv. .FALSE.) then + total_error = total_error + 1 + write(*,*) "Default dataset minimize flag was incorrect (H5F)" + endif + + ! Check setter + minimize = .TRUE. + CALL h5fset_dset_no_attrs_hint_f(fid, minimize, error) + CALL check("h5fset_dset_no_attrs_hint_f",error,total_error) + + ! Check getter + minimize = .FALSE. + CALL h5fget_dset_no_attrs_hint_f(fid, minimize, error) + CALL check("h5fget_dset_no_attrs_hint_f",error,total_error) + if(error .eq. 0 .and. minimize .neqv. .TRUE.) then + total_error = total_error + 1 + write(*,*) "Unable to get correct dataset minimize flag (H5F)" + endif + ! Close CALL H5Dclose_f(dsid, error) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 62ad9ad..d33b7eb 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -197,7 +197,17 @@ New Features Fortran Library: ---------------- - - + - Added wrappers for dataset object header minimization calls. + (see the note for TRILAB-45, above) + + New API calls: + + h5fget_dset_no_attrs_hint_f + h5fset_dset_no_attrs_hint_f + h5pget_dset_no_attrs_hint_f + h5pset_dset_no_attrs_hint_f + + (DER - 2019/01/09, TRILAB-45) C++ Library: ------------ @@ -370,7 +380,7 @@ Bug Fixes since HDF5-1.10.3 release - Made Fortran specific subroutines PRIVATE in generic procedures. - Effected generic procedures were functions in H5A, H5D, H5P, H5R and H5T. + Affected generic procedures were functions in H5A, H5D, H5P, H5R and H5T. (MSB, 2018/12/04, HDFFV-10511) diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index 6274eb0..8a475d1 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -233,7 +233,7 @@ H5_DLL herr_t H5Fflush(hid_t object_id, H5F_scope_t scope); H5_DLL herr_t H5Fclose(hid_t file_id); H5_DLL hid_t H5Fget_create_plist(hid_t file_id); H5_DLL hid_t H5Fget_access_plist(hid_t file_id); -H5_DLL herr_t H5Fget_intent(hid_t file_id, unsigned * intent); +H5_DLL herr_t H5Fget_intent(hid_t file_id, unsigned *intent); H5_DLL ssize_t H5Fget_obj_count(hid_t file_id, unsigned types); H5_DLL ssize_t H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *obj_id_list); H5_DLL herr_t H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle); -- cgit v0.12