diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2022-04-21 05:24:35 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-21 05:24:35 (GMT) |
commit | ec14985c8555bda02021568ea20295384a2cef7e (patch) | |
tree | 491c1f08a68d92e400d939d96fefdc7bfef57ddc /fortran | |
parent | bc62da7eb911727497475d1cc90991230f33fa3d (diff) | |
download | hdf5-ec14985c8555bda02021568ea20295384a2cef7e.zip hdf5-ec14985c8555bda02021568ea20295384a2cef7e.tar.gz hdf5-ec14985c8555bda02021568ea20295384a2cef7e.tar.bz2 |
VFD SWMR: Merges from develop (#1670)
* Cleans up SWMR test scripts (both legacy and VFD)
* Brings over format source changes for Java
* Normalization of HL, Fortran, C++, Java w/ develop
* Removes the STATIC flavor of FUNC_ENTER macros (#1622)
* Removes the STATIC flavor of FUNC_ENTER macros
* Remove H5_NO_ALIGNMENT_RESTRICTIONS (#1426)
* Do not conditionally compile code that uses a pointer dereference
and assignment to copy a potentially unaligned variable to aligned
automatic storage, or vice versa. Instead, always use naked `memcpy(3)`s.
Disassembling the generated code reveals that the `memcpy(3)`s optimize
(`-O3`) to a single `mov` instruction for x86_64, which is not strict
about alignment.
This change reduces the size of code and scripts by 143 lines, eases
our way to cross-compilation, and avoids invoking undefined behavior.
* Committing clang-format changes
* Per discussion, use HD and add comments.
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Removes unused definitions from module headers (#1624)
* Misc stuff from develop (includes some parallel things)
* Brings over SWMR test quiet mode changes from develop
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'fortran')
-rw-r--r-- | fortran/examples/h5_extend.f90 | 2 | ||||
-rw-r--r-- | fortran/src/H5_f.c | 12 | ||||
-rw-r--r-- | fortran/src/H5_ff.F90 | 11 | ||||
-rw-r--r-- | fortran/test/fortranlib_test.F90 | 20 | ||||
-rw-r--r-- | fortran/test/tH5A.F90 | 2 | ||||
-rw-r--r-- | fortran/test/tH5A_1_8.F90 | 12 | ||||
-rw-r--r-- | fortran/test/tH5D.F90 | 2 | ||||
-rw-r--r-- | fortran/test/tH5F.F90 | 99 | ||||
-rw-r--r-- | fortran/test/tH5G_1_8.F90 | 2 | ||||
-rw-r--r-- | fortran/test/tH5P.F90 | 4 | ||||
-rw-r--r-- | fortran/test/tHDF5.F90 | 2 | ||||
-rw-r--r-- | fortran/test/tHDF5_F03.F90 | 2 |
12 files changed, 143 insertions, 27 deletions
diff --git a/fortran/examples/h5_extend.f90 b/fortran/examples/h5_extend.f90 index 193f33e..86cc3c6 100644 --- a/fortran/examples/h5_extend.f90 +++ b/fortran/examples/h5_extend.f90 @@ -110,7 +110,7 @@ PROGRAM H5_EXTEND CALL h5pset_chunk_f(crp_list, RANK, dimsc, error) ! - !Create a dataset with 3X3 dimensions using cparms creation properties . + !Create a dataset with 3X3 dimensions using cparms creation properties. ! CALL h5dcreate_f(file_id, dsetname, H5T_NATIVE_INTEGER, dataspace, & dset_id, error, crp_list ) diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index 0277e5c..468debe 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -65,12 +65,6 @@ h5init_types_c(hid_t_f *types, hid_t_f *floatingtypes, hid_t_f *integertypes) * Find the HDF5 type of the Fortran Integer KIND. */ - /* Initialized INTEGER KIND types to default to native integer */ - for (i = 0; i < 5; i++) { - if ((types[i] = (hid_t_f)H5Tcopy(H5T_NATIVE_INT)) < 0) - return ret_value; - } - for (i = 0; i < H5_FORTRAN_NUM_INTEGER_KINDS; i++) { if (IntKinds_SizeOf[i] == sizeof(char)) { if ((types[i] = (hid_t_f)H5Tcopy(H5T_NATIVE_CHAR)) < 0) @@ -96,6 +90,12 @@ h5init_types_c(hid_t_f *types, hid_t_f *floatingtypes, hid_t_f *integertypes) } /*end else */ } + /* Initialized missing INTEGER KIND types to default to native integer */ + for (i = H5_FORTRAN_NUM_INTEGER_KINDS; i < 5; i++) { + if ((types[i] = (hid_t_f)H5Tcopy(H5T_NATIVE_INT)) < 0) + return ret_value; + } + if (sizeof(int_f) == sizeof(int)) { if ((types[5] = (hid_t_f)H5Tcopy(H5T_NATIVE_INT)) < 0) return ret_value; diff --git a/fortran/src/H5_ff.F90 b/fortran/src/H5_ff.F90 index 350d978..0aa4b04 100644 --- a/fortran/src/H5_ff.F90 +++ b/fortran/src/H5_ff.F90 @@ -250,6 +250,9 @@ CONTAINS END INTERFACE + ! Check if H5open_f has already been called. If so, skip doing it again. + IF(H5OPEN_NUM_OBJ .NE. 0) RETURN + error = h5init_types_c(predef_types, floating_types, integer_types) H5T_NATIVE_INTEGER_KIND(1:5) = predef_types(1:5) @@ -668,6 +671,7 @@ CONTAINS ! October 13, 2011 ! Fortran90 Interface: SUBROUTINE h5close_f(error) + USE H5F, ONLY : h5fget_obj_count_f, H5OPEN_NUM_OBJ IMPLICIT NONE INTEGER, INTENT(OUT) :: error !***** @@ -685,10 +689,17 @@ CONTAINS INTEGER(HID_T), DIMENSION(1:I_TYPES_LEN) :: i_types END FUNCTION h5close_types_c END INTERFACE + + ! Check if h5close_f has already been called. Skip doing it again. + IF(H5OPEN_NUM_OBJ .EQ. 0) RETURN + error = h5close_types_c(predef_types, PREDEF_TYPES_LEN, & floating_types, FLOATING_TYPES_LEN, & integer_types, INTEGER_TYPES_LEN ) + ! Reset the number of open objects from h5open_f to zero + CALL h5fget_obj_count_f(INT(H5F_OBJ_ALL_F,HID_T), H5F_OBJ_ALL_F, H5OPEN_NUM_OBJ, error) + END SUBROUTINE h5close_f !****s* H5LIB/h5get_libversion_f diff --git a/fortran/test/fortranlib_test.F90 b/fortran/test/fortranlib_test.F90 index 1640a8f..998b481 100644 --- a/fortran/test/fortranlib_test.F90 +++ b/fortran/test/fortranlib_test.F90 @@ -37,19 +37,27 @@ PROGRAM fortranlibtest INTEGER :: ret_total_error LOGICAL :: cleanup, status + WRITE(*,*) ' ========================== ' + WRITE(*,*) ' FORTRAN tests ' + WRITE(*,*) ' ========================== ' + + ret_total_error = 0 + CALL h5openclose(ret_total_error) + CALL write_test_status(ret_total_error, ' h5open/h5close test', total_error) + CALL h5open_f(error) + CALL check("h5open_f",error,total_error) cleanup = .TRUE. CALL h5_env_nocleanup_f(status) IF(status) cleanup=.FALSE. - WRITE(*,*) ' ========================== ' - WRITE(*,*) ' FORTRAN tests ' - WRITE(*,*) ' ========================== ' - CALL h5get_libversion_f(majnum, minnum, relnum, total_error) - IF(total_error .EQ. 0) THEN - WRITE(*, '(" FORTRANLIB_TEST is linked with HDF5 Library version ")', advance="NO") + ret_total_error = 0 + CALL h5get_libversion_f(majnum, minnum, relnum, ret_total_error) + IF(ret_total_error .EQ. 0) THEN + + WRITE(*, '(/," FORTRANLIB_TEST is linked with HDF5 Library version ")', advance="NO") WRITE(*, '(I0)', advance="NO") majnum WRITE(*, '(".")', advance="NO") WRITE(*, '(I0)', advance="NO") minnum diff --git a/fortran/test/tH5A.F90 b/fortran/test/tH5A.F90 index 2e76dad..115ce70 100644 --- a/fortran/test/tH5A.F90 +++ b/fortran/test/tH5A.F90 @@ -376,7 +376,7 @@ CONTAINS ! Open file ! CALL h5fopen_f(fix_filename, H5F_ACC_RDWR_F, file_id, error) - CALL check("h5open_f",error,total_error) + CALL check("h5fopen_f",error,total_error) ! ! Reopen dataset ! diff --git a/fortran/test/tH5A_1_8.F90 b/fortran/test/tH5A_1_8.F90 index cd8a981..a825f9d 100644 --- a/fortran/test/tH5A_1_8.F90 +++ b/fortran/test/tH5A_1_8.F90 @@ -317,7 +317,7 @@ SUBROUTINE test_attr_corder_create_compact(fcpl,fapl, total_error) CALL check("h5pclose_f",error,total_error) CALL h5fopen_f(FileName, H5F_ACC_RDWR_F, fid, error, fapl) - CALL check("h5open_f",error,total_error) + CALL check("h5fopen_f",error,total_error) CALL h5dopen_f(fid, DSET1_NAME, dset1, error) CALL check("h5dopen_f",error,total_error) @@ -432,7 +432,7 @@ SUBROUTINE test_attr_null_space(fcpl, fapl, total_error) ! Re-open file CALL h5fopen_f(FileName, H5F_ACC_RDWR_F, fid, error) - CALL check("h5open_f",error,total_error) + CALL check("h5fopen_f",error,total_error) ! Create dataspace for dataset attributes CALL h5screate_f(H5S_SCALAR_F, sid, error) CALL check("h5screate_f",error,total_error) @@ -1163,7 +1163,7 @@ SUBROUTINE test_attr_shared_rename( fcpl, fapl, total_error) ! Re-open file CALL h5fopen_f(FileName, H5F_ACC_RDWR_F, fid, error,fapl) - CALL check("h5open_f",error,total_error) + CALL check("h5fopen_f",error,total_error) ! Commit datatype to file IF(test_shared.EQ.2) THEN @@ -1827,7 +1827,7 @@ SUBROUTINE test_attr_shared_delete(fcpl, fapl, total_error) ! Re-open file CALL h5fopen_f(FileName, H5F_ACC_RDWR_F, fid, error,fapl) - CALL check("h5open_f",error,total_error) + CALL check("h5fopen_f",error,total_error) ! Commit datatype to file @@ -2048,7 +2048,7 @@ SUBROUTINE test_attr_dense_open( fcpl, fapl, total_error) ! Re-open file CALL h5fopen_f(FileName, H5F_ACC_RDWR_F, fid, error, fapl) - CALL check("h5open_f",error,total_error) + CALL check("h5fopen_f",error,total_error) ! Create dataspace for dataset CALL h5screate_f(H5S_SCALAR_F, sid, error) @@ -2325,7 +2325,7 @@ SUBROUTINE test_attr_corder_create_basic( fcpl, fapl, total_error ) ! Re-open file CALL h5fopen_f(FileName, H5F_ACC_RDWR_F, fid, error, fapl) - CALL check("h5open_f",error,total_error) + CALL check("h5fopen_f",error,total_error) ! Open dataset created CALL h5dopen_f(fid, DSET1_NAME, dataset, error, H5P_DEFAULT_F ) diff --git a/fortran/test/tH5D.F90 b/fortran/test/tH5D.F90 index eb9e831..5f8484e 100644 --- a/fortran/test/tH5D.F90 +++ b/fortran/test/tH5D.F90 @@ -347,7 +347,7 @@ CONTAINS CALL check("h5pset_chunk_f",error,total_error) ! - !Create a dataset with 3X3 dimensions using cparms creation properties . + !Create a dataset with 3X3 dimensions using cparms creation properties. ! CALL h5dcreate_f(file_id, dsetname, H5T_NATIVE_INTEGER, dataspace, dset_id, error, crp_list ) CALL check("h5dcreate_f",error,total_error) diff --git a/fortran/test/tH5F.F90 b/fortran/test/tH5F.F90 index 8d4845d..eb37016 100644 --- a/fortran/test/tH5F.F90 +++ b/fortran/test/tH5F.F90 @@ -22,7 +22,7 @@ ! ! CONTAINS SUBROUTINES ! mountingtest, reopentest, get_name_test, plisttest, -! file_close, file_space +! file_close, file_space, h5openclose ! !***** ! @@ -35,6 +35,103 @@ MODULE TH5F CONTAINS + SUBROUTINE h5openclose(total_error) + USE HDF5 ! This module contains all necessary modules + USE TH5_MISC + IMPLICIT NONE + INTEGER, INTENT(INOUT) :: total_error + + ! + ! flag to check operation success + ! + INTEGER :: error + INTEGER(SIZE_T) :: obj_count ! open object count + INTEGER, DIMENSION(1:5) :: obj_type ! open object type to check + INTEGER :: i, j + + DO j = 1, 2 + CALL h5open_f(error) + CALL check("h5open_f",error,total_error) + + obj_type(1) = H5F_OBJ_ALL_F + obj_type(2) = H5F_OBJ_FILE_F + obj_type(3) = H5F_OBJ_GROUP_F + obj_type(4) = H5F_OBJ_DATASET_F + obj_type(5) = H5F_OBJ_DATATYPE_F + + CALL h5close_f(error) + CALL check("h5close_f",error,total_error) + ! Check all the datatypes created during h5open_f are closed in h5close_f + DO i = 1, 5 + CALL h5fget_obj_count_f(INT(H5F_OBJ_ALL_F,HID_T), obj_type(i), obj_count, error) + CALL check("h5fget_obj_count_f",error,total_error) + IF(obj_count.NE.0)THEN + total_error = total_error + 1 + ENDIF + ENDDO + ENDDO + + ! Test calling h5open_f multiple times without calling h5close_f + DO j = 1, 4 + CALL h5open_f(error) + CALL check("h5open_f",error,total_error) + ENDDO + + CALL h5close_f(error) + CALL check("h5close_f",error,total_error) + ! Check all the datatypes created during h5open_f are closed in h5close_f + DO i = 1, 5 + CALL h5fget_obj_count_f(INT(H5F_OBJ_ALL_F,HID_T), obj_type(i), obj_count, error) + CALL check("h5fget_obj_count_f",error,total_error) + IF(obj_count.NE.0)THEN + total_error = total_error + 1 + ENDIF + ENDDO + + ! Test calling h5open_f multiple times with a h5close_f in the series of h5open_f + DO j = 1, 5 + CALL h5open_f(error) + CALL check("h5open_f",error,total_error) + IF(j.EQ.3)THEN + CALL h5close_f(error) + CALL check("h5close_f",error,total_error) + ! Check all the datatypes created during h5open_f are closed in h5close_f + DO i = 1, 5 + CALL h5fget_obj_count_f(INT(H5F_OBJ_ALL_F,HID_T), obj_type(i), obj_count, error) + CALL check("h5fget_obj_count_f",error,total_error) + IF(obj_count.NE.0)THEN + total_error = total_error + 1 + ENDIF + ENDDO + ENDIF + ENDDO + + CALL h5close_f(error) + CALL check("h5close_f",error,total_error) + ! Check all the datatypes created during h5open_f are closed in h5close_f + DO i = 1, 5 + CALL h5fget_obj_count_f(INT(H5F_OBJ_ALL_F,HID_T), obj_type(i), obj_count, error) + CALL check("h5fget_obj_count_f",error,total_error) + IF(obj_count.NE.0)THEN + total_error = total_error + 1 + ENDIF + ENDDO + + ! Check calling h5close_f after already calling h5close_f + CALL h5close_f(error) + CALL check("h5close_f",error,total_error) + ! Check all the datatypes created during h5open_f are closed in h5close_f + DO i = 1, 5 + CALL h5fget_obj_count_f(INT(H5F_OBJ_ALL_F,HID_T), obj_type(i), obj_count, error) + CALL check("h5fget_obj_count_f",error,total_error) + IF(obj_count.NE.0)THEN + total_error = total_error + 1 + ENDIF + ENDDO + + RETURN + END SUBROUTINE h5openclose + SUBROUTINE mountingtest(cleanup, total_error) USE HDF5 ! This module contains all necessary modules USE TH5_MISC diff --git a/fortran/test/tH5G_1_8.F90 b/fortran/test/tH5G_1_8.F90 index 222ba9d..bdecd8d 100644 --- a/fortran/test/tH5G_1_8.F90 +++ b/fortran/test/tH5G_1_8.F90 @@ -1923,7 +1923,7 @@ SUBROUTINE lapl_nlinks( fapl, total_error) ! Open file CALL h5fopen_f(FileName, H5F_ACC_RDWR_F, fid, error, fapl) - CALL check("h5open_f",error,total_error) + CALL check("h5fopen_f",error,total_error) ! Create LAPL with higher-than-usual nlinks value ! Create a non-default lapl with udata set to point to the first group diff --git a/fortran/test/tH5P.F90 b/fortran/test/tH5P.F90 index 75e4e72..d664dd7 100644 --- a/fortran/test/tH5P.F90 +++ b/fortran/test/tH5P.F90 @@ -541,7 +541,7 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) CALL H5Dclose_f(dsid, error) CALL H5Oopen_f(fid, "dset", dsid, error, dapl1) - ! Retrieve dapl from dataset, verfiy cache values are the same as on dapl1 + ! Retrieve dapl from dataset, verify cache values are the same as on dapl1 ! ! Note we rely on the knowledge that H5Pget_chunk_cache retrieves these ! values directly from the dataset structure, and not from a copy of the @@ -563,7 +563,7 @@ SUBROUTINE test_chunk_cache(cleanup, total_error) CALL H5Oopen_f(fid, "dset", dsid, error) CALL check("H5Oopen_f", error, total_error) - ! Retrieve dapl from dataset, verfiy cache values are the same as on fapl_local + ! Retrieve dapl from dataset, verify cache values are the same as on fapl_local CALL H5Dget_access_plist_f(dsid, dapl2, error) CALL check("H5Dget_access_plist_f", error, total_error) diff --git a/fortran/test/tHDF5.F90 b/fortran/test/tHDF5.F90 index db829af..2bd373d 100644 --- a/fortran/test/tHDF5.F90 +++ b/fortran/test/tHDF5.F90 @@ -7,7 +7,7 @@ ! src/fortran/test/tHDF5.f90 ! ! PURPOSE -! This is the test module used for testing the Fortran90 HDF library APIs. +! This is the test module used for testing the Fortran90 HDF library APIs. ! ! COPYRIGHT ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * diff --git a/fortran/test/tHDF5_F03.F90 b/fortran/test/tHDF5_F03.F90 index 6d318ea..1194b1e 100644 --- a/fortran/test/tHDF5_F03.F90 +++ b/fortran/test/tHDF5_F03.F90 @@ -7,7 +7,7 @@ ! src/fortran/test/tHDF5_F03.f90 ! ! PURPOSE -! This is the test module used for testing the Fortran2003 HDF +! This is the test module used for testing the Fortran2003 HDF ! library APIS. ! ! COPYRIGHT |