From ec908e7ab6356dd8edbe80e45d75e2c4c96f3a5e Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sun, 6 Mar 2016 08:02:58 -0500 Subject: [svn-r29286] Merge of r29155, 29162, 29163, 29165, 29169, 29172 from trunk. Fortran fixes and improvements Tested on: 64-bit Ubuntu 15.10 w/ gcc 5.2.1 autotools serial w/ Fortran and C++ autotools parallel (MPICH 3.1.4) w/ Fortran --- fortran/robodoc.rc | 5 +- fortran/src/H5Dff.F90 | 4 +- fortran/src/H5Pff.F90 | 204 ++++++++++++++++++++++++++++++++++-- fortran/src/H5_buildiface.F90 | 40 +------ fortran/src/H5fortkit.F90 | 10 +- fortran/src/hdf5_fortrandll.def.in | 4 + fortran/test/H5_test_buildiface.F90 | 6 +- fortran/test/tH5F_F03.F90 | 4 +- fortran/test/tH5P_F03.F90 | 7 +- fortran/test/tHDF5.F90 | 2 +- fortran/test/tHDF5_1_8.F90 | 2 +- fortran/test/tHDF5_F03.F90 | 2 +- fortran/test/tf.F90 | 4 +- fortran/testpar/hyper.f90 | 143 +++++++++++++++++-------- fortran/testpar/ptest.f90 | 119 ++++++++------------- 15 files changed, 366 insertions(+), 190 deletions(-) diff --git a/fortran/robodoc.rc b/fortran/robodoc.rc index 07b8b35..b24e4f9 100644 --- a/fortran/robodoc.rc +++ b/fortran/robodoc.rc @@ -132,10 +132,7 @@ ignore files: *.o *e *.mod - *_F90.f90 *.c accept files: - *_F03.f90 - *_F90.f90 - *.f90 + *.F90 *.h diff --git a/fortran/src/H5Dff.F90 b/fortran/src/H5Dff.F90 index b372dc1..cb0b292 100644 --- a/fortran/src/H5Dff.F90 +++ b/fortran/src/H5Dff.F90 @@ -172,7 +172,7 @@ MODULE H5D MODULE PROCEDURE h5dfill_integer MODULE PROCEDURE h5dfill_c_float MODULE PROCEDURE h5dfill_c_double -#ifdef H5_FORTRAN_HAVE_C_LONG_DOUBLE +#if H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE!=0 MODULE PROCEDURE h5dfill_c_long_double #endif MODULE PROCEDURE h5dfill_char @@ -1753,7 +1753,7 @@ CONTAINS END SUBROUTINE h5dfill_c_double -#ifdef H5_FORTRAN_HAVE_C_LONG_DOUBLE +#if H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE!=0 SUBROUTINE h5dfill_c_long_double(fill_value, space_id, buf, hdferr) IMPLICIT NONE REAL(KIND=C_LONG_DOUBLE), INTENT(IN), TARGET :: fill_value ! Fill value diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index 6c6abe4..e052ea0 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -7320,13 +7320,195 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) hdferr = h5pget_mpio_actual_io_mode_c(dxpl_id, actual_io_mode) END SUBROUTINE h5pget_mpio_actual_io_mode_f + +!****s* H5P/h5pset_all_coll_metadata_ops_f +! NAME +! h5pset_all_coll_metadata_ops_f +! +! PURPOSE +! Sets requirement whether HDF5 metadata read operations using the access property +! list are required to be collective or independent. If collective requirement is +! selected, the HDF5 library will optimize the metadata reads improving performance. +! The default setting is independent (false). +! +! INPUTS +! plist_id - File access property list identifier. +! is_collective - Indicates if metadata writes are collective or not. +! OUTPUTS +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! Feb, 10 2016 +! +! HISTORY +! +! SOURCE + SUBROUTINE h5pset_all_coll_metadata_ops_f(plist_id, is_collective, hdferr) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: plist_id + LOGICAL, INTENT(IN) :: is_collective + INTEGER, INTENT(OUT) :: hdferr +!***** + LOGICAL(C_BOOL) :: c_is_collective + + INTERFACE + INTEGER FUNCTION h5pset_all_coll_metadata_ops(plist_id, is_collective) BIND(C, NAME='H5Pset_all_coll_metadata_ops') + IMPORT :: HID_T, C_BOOL + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN), VALUE :: plist_id + LOGICAL(C_BOOL), INTENT(IN), VALUE :: is_collective + END FUNCTION h5pset_all_coll_metadata_ops + END INTERFACE + + ! Transfer value of Fortran LOGICAL to C c_bool type + c_is_collective = is_collective + + hdferr = INT(H5Pset_all_coll_metadata_ops(plist_id, c_is_collective)) + + END SUBROUTINE h5pset_all_coll_metadata_ops_f + +!****s* H5P/h5pget_all_coll_metadata_ops_f +! NAME +! h5pget_all_coll_metadata_ops_f +! +! PURPOSE +! Retrieves metadata read mode from the access property list. +! +! INPUTS +! plist_id - File access property list identifier. +! OUTPUTS +! is_collective - Collective access setting. +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! Feb, 10 2016 +! +! HISTORY +! +! SOURCE + SUBROUTINE h5pget_all_coll_metadata_ops_f(plist_id, is_collective, hdferr) + + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: plist_id + LOGICAL, INTENT(OUT) :: is_collective + INTEGER, INTENT(OUT) :: hdferr +!***** + LOGICAL(C_BOOL) :: c_is_collective + + INTERFACE + INTEGER FUNCTION h5pget_all_coll_metadata_ops(plist_id, is_collective) BIND(C, NAME='H5Pget_all_coll_metadata_ops') + IMPORT :: HID_T, C_BOOL + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN), VALUE :: plist_id + LOGICAL(C_BOOL), INTENT(OUT) :: is_collective + END FUNCTION h5pget_all_coll_metadata_ops + END INTERFACE + + hdferr = INT(H5Pget_all_coll_metadata_ops(plist_id, c_is_collective)) + + ! Transfer value of C c_bool type to Fortran LOGICAL + is_collective = c_is_collective + + END SUBROUTINE h5pget_all_coll_metadata_ops_f + +!****s* H5P/h5pset_coll_metadata_write_f +! NAME +! h5pset_coll_metadata_write_f +! +! PURPOSE +! Sets metadata writes to collective or independent. Default setting is independent (false). +! +! INPUTS +! fapl_id - File access property list identifier. +! is_collective - Indicates if metadata writes are collective or not. +! OUTPUTS +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! Feb, 10 2016 +! +! HISTORY +! +! SOURCE + SUBROUTINE h5pset_coll_metadata_write_f(plist_id, is_collective, hdferr) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: plist_id + LOGICAL, INTENT(IN) :: is_collective + INTEGER, INTENT(OUT) :: hdferr +!***** + LOGICAL(C_BOOL) :: c_is_collective + + INTERFACE + INTEGER FUNCTION h5pset_coll_metadata_write(plist_id, is_collective) BIND(C, NAME='H5Pset_coll_metadata_write') + IMPORT :: HID_T, C_BOOL + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN), VALUE :: plist_id + LOGICAL(C_BOOL), INTENT(IN), VALUE :: is_collective + END FUNCTION h5pset_coll_metadata_write + END INTERFACE + + ! Transfer value of Fortran LOGICAL to C c_bool type + c_is_collective = is_collective + + hdferr = INT(H5Pset_coll_metadata_write(plist_id, c_is_collective)) + + END SUBROUTINE h5pset_coll_metadata_write_f + +!****s* H5P/h5pget_coll_metadata_write_f +! NAME +! h5pget_coll_metadata_write_f +! +! PURPOSE +! Retrieves metadata write mode from the file access property list. +! +! INPUTS +! plist_id - File access property list identifier. +! OUTPUTS +! is_collective - Collective access setting. +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! Feb, 10 2016 +! +! HISTORY +! +! SOURCE + SUBROUTINE h5pget_coll_metadata_write_f(plist_id, is_collective, hdferr) + + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: plist_id + LOGICAL, INTENT(OUT) :: is_collective + INTEGER, INTENT(OUT) :: hdferr +!***** + LOGICAL(C_BOOL) :: c_is_collective + + INTERFACE + INTEGER FUNCTION h5pget_coll_metadata_write(plist_id, is_collective) BIND(C, NAME='H5Pget_coll_metadata_write') + IMPORT :: HID_T, C_BOOL + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN), VALUE :: plist_id + LOGICAL(C_BOOL), INTENT(OUT) :: is_collective + END FUNCTION h5pget_coll_metadata_write + END INTERFACE + + hdferr = INT(H5Pget_coll_metadata_write(plist_id, c_is_collective)) + + ! Transfer value of C c_bool type to Fortran LOGICAL + is_collective = c_is_collective + + END SUBROUTINE h5pget_coll_metadata_write_f + #endif ! ! V I R T U A L D A T S E T S ! -!****s* +!****s* H5P/h5pset_virtual_view_f ! NAME ! h5pset_virtual_view_f ! @@ -7371,7 +7553,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) END SUBROUTINE h5pset_virtual_view_f -!****s* +!****s* H5P/h5pget_virtual_view_f ! NAME ! h5pget_virtual_view_f ! @@ -7415,7 +7597,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) END SUBROUTINE h5pget_virtual_view_f -!****s* +!****s* H5P/h5pset_virtual_printf_gap_f ! NAME ! h5pset_virtual_printf_gap_f ! @@ -7457,7 +7639,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) END SUBROUTINE h5pset_virtual_printf_gap_f -!****s* +!****s* H5P/h5pget_virtual_printf_gap_f ! NAME ! h5pget_virtual_printf_gap_f ! @@ -7500,7 +7682,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) END SUBROUTINE h5pget_virtual_printf_gap_f -!****s* +!****s* H5P/h5pset_virtual_f ! NAME ! h5pset_virtual_f ! @@ -7560,7 +7742,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) END SUBROUTINE h5pset_virtual_f -!****s* +!****s* H5P/h5pget_virtual_count_f ! NAME ! h5pget_virtual_count_f ! @@ -7601,7 +7783,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) END SUBROUTINE h5pget_virtual_count_f -!****s* +!****s* H5P/h5pget_virtual_vspace_f ! NAME ! h5pget_virtual_vspace_f ! @@ -7649,7 +7831,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) END SUBROUTINE h5pget_virtual_vspace_f -!****s* +!****s* H5P/h5pget_virtual_srcspace_f ! NAME ! h5pget_virtual_srcspace_f ! @@ -7699,7 +7881,7 @@ SUBROUTINE h5pget_virtual_srcspace_f(dcpl_id, index, ds_id, hdferr) END SUBROUTINE h5pget_virtual_srcspace_f -!****s* +!****s* H5P/h5pget_virtual_filename_f ! NAME ! h5pget_virtual_filename_f ! @@ -7765,10 +7947,9 @@ SUBROUTINE h5pget_virtual_filename_f(dcpl_id, index, name, hdferr, name_len) ENDIF - END SUBROUTINE h5pget_virtual_filename_f -!****s* +!****s* H5P/h5pget_virtual_dsetname_f ! NAME ! h5pget_virtual_dsetname_f ! @@ -7836,6 +8017,7 @@ SUBROUTINE h5pget_virtual_dsetname_f(dcpl_id, index, name, hdferr, name_len) END SUBROUTINE h5pget_virtual_dsetname_f + END MODULE H5P diff --git a/fortran/src/H5_buildiface.F90 b/fortran/src/H5_buildiface.F90 index 471052f..d58b384 100644 --- a/fortran/src/H5_buildiface.F90 +++ b/fortran/src/H5_buildiface.F90 @@ -717,45 +717,9 @@ PROGRAM H5_buildiface WRITE(11,'(A)') ' file_space_id_default, xfer_prp_default, f_ptr)' WRITE(11,'(A)') ' END SUBROUTINE h5dread_ckind_rank'//chr_rank(j) ENDDO -! +!********************** ! h5dwrite_f - -!****s* H5D (F03)/h5dwrite_f_F03 -! -! NAME -! h5dwrite_f_F03 -! -! PURPOSE -! Writes raw data from a dataset into a buffer. -! -! Inputs: -! dset_id - Identifier of the dataset to write to. -! mem_type_id - Identifier of the memory datatype. -! buf - Buffer with data to be written to the file. -! -! Outputs: -! hdferr - Returns 0 if successful and -1 if fails -! -! Optional parameters: -! mem_space_id - Identifier of the memory dataspace. -! file_space_id - Identifier of the dataset's dataspace in the file. -! xfer_prp - Identifier of a transfer property list for this I/O operation. -! -! AUTHOR -! M. Scot Breitenfeld -! September 17, 2011 -! -! Fortran2003 Interface: -!! SUBROUTINE h5dwrite_f(dset_id, mem_type_id, buf, hdferr, & -!! mem_space_id, file_space_id, xfer_prp) -!! INTEGER(HID_T), INTENT(IN) :: dset_id -!! INTEGER(HID_T), INTENT(IN) :: mem_type_id -!! TYPE(C_PTR) , INTENT(IN) :: buf -!! INTEGER , INTENT(OUT) :: hdferr -!! INTEGER(HID_T), INTENT(IN) , OPTIONAL :: mem_space_id -!! INTEGER(HID_T), INTENT(IN) , OPTIONAL :: file_space_id -!! INTEGER(HID_T), INTENT(IN) , OPTIONAL :: xfer_prp -!***** +!********************** DO i = 1, num_rkinds k = rkind(i) WRITE(chr2,'(I2)') k diff --git a/fortran/src/H5fortkit.F90 b/fortran/src/H5fortkit.F90 index 9afd890..3062c28 100644 --- a/fortran/src/H5fortkit.F90 +++ b/fortran/src/H5fortkit.F90 @@ -1,4 +1,11 @@ -!****h* H5fortkit/H5fortkit +!****h* ROBODoc/H5fortkit +! +! NAME +! MODULE H5fortkit +! +! FILE +! fortran/src/H5fortkit.F90 +! ! PURPOSE ! Routines to deal with C-FORTRAN issues. ! @@ -18,6 +25,7 @@ ! access to either file, you may request a copy from help@hdfgroup.org. * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! +!***** MODULE H5fortkit CONTAINS diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in index 42b5642..3a5a91f 100644 --- a/fortran/src/hdf5_fortrandll.def.in +++ b/fortran/src/hdf5_fortrandll.def.in @@ -334,6 +334,10 @@ H5P_mp_H5PGET_VIRTUAL_DSETNAME_F @H5_NOPAREXP@H5P_mp_H5PSET_DXPL_MPIO_F @H5_NOPAREXP@H5P_mp_H5PGET_DXPL_MPIO_F @H5_NOPAREXP@H5P_mp_H5PGET_MPIO_ACTUAL_IO_MODE_F +@H5_NOPAREXP@H5P_mp_H5PSET_ALL_COLL_METADATA_OPS_F +@H5_NOPAREXP@H5P_mp_H5PGET_ALL_COLL_METADATA_OPS_F +@H5_NOPAREXP@H5P_mp_H5PSET_COLL_METADATA_WRITE_F +@H5_NOPAREXP@H5P_mp_H5PGET_COLL_METADATA_WRITE_F ; H5R H5R_mp_H5RCREATE_OBJECT_F H5R_mp_H5RCREATE_REGION_F diff --git a/fortran/test/H5_test_buildiface.F90 b/fortran/test/H5_test_buildiface.F90 index 30687df..e0323cc 100644 --- a/fortran/test/H5_test_buildiface.F90 +++ b/fortran/test/H5_test_buildiface.F90 @@ -1,10 +1,10 @@ -!****p* Program/H5_buildiface +!****p* Program/H5_test_buildiface ! ! NAME -! Executable: H5_buildiface +! Executable: H5_test_buildiface ! ! FILE -! fortran/src/H5_buildiface.f90 +! fortran/src/H5_test_buildiface.F90 ! ! PURPOSE ! This stand alone program is used at build time to generate the program diff --git a/fortran/test/tH5F_F03.F90 b/fortran/test/tH5F_F03.F90 index 9e23d19..2425bba 100644 --- a/fortran/test/tH5F_F03.F90 +++ b/fortran/test/tH5F_F03.F90 @@ -1,7 +1,7 @@ -!****h* root/fortran/test/tH5F_F03.f90 +!****h* root/fortran/test/tH5F_F03 ! ! NAME -! tH5F_F03.f90 +! tH5F_F03.F90 ! ! FUNCTION ! Test FORTRAN HDF5 H5F APIs which are dependent on FORTRAN 2003 diff --git a/fortran/test/tH5P_F03.F90 b/fortran/test/tH5P_F03.F90 index 15bd86f..f64c4e3 100644 --- a/fortran/test/tH5P_F03.F90 +++ b/fortran/test/tH5P_F03.F90 @@ -1,7 +1,7 @@ -!****h* root/fortran/test/tH5P_F03.f90 +!****h* root/fortran/test/TH5P_F03 ! ! NAME -! tH5P_F03.f90 +! tH5P_F03.F90 ! ! FUNCTION ! Test FORTRAN HDF5 H5P APIs which are dependent on FORTRAN 2003 @@ -618,8 +618,7 @@ SUBROUTINE external_test_offset(cleanup,total_error) END SUBROUTINE external_test_offset -!****h* root/fortran/test/tH5P_F03.f90 -! +!------------------------------------------------------------------------- ! NAME ! test_vds ! diff --git a/fortran/test/tHDF5.F90 b/fortran/test/tHDF5.F90 index d12bb25..e9e0892 100644 --- a/fortran/test/tHDF5.F90 +++ b/fortran/test/tHDF5.F90 @@ -1,4 +1,4 @@ -!****h* ROBODoc/HDF5 +!****h* ROBODoc/THDF5 ! ! NAME ! MODULE THDF5 diff --git a/fortran/test/tHDF5_1_8.F90 b/fortran/test/tHDF5_1_8.F90 index 9d1c3ec..6a3f74b 100644 --- a/fortran/test/tHDF5_1_8.F90 +++ b/fortran/test/tHDF5_1_8.F90 @@ -1,4 +1,4 @@ -!****h* ROBODoc/HDF5 +!****h* ROBODoc/THDF5_1_8 ! ! NAME ! MODULE THDF5_1_8 diff --git a/fortran/test/tHDF5_F03.F90 b/fortran/test/tHDF5_F03.F90 index 3dbec11..b3b1885 100644 --- a/fortran/test/tHDF5_F03.F90 +++ b/fortran/test/tHDF5_F03.F90 @@ -1,4 +1,4 @@ -!****h* ROBODoc/HDF5 +!****h* ROBODoc/THDF5_F03 ! ! NAME ! MODULE THDF5_F03 diff --git a/fortran/test/tf.F90 b/fortran/test/tf.F90 index 7d67f30..e9baf43 100644 --- a/fortran/test/tf.F90 +++ b/fortran/test/tf.F90 @@ -89,7 +89,7 @@ CONTAINS error_string = skip ENDIF - WRITE(*, fmt = '(A, T72, A)') test_title, error_string + WRITE(*, fmt = '(A, T80, A)') test_title, error_string IF(test_result.GT.0) total_error = total_error + test_result @@ -336,7 +336,7 @@ CONTAINS IMPLICIT NONE TYPE(comp_datatype), INTENT(in) :: a -#ifdef H5_FORTRAN_FORTRAN_HAVE_C_SIZEOF +#ifdef H5_FORTRAN_HAVE_C_SIZEOF H5_SIZEOF_CMPD = C_SIZEOF(a) #else H5_SIZEOF_CMPD = SIZEOF(a) diff --git a/fortran/testpar/hyper.f90 b/fortran/testpar/hyper.f90 index a2e2e07..28c0b53 100644 --- a/fortran/testpar/hyper.f90 +++ b/fortran/testpar/hyper.f90 @@ -14,9 +14,9 @@ ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -!////////////////////////////////////////////////////////// +! ! writes/reads dataset by hyperslabs -!////////////////////////////////////////////////////////// +! SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) USE HDF5 @@ -52,14 +52,15 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) CHARACTER(len=80) :: filename ! filename INTEGER :: i INTEGER :: actual_io_mode ! The type of I/O performed by this process - - !////////////////////////////////////////////////////////// + LOGICAL :: is_coll + LOGICAL :: is_coll_true = .TRUE. + ! ! initialize the array data between the processes (3) ! for the 12 size array we get ! p0 = 1,2,3,4 ! p1 = 5,6,7,8 ! p2 = 9,10,11,12 - !////////////////////////////////////////////////////////// + ! ALLOCATE(wbuf(0:length-1),stat=hdferror) IF (hdferror /= 0) THEN @@ -81,17 +82,16 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) wbuf(i) = i ENDDO - !////////////////////////////////////////////////////////// + ! ! HDF5 I/O - !////////////////////////////////////////////////////////// + ! dims(1) = length cdims(1) = length/mpi_size ! define chunks as the number of processes - !////////////////////////////////////////////////////////// + ! ! setup file access property list with parallel I/O access - !////////////////////////////////////////////////////////// - + ! CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl_id, hdferror) CALL check("h5pcreate_f", hdferror, nerrors) @@ -106,14 +106,67 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) nerrors = nerrors + 1 ENDIF - !////////////////////////////////////////////////////////// + ! ! create the file collectively - !////////////////////////////////////////////////////////// - + ! CALL h5_fixname_f("parf1", filename, fapl_id, hdferror) - CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, hdferror, access_prp = fapl_id) - CALL check("h5fcreate_f", hdferror, nerrors) + IF(do_collective)THEN + ! verify settings for file access properties + + ! Collective metadata writes + CALL h5pget_coll_metadata_write_f(fapl_id, is_coll, hdferror) + CALL check("h5pget_coll_metadata_write_f", hdferror, nerrors) + IF(is_coll .NEQV. .FALSE.)THEN + PRINT*, "Incorrect property setting for coll metadata writes" + nerrors = nerrors + 1 + ENDIF + + ! Collective metadata read API calling requirement + CALL h5pget_all_coll_metadata_ops_f(fapl_id, is_coll, hdferror) + CALL check("h5pget_all_coll_metadata_ops_f", hdferror, nerrors) + IF(is_coll .NEQV. .FALSE.)THEN + PRINT*, "Incorrect property setting for coll metadata API calls requirement" + nerrors = nerrors + 1 + ENDIF + + ! Collective metadata writes + CALL h5pset_coll_metadata_write_f(fapl_id, .TRUE., hdferror) + CALL check("h5pset_coll_metadata_write_f", hdferror, nerrors) + ! Collective metadata READ API calling requirement + CALL h5pset_all_coll_metadata_ops_f(fapl_id, is_coll_true, hdferror) + CALL check("h5pset_all_coll_metadata_ops_f", hdferror, nerrors) + + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, hdferror, access_prp = fapl_id) + CALL check("h5fcreate_f", hdferror, nerrors) + + ! close fapl and retrieve it from file + CALL h5pclose_f(fapl_id, hdferror) + CALL check("h5pclose_f", hdferror, nerrors) + CALL h5fget_access_plist_f(file_id, fapl_id, hdferror) + CALL check("h5fget_access_plist_f", hdferror, nerrors) + + ! verify settings for file access properties + + ! Collective metadata writes + CALL h5pget_coll_metadata_write_f(fapl_id, is_coll, hdferror) + CALL check("h5pget_coll_metadata_write_f", hdferror, nerrors) + IF(is_coll .NEQV. .TRUE.)THEN + PRINT*, "Incorrect property setting for coll metadata writes" + nerrors = nerrors + 1 + ENDIF + + ! Collective metadata read API calling requirement + CALL h5pget_all_coll_metadata_ops_f(fapl_id, is_coll, hdferror) + CALL check("h5pget_all_coll_metadata_ops_f", hdferror, nerrors) + IF(is_coll .NEQV. .TRUE.)THEN + PRINT*, "Incorrect property setting for coll metadata API calls requirement" + nerrors = nerrors + 1 + ENDIF + ELSE + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, hdferror, access_prp = fapl_id) + CALL check("h5fcreate_f", hdferror, nerrors) + ENDIF CALL h5screate_simple_f(1, dims, fspace_id, hdferror) CALL check("h5screate_simple_f", hdferror, nerrors) @@ -121,9 +174,9 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) CALL h5screate_simple_f(1, dims, mspace_id, hdferror) CALL check("h5screate_simple_f", hdferror, nerrors) - !////////////////////////////////////////////////////////// + ! ! modify dataset creation properties to enable chunking - !////////////////////////////////////////////////////////// + ! CALL h5pcreate_f(H5P_DATASET_CREATE_F, dcpl_id, hdferror) CALL check("h5pcreate_f", hdferror, nerrors) @@ -133,38 +186,38 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) CALL check("h5pset_chunk_f", hdferror, nerrors) ENDIF - !////////////////////////////////////////////////////////// + ! ! create the dataset - !////////////////////////////////////////////////////////// + ! CALL h5dcreate_f(file_id, "dset", H5T_NATIVE_INTEGER, fspace_id, dset_id, hdferror, dcpl_id) CALL check("h5dcreate_f", hdferror, nerrors) - !////////////////////////////////////////////////////////// + ! ! define hyperslab - !////////////////////////////////////////////////////////// + ! counti(1) = icount start(1) = istart - !////////////////////////////////////////////////////////// + ! ! select hyperslab in memory - !////////////////////////////////////////////////////////// + ! CALL h5sselect_hyperslab_f(mspace_id, H5S_SELECT_SET_F, start, counti, hdferror) CALL check("h5sselect_hyperslab_f", hdferror, nerrors) - !////////////////////////////////////////////////////////// + ! ! select hyperslab in the file - !////////////////////////////////////////////////////////// + ! CALL h5sselect_hyperslab_f(fspace_id, H5S_SELECT_SET_F, start, counti, hdferror) CALL check("h5sselect_hyperslab_f", hdferror, nerrors) - !////////////////////////////////////////////////////////// + ! ! create a property list for collective dataset write - !////////////////////////////////////////////////////////// + ! CALL h5pcreate_f(H5P_DATASET_XFER_F, dxpl_id, hdferror) CALL check("h5pcreate_f", hdferror, nerrors) @@ -174,9 +227,9 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) CALL check("h5pset_dxpl_mpio_f", hdferror, nerrors) ENDIF - !////////////////////////////////////////////////////////// + ! ! write dataset - !////////////////////////////////////////////////////////// + ! CALL h5dwrite_f(dset_id,H5T_NATIVE_INTEGER,wbuf,dims,hdferror,file_space_id=fspace_id,mem_space_id=mspace_id,xfer_prp=dxpl_id) CALL check("h5dwrite_f", hdferror, nerrors) @@ -200,9 +253,9 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) ENDIF ENDIF - !////////////////////////////////////////////////////////// + ! ! close HDF5 I/O - !////////////////////////////////////////////////////////// + ! CALL h5pclose_f(fapl_id, hdferror) CALL check("h5pclose_f", hdferror, nerrors) @@ -225,9 +278,9 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) CALL h5fclose_f(file_id, hdferror) CALL check("h5fclose_f", hdferror, nerrors) - !////////////////////////////////////////////////////////// + ! ! reopen file with read access - !////////////////////////////////////////////////////////// + ! CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl_id, hdferror) CALL check("h5pcreate_f", hdferror, nerrors) @@ -247,23 +300,23 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) CALL h5dopen_f(file_id, "dset", dset_id, hdferror) CALL check("h5pcreate_f", hdferror, nerrors) - !////////////////////////////////////////////////////////// + ! ! select hyperslab in memory - !////////////////////////////////////////////////////////// + ! CALL h5sselect_hyperslab_f(mspace_id, H5S_SELECT_SET_F, start, counti, hdferror) CALL check("h5pcreate_f", hdferror, nerrors) - !////////////////////////////////////////////////////////// + ! ! select hyperslab in the file - !////////////////////////////////////////////////////////// + ! CALL h5sselect_hyperslab_f(fspace_id, H5S_SELECT_SET_F, start, counti, hdferror) CALL check("h5pcreate_f", hdferror, nerrors) - !////////////////////////////////////////////////////////// + ! ! create a property list for collective dataset read - !////////////////////////////////////////////////////////// + ! CALL h5pcreate_f(H5P_DATASET_XFER_F, dxpl_id, hdferror) CALL check("h5pcreate_f", hdferror, nerrors) @@ -273,16 +326,16 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) CALL check("h5pcreate_f", hdferror, nerrors) ENDIF - !////////////////////////////////////////////////////////// + ! ! read dataset - !////////////////////////////////////////////////////////// + ! CALL h5dread_f(dset_id,H5T_NATIVE_INTEGER,rbuf,dims,hdferror,file_space_id=fspace_id,mem_space_id=mspace_id,xfer_prp=dxpl_id) CALL check("h5pcreate_f", hdferror, nerrors) - !////////////////////////////////////////////////////////// + ! ! close HDF5 I/O - !////////////////////////////////////////////////////////// + ! CALL h5pclose_f(fapl_id, hdferror) CALL check("h5pcreate_f", hdferror, nerrors) @@ -302,9 +355,9 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) CALL h5fclose_f(file_id, hdferror) CALL check("h5pcreate_f", hdferror, nerrors) - !////////////////////////////////////////////////////////// + ! ! compare read and write data. each process compares a subset of the array - !////////////////////////////////////////////////////////// + ! DO i = istart, iend-1 IF( wbuf(i) /= rbuf(i)) THEN diff --git a/fortran/testpar/ptest.f90 b/fortran/testpar/ptest.f90 index 69594b0..82dcc09 100644 --- a/fortran/testpar/ptest.f90 +++ b/fortran/testpar/ptest.f90 @@ -13,29 +13,35 @@ ! access to either file, you may request a copy from help@hdfgroup.org. * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -!////////////////////////////////////////////////////////// +! ! main program for parallel HDF5 Fortran tests -!////////////////////////////////////////////////////////// +! PROGRAM parallel_test USE hdf5 + USE MPI + USE TH5_MISC IMPLICIT NONE - INCLUDE 'mpif.h' INTEGER :: mpierror ! MPI hdferror flag INTEGER :: hdferror ! HDF hdferror flag - LOGICAL :: do_collective ! use collective MPI I/O - LOGICAL :: do_chunk ! use chunking - INTEGER :: nerrors = 0 ! number of errors + INTEGER :: ret_total_error = 0 ! number of errors in subroutine + INTEGER :: total_error = 0 ! sum of the number of errors INTEGER :: mpi_size ! number of processes in the group of communicator INTEGER :: mpi_rank ! rank of the calling process in the communicator INTEGER :: length = 12000 ! length of array - - !////////////////////////////////////////////////////////// + INTEGER :: i,j + ! use collective MPI I/O + LOGICAL, DIMENSION(1:2) :: do_collective = (/.FALSE.,.TRUE./) + CHARACTER(LEN=11), DIMENSION(1:2) :: chr_collective =(/"independent", "collective "/) + ! use chunking + LOGICAL, DIMENSION(1:2) :: do_chunk = (/.FALSE.,.TRUE./) + CHARACTER(LEN=10), DIMENSION(1:2) :: chr_chunk =(/"contiguous", "chunk "/) + + ! ! initialize MPI - !////////////////////////////////////////////////////////// - + ! CALL mpi_init(mpierror) IF (mpierror .NE. MPI_SUCCESS) THEN WRITE(*,*) "MPI_INIT *FAILED*" @@ -48,74 +54,40 @@ PROGRAM parallel_test IF (mpierror .NE. MPI_SUCCESS) THEN WRITE(*,*) "MPI_COMM_SIZE *FAILED* Process = ", mpi_rank ENDIF - !////////////////////////////////////////////////////////// + ! ! initialize the HDF5 fortran interface - !////////////////////////////////////////////////////////// - + ! CALL h5open_f(hdferror) - - !////////////////////////////////////////////////////////// - ! test write/read dataset by hyperslabs with independent MPI I/O - !////////////////////////////////////////////////////////// - - IF (mpi_rank == 0) WRITE(*,*) 'Writing/reading dataset by hyperslabs (contiguous layout, independent MPI I/O)' - - do_collective = .FALSE. - do_chunk = .FALSE. - CALL hyper(length, do_collective, do_chunk, mpi_size, mpi_rank, nerrors) - - !////////////////////////////////////////////////////////// - ! test write/read dataset by hyperslabs with collective MPI I/O - !////////////////////////////////////////////////////////// - - IF (mpi_rank == 0) WRITE(*,*) 'Writing/reading dataset by hyperslabs (contiguous layout, collective MPI I/O)' - - do_collective = .TRUE. - do_chunk = .FALSE. - CALL hyper(length, do_collective, do_chunk, mpi_size, mpi_rank, nerrors) - - !////////////////////////////////////////////////////////// - ! test write/read dataset by hyperslabs with independent MPI I/O - !////////////////////////////////////////////////////////// - - IF (mpi_rank == 0) WRITE(*,*) 'Writing/reading dataset by hyperslabs (chunk layout, independent MPI I/O)' - - do_collective = .FALSE. - do_chunk = .TRUE. - CALL hyper(length, do_collective, do_chunk, mpi_size, mpi_rank, nerrors) - - !////////////////////////////////////////////////////////// - ! test write/read dataset by hyperslabs with collective MPI I/O - !////////////////////////////////////////////////////////// - - IF (mpi_rank == 0) WRITE(*,*) 'Writing/reading dataset by hyperslabs (chunk layout, collective MPI I/O)' - - do_collective = .TRUE. - do_chunk = .TRUE. - CALL hyper(length, do_collective, do_chunk, mpi_size, mpi_rank, nerrors) - - !////////////////////////////////////////////////////////// + ! + ! test write/read dataset by hyperslabs (contiguous/chunk) with independent/collective MPI I/O + ! + DO i = 1, 2 + DO j = 1, 2 + ret_total_error = 0 + CALL hyper(length, do_collective(j), do_chunk(i), mpi_size, mpi_rank, ret_total_error) + IF(mpi_rank==0) CALL write_test_status(ret_total_error, & + "Writing/reading dataset by hyperslabs ("//TRIM(chr_chunk(i))//" layout, "//TRIM(chr_collective(j))//" MPI I/O)", & + total_error) + ENDDO + ENDDO + + ! ! test write/read several datasets (independent MPI I/O) - !////////////////////////////////////////////////////////// - - IF (mpi_rank == 0) WRITE(*,*) 'Writing/reading several datasets (contiguous layout, independent MPI I/O)' - - do_collective = .FALSE. - do_chunk = .FALSE. - CALL multiple_dset_write(length, do_collective, do_chunk, mpi_size, mpi_rank, nerrors) + ! + ret_total_error = 0 + CALL multiple_dset_write(length, do_collective(1), do_chunk(1), mpi_size, mpi_rank, ret_total_error) + IF(mpi_rank==0) CALL write_test_status(ret_total_error, & + 'Writing/reading several datasets (contiguous layout, independent MPI I/O)', total_error) - - !////////////////////////////////////////////////////////// + ! ! close HDF5 interface - !////////////////////////////////////////////////////////// - + ! CALL h5close_f(hdferror) - !////////////////////////////////////////////////////////// + ! ! close MPI - !////////////////////////////////////////////////////////// - - IF (nerrors == 0) THEN + ! + IF (total_error == 0) THEN CALL mpi_finalize(mpierror) IF (mpierror .NE. MPI_SUCCESS) THEN WRITE(*,*) "MPI_FINALIZE *FAILED* Process = ", mpi_rank @@ -127,10 +99,7 @@ PROGRAM parallel_test WRITE(*,*) "MPI_ABORT *FAILED* Process = ", mpi_rank ENDIF ENDIF - - !////////////////////////////////////////////////////////// + ! ! end main program - !////////////////////////////////////////////////////////// - + ! END PROGRAM parallel_test - -- cgit v0.12