From 3aa1a9ccecbd172147713a63d8acb554567260d4 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Thu, 21 Mar 2024 15:18:51 -0500 Subject: [PATCH 01/12] addressed issue wit promoted integers and reals --- HDF5Examples/FORTRAN/H5G/h5ex_g_traverse.F90 | 5 +- .../FORTRAN/H5PAR/ph5_f90_dataset.F90 | 7 +- .../FORTRAN/H5PAR/ph5_f90_file_create.F90 | 6 +- .../H5PAR/ph5_f90_filtered_writes_no_sel.F90 | 18 ++-- .../H5PAR/ph5_f90_hyperslab_by_chunk.F90 | 6 +- .../H5PAR/ph5_f90_hyperslab_by_col.F90 | 6 +- .../H5PAR/ph5_f90_hyperslab_by_pattern.F90 | 6 +- .../H5PAR/ph5_f90_hyperslab_by_row.F90 | 6 +- .../FORTRAN/H5PAR/ph5_f90_subfiling.F90 | 38 ++++---- HDF5Examples/FORTRAN/H5T/h5ex_t_enum_F03.F90 | 8 +- .../FORTRAN/H5T/h5ex_t_enumatt_F03.F90 | 7 +- config/cmake/HDF5UseFortran.cmake | 6 ++ fortran/src/H5Lff.F90 | 4 +- fortran/src/H5Pf.c | 26 ++--- fortran/src/H5Pff.F90 | 95 +++++++++++++------ fortran/src/H5Sf.c | 2 +- fortran/src/H5f90proto.h | 8 +- fortran/test/tH5A.F90 | 5 +- fortran/test/tH5L_F03.F90 | 2 +- fortran/test/tH5O_F03.F90 | 8 +- fortran/test/tH5T_F03.F90 | 10 +- fortran/testpar/async.F90 | 71 +++++++++----- fortran/testpar/hyper.F90 | 4 +- fortran/testpar/mdset.F90 | 4 +- fortran/testpar/mpi_param.F90 | 57 +++++------ fortran/testpar/multidsetrw.F90 | 5 +- fortran/testpar/ptest.F90 | 20 ++-- fortran/testpar/subfiling.F90 | 54 +++++++---- m4/aclocal_fc.m4 | 3 + 29 files changed, 294 insertions(+), 203 deletions(-) diff --git a/HDF5Examples/FORTRAN/H5G/h5ex_g_traverse.F90 b/HDF5Examples/FORTRAN/H5G/h5ex_g_traverse.F90 index 198d437003a..169a0044f74 100644 --- a/HDF5Examples/FORTRAN/H5G/h5ex_g_traverse.F90 +++ b/HDF5Examples/FORTRAN/H5G/h5ex_g_traverse.F90 @@ -84,8 +84,9 @@ RECURSIVE INTEGER(KIND=C_INT) FUNCTION op_func(loc_id, name, info, operator_data CHARACTER(LEN=10) :: space INTEGER :: spaces ! Number of whitespaces to prepend to output INTEGER :: len + INTEGER :: ret_val_func - ret_val = 0 + ret_val_func = 0 name_string(1:10) = " " len = 0 @@ -140,7 +141,7 @@ RECURSIVE INTEGER(KIND=C_INT) FUNCTION op_func(loc_id, name, info, operator_data ptr2 = C_LOC(nextod%recurs) funptr = C_FUNLOC(op_func) CALL h5literate_by_name_f(loc_id, name_string, H5_INDEX_NAME_F, H5_ITER_NATIVE_F, idx, & - funptr, ptr2, ret_val, status) + funptr, ptr2, ret_val_func, status) ENDIF WRITE(*,'(A)') space(1:spaces)//"}" diff --git a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_dataset.F90 b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_dataset.F90 index f7e4185411a..b5c43a88fa5 100644 --- a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_dataset.F90 +++ b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_dataset.F90 @@ -25,9 +25,10 @@ PROGRAM DATASET ! ! MPI definitions and calls. ! - INTEGER :: mpierror ! MPI error flag - INTEGER :: comm, info - INTEGER :: mpi_size, mpi_rank + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI error flag + INTEGER(KIND=MPI_INTEGER_KIND) :: comm, info + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_rank + comm = MPI_COMM_WORLD info = MPI_INFO_NULL CALL MPI_INIT(mpierror) diff --git a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_file_create.F90 b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_file_create.F90 index b5aa090e643..a6965a1f2a1 100644 --- a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_file_create.F90 +++ b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_file_create.F90 @@ -18,9 +18,9 @@ PROGRAM FILE_CREATE ! ! MPI definitions and calls. ! - INTEGER :: mpierror ! MPI error flag - INTEGER :: comm, info - INTEGER :: mpi_size, mpi_rank + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI error flag + INTEGER(KIND=MPI_INTEGER_KIND) :: comm, info + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_rank comm = MPI_COMM_WORLD info = MPI_INFO_NULL diff --git a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_filtered_writes_no_sel.F90 b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_filtered_writes_no_sel.F90 index ffec2fb54b2..4a34d1f2ed0 100644 --- a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_filtered_writes_no_sel.F90 +++ b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_filtered_writes_no_sel.F90 @@ -27,7 +27,7 @@ MODULE filter INTEGER , PARAMETER :: PATH_MAX = 512 ! Global variables - INTEGER :: mpi_rank, mpi_size + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_rank, mpi_size CONTAINS ! @@ -91,10 +91,11 @@ SUBROUTINE cleanup(filename) LOGICAL :: do_cleanup INTEGER :: status + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror CALL get_environment_variable("HDF5_NOCLEANUP", STATUS=status) IF(status.EQ.0)THEN - CALL MPI_File_delete(filename, MPI_INFO_NULL, status) + CALL MPI_File_delete(filename, MPI_INFO_NULL, mpierror) ENDIF END SUBROUTINE cleanup @@ -241,18 +242,19 @@ PROGRAM main USE filter IMPLICIT NONE - INTEGER :: comm = MPI_COMM_WORLD - INTEGER :: info = MPI_INFO_NULL + INTEGER(KIND=MPI_INTEGER_KIND) :: comm = MPI_COMM_WORLD + INTEGER(KIND=MPI_INTEGER_KIND) :: info = MPI_INFO_NULL INTEGER(hid_t) :: file_id INTEGER(hid_t) :: fapl_id INTEGER(hid_t) :: dxpl_id CHARACTER(LEN=PATH_MAX) :: par_prefix CHARACTER(LEN=PATH_MAX) :: filename INTEGER :: status + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror - CALL MPI_Init(status) - CALL MPI_Comm_size(comm, mpi_size, status) - CALL MPI_Comm_rank(comm, mpi_rank, status) + CALL MPI_Init(mpierror) + CALL MPI_Comm_size(comm, mpi_size, mpierror) + CALL MPI_Comm_rank(comm, mpi_rank, mpierror) ! ! Initialize HDF5 library and Fortran interfaces. @@ -349,6 +351,6 @@ PROGRAM main ! ------------------------------------ CALL cleanup(filename) - CALL MPI_Finalize(status) + CALL MPI_Finalize(mpierror) END PROGRAM main diff --git a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_chunk.F90 b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_chunk.F90 index 7be9389e77d..c4f67fee60c 100644 --- a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_chunk.F90 +++ b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_chunk.F90 @@ -34,9 +34,9 @@ PROGRAM DATASET_BY_CHUNK ! ! MPI definitions and calls. ! - INTEGER :: mpierror ! MPI error flag - INTEGER :: comm, info - INTEGER :: mpi_size, mpi_rank + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI error flag + INTEGER(KIND=MPI_INTEGER_KIND) :: comm, info + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_rank comm = MPI_COMM_WORLD info = MPI_INFO_NULL diff --git a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_col.F90 b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_col.F90 index c439d63829f..b7e0b25de16 100644 --- a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_col.F90 +++ b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_col.F90 @@ -30,9 +30,9 @@ PROGRAM DATASET_BY_COL ! ! MPI definitions and calls. ! - INTEGER :: mpierror ! MPI error flag - INTEGER :: comm, info - INTEGER :: mpi_size, mpi_rank + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI error flag + INTEGER(KIND=MPI_INTEGER_KIND) :: comm, info + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_rank comm = MPI_COMM_WORLD info = MPI_INFO_NULL CALL MPI_INIT(mpierror) diff --git a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_pattern.F90 b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_pattern.F90 index c7e8da13a7a..f94c8192d0c 100644 --- a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_pattern.F90 +++ b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_pattern.F90 @@ -36,9 +36,9 @@ PROGRAM DATASET_BY_PATTERN ! ! MPI definitions and calls. ! - INTEGER :: mpierror ! MPI error flag - INTEGER :: comm, info - INTEGER :: mpi_size, mpi_rank + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI error flag + INTEGER(KIND=MPI_INTEGER_KIND) :: comm, info + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_rank comm = MPI_COMM_WORLD info = MPI_INFO_NULL diff --git a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_row.F90 b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_row.F90 index 66d5b250258..f607b482561 100644 --- a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_row.F90 +++ b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_hyperslab_by_row.F90 @@ -35,9 +35,9 @@ PROGRAM DATASET_BY_ROW ! ! MPI definitions and calls. ! - INTEGER :: mpierror ! MPI error flag - INTEGER :: comm, info - INTEGER :: mpi_size, mpi_rank + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI error flag + INTEGER(KIND=MPI_INTEGER_KIND) :: comm, info + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_rank comm = MPI_COMM_WORLD info = MPI_INFO_NULL diff --git a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_subfiling.F90 b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_subfiling.F90 index fc30717e1b9..866200f3658 100644 --- a/HDF5Examples/FORTRAN/H5PAR/ph5_f90_subfiling.F90 +++ b/HDF5Examples/FORTRAN/H5PAR/ph5_f90_subfiling.F90 @@ -60,8 +60,8 @@ SUBROUTINE subfiling_write_default(fapl_id, mpi_size, mpi_rank) IMPLICIT NONE INTEGER(HID_T) :: fapl_id - INTEGER :: mpi_size - INTEGER :: mpi_rank + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_rank INTEGER, DIMENSION(:), ALLOCATABLE, TARGET :: wdata INTEGER(hsize_t), DIMENSION(1:EXAMPLE_DSET_DIMS) :: dset_dims @@ -171,8 +171,8 @@ SUBROUTINE subfiling_write_custom(fapl_id, mpi_size, mpi_rank) IMPLICIT NONE INTEGER(HID_T) :: fapl_id - INTEGER :: mpi_size - INTEGER :: mpi_rank + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_rank INTEGER, DIMENSION(:), ALLOCATABLE, TARGET :: wdata @@ -304,8 +304,8 @@ SUBROUTINE subfiling_write_precreate(fapl_id, mpi_size, mpi_rank) IMPLICIT NONE INTEGER(HID_T) :: fapl_id - INTEGER :: mpi_size - INTEGER :: mpi_rank + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_rank INTEGER, DIMENSION(:), ALLOCATABLE, TARGET :: wdata TYPE(H5FD_subfiling_config_t) :: subf_config @@ -320,6 +320,7 @@ SUBROUTINE subfiling_write_precreate(fapl_id, mpi_size, mpi_rank) INTEGER :: status INTEGER(SIZE_T) :: i TYPE(C_PTR) :: f_ptr + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! Make a copy of the FAPL so we don't disturb ! it for the other examples @@ -413,7 +414,7 @@ SUBROUTINE subfiling_write_precreate(fapl_id, mpi_size, mpi_rank) CALL H5Fclose_f(file_id, status) ENDIF - CALL MPI_Barrier(MPI_COMM_WORLD, status) + CALL MPI_Barrier(MPI_COMM_WORLD, mpierror) ! ! Use all MPI ranks to re-open the file and @@ -467,26 +468,27 @@ PROGRAM main USE SUBF IMPLICIT NONE - INTEGER :: comm = MPI_COMM_WORLD - INTEGER :: info = MPI_INFO_NULL + INTEGER(KIND=MPI_INTEGER_KIND) :: comm = MPI_COMM_WORLD + INTEGER(KIND=MPI_INTEGER_KIND) :: info = MPI_INFO_NULL INTEGER(HID_T) :: fapl_id - INTEGER :: mpi_size - INTEGER :: mpi_rank - INTEGER :: required - INTEGER :: provided + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_rank + INTEGER(KIND=MPI_INTEGER_KIND) :: required + INTEGER(KIND=MPI_INTEGER_KIND) :: provided + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror INTEGER :: status ! HDF5 Subfiling VFD requires MPI_Init_thread with MPI_THREAD_MULTIPLE required = MPI_THREAD_MULTIPLE provided = 0 - CALL mpi_init_thread(required, provided, status) + CALL mpi_init_thread(required, provided, mpierror) IF (provided .NE. required) THEN WRITE(*,*) "MPI doesn't support MPI_Init_thread with MPI_THREAD_MULTIPLE *FAILED*" - CALL MPI_Abort(comm, -1, status) + CALL MPI_Abort(comm, -1_MPI_INTEGER_KIND, mpierror) ENDIF - CALL MPI_Comm_size(comm, mpi_size, status) - CALL MPI_Comm_rank(comm, mpi_rank, status) + CALL MPI_Comm_size(comm, mpi_size, mpierror) + CALL MPI_Comm_rank(comm, mpi_rank, mpierror) ! ! Initialize HDF5 library and Fortran interfaces. @@ -516,6 +518,6 @@ PROGRAM main IF(mpi_rank .EQ. 0) WRITE(*,"(A)") "PHDF5 example finished with no errors" - CALL MPI_Finalize(status) + CALL MPI_Finalize(mpierror) END PROGRAM main diff --git a/HDF5Examples/FORTRAN/H5T/h5ex_t_enum_F03.F90 b/HDF5Examples/FORTRAN/H5T/h5ex_t_enum_F03.F90 index b0ba276dfb9..dd480738f4d 100644 --- a/HDF5Examples/FORTRAN/H5T/h5ex_t_enum_F03.F90 +++ b/HDF5Examples/FORTRAN/H5T/h5ex_t_enum_F03.F90 @@ -74,14 +74,14 @@ PROGRAM main ! Insert enumerated value for memtype. ! val = i - CALL h5tenum_insert_f(memtype, TRIM(names(i+1)), val, hdferr) + f_ptr = C_LOC(val) + CALL h5tenum_insert_f(memtype, TRIM(names(i+1)), f_ptr, hdferr) ! ! Insert enumerated value for filetype. We must first convert ! the numerical value val to the base type of the destination. ! - f_ptr = C_LOC(val) CALL h5tconvert_f (M_BASET, F_BASET, INT(1,SIZE_T), f_ptr, hdferr) - CALL h5tenum_insert_f(filetype, TRIM(names(i+1)), val, hdferr) + CALL h5tenum_insert_f(filetype, TRIM(names(i+1)), f_ptr, hdferr) ENDDO ! ! Create dataspace. Setting maximum size to be the current size. @@ -129,7 +129,7 @@ PROGRAM main ! ! Get the name of the enumeration member. ! - CALL h5tenum_nameof_f( memtype, rdata(i,j), NAME_BUF_SIZE, name, hdferr) + CALL h5tenum_nameof_f( memtype, INT(rdata(i,j)), NAME_BUF_SIZE, name, hdferr) WRITE(*,'(" ", A6," ")', ADVANCE='NO') TRIM(NAME) ENDDO WRITE(*,'("]")') diff --git a/HDF5Examples/FORTRAN/H5T/h5ex_t_enumatt_F03.F90 b/HDF5Examples/FORTRAN/H5T/h5ex_t_enumatt_F03.F90 index ec641b3ede6..13a289bd786 100644 --- a/HDF5Examples/FORTRAN/H5T/h5ex_t_enumatt_F03.F90 +++ b/HDF5Examples/FORTRAN/H5T/h5ex_t_enumatt_F03.F90 @@ -75,14 +75,15 @@ PROGRAM main ! Insert enumerated value for memtype. ! val = i - CALL h5tenum_insert_f(memtype, TRIM(names(i+1)), val, hdferr) + f_ptr = C_LOC(val) + CALL h5tenum_insert_f(memtype, TRIM(names(i+1)), f_ptr, hdferr) ! ! Insert enumerated value for filetype. We must first convert ! the numerical value val to the base type of the destination. ! f_ptr = C_LOC(val) CALL h5tconvert_f(M_BASET, F_BASET, INT(1,SIZE_T), f_ptr, hdferr) - CALL h5tenum_insert_f(filetype, TRIM(names(i+1)), val, hdferr) + CALL h5tenum_insert_f(filetype, TRIM(names(i+1)), f_ptr, hdferr) ENDDO ! ! Create dataspace with a null dataspace. @@ -137,7 +138,7 @@ PROGRAM main ! ! Get the name of the enumeration member. ! - CALL h5tenum_nameof_f( memtype, rdata(i,j), NAME_BUF_SIZE, name, hdferr) + CALL h5tenum_nameof_f( memtype, INT(rdata(i,j)), NAME_BUF_SIZE, name, hdferr) WRITE(*,'(" ",A6," ")', ADVANCE='NO') TRIM(NAME) ENDDO WRITE(*,'("]")') diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index 73b4f742b48..743da3d3560 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -50,9 +50,15 @@ macro (FORTRAN_RUN FUNCTION_NAME SOURCE_CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR1 else () set (_RUN_OUTPUT_VARIABLE "RUN_OUTPUT_STDOUT_VARIABLE") endif() + if (${FUNCTION_NAME} STREQUAL "SIZEOF NATIVE KINDs") + set(TMP_CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}") + else () + set(TMP_CMAKE_Fortran_FLAGS "") + endif () TRY_RUN (RUN_RESULT_VAR COMPILE_RESULT_VAR ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler1.f90 + CMAKE_FLAGS "${TMP_CMAKE_Fortran_FLAGS}" LINK_LIBRARIES "${HDF5_REQUIRED_LIBRARIES}" ${_RUN_OUTPUT_VARIABLE} OUTPUT_VAR ) diff --git a/fortran/src/H5Lff.F90 b/fortran/src/H5Lff.F90 index 004e5b23fdd..50a605a67db 100644 --- a/fortran/src/H5Lff.F90 +++ b/fortran/src/H5Lff.F90 @@ -1555,7 +1555,7 @@ INTEGER(C_INT) FUNCTION H5Lvisit(grp_id, idx_type, order, op, op_data) BIND(C, N END FUNCTION H5Lvisit END INTERFACE - return_value_c = INT(H5Lvisit(grp_id, INT(idx_type, C_INT), INT(order, C_INT), op, op_data)) + return_value_c = H5Lvisit(grp_id, INT(idx_type, C_INT), INT(order, C_INT), op, op_data) return_value = INT(return_value_c) IF(return_value.GE.0)THEN @@ -1624,7 +1624,7 @@ END FUNCTION H5Lvisit_by_name lapl_id_default = H5P_DEFAULT_F IF(PRESENT(lapl_id)) lapl_id_default = lapl_id - return_value_c = INT(H5Lvisit_by_name(loc_id, c_name, INT(idx_type, C_INT), INT(order, C_INT), op, op_data, lapl_id_default)) + return_value_c = H5Lvisit_by_name(loc_id, c_name, INT(idx_type, C_INT), INT(order, C_INT), op, op_data, lapl_id_default) return_value = INT(return_value_c) IF(return_value.GE.0)THEN diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index 87e6bfbebe6..17045a25570 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -2931,7 +2931,7 @@ h5pset_fapl_multi_c(hid_t_f *prp_id, int_f *memb_map, hid_t_f *memb_fapl, _fcd m * Check that we got correct values from Fortran for memb_addr array */ for (i = 0; i < H5FD_MEM_NTYPES; i++) { - if (memb_addr[i] >= 1.0f) + if (memb_addr[i] >= (real_f)1.0) return ret_value; } /* @@ -4598,7 +4598,7 @@ h5pget_file_image_c(hid_t_f *fapl_id, void **buf_ptr, size_t_f *buf_len_ptr) * SOURCE */ int_f -h5pset_fapl_mpio_c(hid_t_f *prp_id, int_f *comm, int_f *info) +h5pset_fapl_mpio_c(hid_t_f *prp_id, void *comm, void *info) /******/ { int ret_value = -1; @@ -4606,8 +4606,8 @@ h5pset_fapl_mpio_c(hid_t_f *prp_id, int_f *comm, int_f *info) herr_t ret; MPI_Comm c_comm; MPI_Info c_info; - c_comm = MPI_Comm_f2c(*comm); - c_info = MPI_Info_f2c(*info); + c_comm = MPI_Comm_f2c(*((int *)comm)); + c_info = MPI_Info_f2c(*((int *)info)); /* * Call H5Pset_mpi function. @@ -4633,7 +4633,7 @@ h5pset_fapl_mpio_c(hid_t_f *prp_id, int_f *comm, int_f *info) * SOURCE */ int_f -h5pget_fapl_mpio_c(hid_t_f *prp_id, int_f *comm, int_f *info) +h5pget_fapl_mpio_c(hid_t_f *prp_id, int *comm, int *info) /******/ { int ret_value = -1; @@ -4649,8 +4649,8 @@ h5pget_fapl_mpio_c(hid_t_f *prp_id, int_f *comm, int_f *info) ret = H5Pget_fapl_mpio(c_prp_id, &c_comm, &c_info); if (ret < 0) return ret_value; - *comm = (int_f)MPI_Comm_c2f(c_comm); - *info = (int_f)MPI_Info_c2f(c_info); + *comm = (int)MPI_Comm_c2f(c_comm); + *info = (int)MPI_Info_c2f(c_info); ret_value = 0; return ret_value; } @@ -4669,7 +4669,7 @@ h5pget_fapl_mpio_c(hid_t_f *prp_id, int_f *comm, int_f *info) * SOURCE */ int_f -h5pset_mpi_params_c(hid_t_f *prp_id, int_f *comm, int_f *info) +h5pset_mpi_params_c(hid_t_f *prp_id, void *comm, void *info) /******/ { int ret_value = -1; @@ -4677,8 +4677,8 @@ h5pset_mpi_params_c(hid_t_f *prp_id, int_f *comm, int_f *info) herr_t ret; MPI_Comm c_comm; MPI_Info c_info; - c_comm = MPI_Comm_f2c(*comm); - c_info = MPI_Info_f2c(*info); + c_comm = MPI_Comm_f2c(*((int *)comm)); + c_info = MPI_Info_f2c(*((int *)info)); /* * Call H5Pset_mpi_params. @@ -4705,7 +4705,7 @@ h5pset_mpi_params_c(hid_t_f *prp_id, int_f *comm, int_f *info) * SOURCE */ int_f -h5pget_mpi_params_c(hid_t_f *prp_id, int_f *comm, int_f *info) +h5pget_mpi_params_c(hid_t_f *prp_id, int *comm, int *info) /******/ { int ret_value = -1; @@ -4721,8 +4721,8 @@ h5pget_mpi_params_c(hid_t_f *prp_id, int_f *comm, int_f *info) ret = H5Pget_mpi_params(c_prp_id, &c_comm, &c_info); if (ret < 0) return ret_value; - *comm = (int_f)MPI_Comm_c2f(c_comm); - *info = (int_f)MPI_Info_c2f(c_info); + *comm = (int)MPI_Comm_c2f(c_comm); + *info = (int)MPI_Info_c2f(c_info); ret_value = 0; return ret_value; } diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index ab6765a8874..f5e50c90383 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -39,6 +39,13 @@ MODULE H5P +#ifdef H5_HAVE_PARALLEL +#ifdef H5_HAVE_MPI_F08 + USE MPI_F08, ONLY : MPI_INTEGER_KIND +#else + USE MPI, ONLY : MPI_INTEGER_KIND +#endif +#endif USE H5GLOBAL USE H5fortkit @@ -50,6 +57,7 @@ MODULE H5P PRIVATE h5pregister_integer, h5pregister_ptr PRIVATE h5pinsert_integer, h5pinsert_char, h5pinsert_ptr #ifdef H5_HAVE_PARALLEL + PRIVATE MPI_INTEGER_KIND PRIVATE h5pset_fapl_mpio_f90, h5pget_fapl_mpio_f90 #ifdef H5_HAVE_MPI_F08 PRIVATE h5pset_fapl_mpio_f08, h5pget_fapl_mpio_f08 @@ -5182,8 +5190,8 @@ END SUBROUTINE h5pget_file_image_f SUBROUTINE h5pset_fapl_mpio_f(prp_id, comm, info, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(IN) :: info + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(IN) :: comm + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(IN) :: info INTEGER, INTENT(OUT) :: hdferr END SUBROUTINE h5pset_fapl_mpio_f !> @@ -5213,17 +5221,17 @@ END SUBROUTINE h5pset_fapl_mpio_f SUBROUTINE h5pset_fapl_mpio_f90(prp_id, comm, info, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(IN) :: info + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(IN) :: comm + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(IN) :: info INTEGER, INTENT(OUT) :: hdferr INTERFACE INTEGER FUNCTION h5pset_fapl_mpio_c(prp_id, comm, info) & BIND(C,NAME='h5pset_fapl_mpio_c') - IMPORT :: HID_T + IMPORT :: HID_T, MPI_INTEGER_KIND IMPLICIT NONE INTEGER(HID_T) :: prp_id - INTEGER :: comm - INTEGER :: info + INTEGER(KIND=MPI_INTEGER_KIND) :: comm + INTEGER(KIND=MPI_INTEGER_KIND) :: info END FUNCTION h5pset_fapl_mpio_c END INTERFACE @@ -5240,7 +5248,7 @@ SUBROUTINE h5pset_fapl_mpio_f08(prp_id, comm, info, hdferr) TYPE(MPI_INFO), INTENT(IN) :: info INTEGER, INTENT(OUT) :: hdferr - CALL h5pset_fapl_mpio_f90(prp_id, comm%mpi_val, info%mpi_val, hdferr) + CALL h5pset_fapl_mpio_f90(prp_id, INT(comm%mpi_val,MPI_INTEGER_KIND), INT(info%mpi_val,MPI_INTEGER_KIND), hdferr) END SUBROUTINE h5pset_fapl_mpio_f08 #endif @@ -5298,21 +5306,28 @@ END SUBROUTINE h5pget_fapl_mpio_f SUBROUTINE h5pget_fapl_mpio_f90(prp_id, comm, info, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id - INTEGER, INTENT(OUT) :: comm - INTEGER, INTENT(OUT) :: info + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(OUT) :: comm + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(OUT) :: info INTEGER, INTENT(OUT) :: hdferr + + INTEGER(KIND=C_INT) :: c_comm + INTEGER(KIND=C_INT) :: c_info + INTERFACE INTEGER FUNCTION h5pget_fapl_mpio_c(prp_id, comm, info) & BIND(C,NAME='h5pget_fapl_mpio_c') - IMPORT :: HID_T + IMPORT :: HID_T, C_INT IMPLICIT NONE INTEGER(HID_T) :: prp_id - INTEGER :: comm - INTEGER :: info + INTEGER(KIND=C_INT) :: comm + INTEGER(KIND=C_INT) :: info END FUNCTION h5pget_fapl_mpio_c END INTERFACE - hdferr = h5pget_fapl_mpio_c(prp_id, comm, info) + hdferr = h5pget_fapl_mpio_c(prp_id, c_comm, c_info) + + comm = INT(c_comm,KIND=MPI_INTEGER_KIND) + info = INT(c_info,KIND=MPI_INTEGER_KIND) END SUBROUTINE h5pget_fapl_mpio_f90 @@ -5325,7 +5340,13 @@ SUBROUTINE h5pget_fapl_mpio_f08(prp_id, comm, info, hdferr) TYPE(MPI_INFO), INTENT(OUT) :: info INTEGER, INTENT(OUT) :: hdferr - CALL h5pget_fapl_mpio_f90(prp_id, comm%mpi_val, info%mpi_val, hdferr) + INTEGER(KIND=MPI_INTEGER_KIND) :: tmp_comm + INTEGER(KIND=MPI_INTEGER_KIND) :: tmp_info + + CALL h5pget_fapl_mpio_f90(prp_id, tmp_comm, tmp_info, hdferr) + + comm%mpi_val = tmp_comm + info%mpi_val = tmp_info END SUBROUTINE h5pget_fapl_mpio_f08 #endif @@ -5532,8 +5553,8 @@ END SUBROUTINE h5pget_mpio_no_collective_cause_f SUBROUTINE H5Pset_mpi_params_f(prp_id, comm, info, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id - INTEGER , INTENT(IN) :: comm - INTEGER , INTENT(IN) :: info + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(IN) :: comm + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(IN) :: info INTEGER , INTENT(OUT) :: hdferr END SUBROUTINE H5Pset_mpi_params_f !> @@ -5563,18 +5584,18 @@ END SUBROUTINE H5Pset_mpi_params_f SUBROUTINE H5Pset_mpi_params_f90(prp_id, comm, info, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id - INTEGER , INTENT(IN) :: comm - INTEGER , INTENT(IN) :: info + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(IN) :: comm + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(IN) :: info INTEGER , INTENT(OUT) :: hdferr INTERFACE INTEGER FUNCTION h5pset_mpi_params_c(prp_id, comm, info) & BIND(C,NAME='h5pset_mpi_params_c') - IMPORT :: HID_T + IMPORT :: HID_T, MPI_INTEGER_KIND IMPLICIT NONE INTEGER(HID_T) :: prp_id - INTEGER :: comm - INTEGER :: info + INTEGER(KIND=MPI_INTEGER_KIND) :: comm + INTEGER(KIND=MPI_INTEGER_KIND) :: info END FUNCTION H5pset_mpi_params_c END INTERFACE @@ -5614,8 +5635,8 @@ END SUBROUTINE H5Pset_mpi_params_f08 SUBROUTINE H5Pget_mpi_params_f(prp_id, comm, info, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id - INTEGER , INTENT(OUT) :: comm - INTEGER , INTENT(OUT) :: info + INTEGER, INTENT(OUT) :: comm + INTEGER, INTENT(OUT) :: info INTEGER , INTENT(OUT) :: hdferr END SUBROUTINE H5Pget_mpi_params_f !> @@ -5647,22 +5668,28 @@ END SUBROUTINE H5Pget_mpi_params_f SUBROUTINE H5Pget_mpi_params_f90(prp_id, comm, info, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id - INTEGER , INTENT(OUT) :: comm - INTEGER , INTENT(OUT) :: info + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(OUT) :: comm + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(OUT) :: info INTEGER , INTENT(OUT) :: hdferr + INTEGER(KIND=C_INT) :: c_comm + INTEGER(KIND=C_INT) :: c_info + INTERFACE INTEGER FUNCTION h5pget_mpi_params_c(prp_id, comm, info) & BIND(C,NAME='h5pget_mpi_params_c') - IMPORT :: HID_T + IMPORT :: HID_T, C_INT IMPLICIT NONE INTEGER(HID_T) :: prp_id - INTEGER :: comm - INTEGER :: info + INTEGER(KIND=C_INT) :: comm + INTEGER(KIND=C_INT) :: info END FUNCTION H5pget_mpi_params_c END INTERFACE - hdferr = H5Pget_mpi_params_c(prp_id, comm, info) + hdferr = H5Pget_mpi_params_c(prp_id, c_comm, c_info) + + comm = INT(c_comm,KIND=MPI_INTEGER_KIND) + info = INT(c_info,KIND=MPI_INTEGER_KIND) END SUBROUTINE H5Pget_mpi_params_f90 @@ -5675,7 +5702,13 @@ SUBROUTINE H5Pget_mpi_params_f08(prp_id, comm, info, hdferr) TYPE(MPI_INFO), INTENT(OUT) :: info INTEGER , INTENT(OUT) :: hdferr - CALL H5Pget_mpi_params_f90(prp_id, comm%mpi_val, info%mpi_val, hdferr) + INTEGER(KIND=MPI_INTEGER_KIND) :: tmp_comm + INTEGER(KIND=MPI_INTEGER_KIND) :: tmp_info + + CALL H5Pget_mpi_params_f90(prp_id, tmp_comm, tmp_info, hdferr) + + comm%mpi_val = tmp_comm + info%mpi_val = tmp_info END SUBROUTINE H5Pget_mpi_params_f08 #endif diff --git a/fortran/src/H5Sf.c b/fortran/src/H5Sf.c index 41616f81dff..22130fc9bd8 100644 --- a/fortran/src/H5Sf.c +++ b/fortran/src/H5Sf.c @@ -55,7 +55,7 @@ h5screate_simple_c(int_f *rank, hsize_t_f *dims, hsize_t_f *maxdims, hid_t_f *sp c_maxdims[i] = maxdims[*rank - i - 1]; } /* end for */ - c_space_id = H5Screate_simple(*rank, c_dims, c_maxdims); + c_space_id = H5Screate_simple((int)*rank, c_dims, c_maxdims); if (c_space_id < 0) HGOTO_DONE(FAIL); diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index 0da371f5e17..2ab3a8a6f4f 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -518,10 +518,10 @@ H5_FCDLL int_f h5pget_chunk_cache_c(hid_t_f *dapl_id, size_t_f *rdcc_nslots, siz real_f *rdcc_w0); #ifdef H5_HAVE_PARALLEL H5_FCDLL int_f h5pget_mpio_actual_io_mode_c(hid_t_f *dxpl_id, int_f *actual_io_mode); -H5_FCDLL int_f h5pget_fapl_mpio_c(hid_t_f *prp_id, int_f *comm, int_f *info); -H5_FCDLL int_f h5pset_fapl_mpio_c(hid_t_f *prp_id, int_f *comm, int_f *info); -H5_FCDLL int_f h5pget_mpi_params_c(hid_t_f *prp_id, int_f *comm, int_f *info); -H5_FCDLL int_f h5pset_mpi_params_c(hid_t_f *prp_id, int_f *comm, int_f *info); +H5_FCDLL int_f h5pget_fapl_mpio_c(hid_t_f *prp_id, int *comm, int *info); +H5_FCDLL int_f h5pset_fapl_mpio_c(hid_t_f *prp_id, void *comm, void *info); +H5_FCDLL int_f h5pget_mpi_params_c(hid_t_f *prp_id, int *comm, int *info); +H5_FCDLL int_f h5pset_mpi_params_c(hid_t_f *prp_id, void *comm, void *info); H5_FCDLL int_f h5pget_dxpl_mpio_c(hid_t_f *prp_id, int_f *data_xfer_mode); H5_FCDLL int_f h5pset_dxpl_mpio_c(hid_t_f *prp_id, int_f *data_xfer_mode); #endif diff --git a/fortran/test/tH5A.F90 b/fortran/test/tH5A.F90 index 23b1addd3ce..ff7ee60053e 100644 --- a/fortran/test/tH5A.F90 +++ b/fortran/test/tH5A.F90 @@ -100,12 +100,11 @@ SUBROUTINE attribute_test(cleanup, total_error) CHARACTER(LEN=35), DIMENSION(2) :: aread_data ! Buffer to put read back ! string attr data CHARACTER :: attr_character_data = 'A' - REAL(KIND=Fortran_DOUBLE), DIMENSION(1) :: attr_double_data = 3.459D0 + REAL(KIND=Fortran_DOUBLE), DIMENSION(1) :: attr_double_data = 3.459_Fortran_DOUBLE REAL, DIMENSION(1) :: attr_real_data = 4.0 INTEGER, DIMENSION(1) :: attr_integer_data = 5 INTEGER(HSIZE_T), DIMENSION(7) :: data_dims - CHARACTER :: aread_character_data ! variable to put read back Character attr data INTEGER, DIMENSION(1) :: aread_integer_data ! variable to put read back integer attr data INTEGER, DIMENSION(1) :: aread_null_data = 7 ! variable to put read back null attr data @@ -577,8 +576,6 @@ SUBROUTINE attribute_test(cleanup, total_error) total_error = total_error +1 END IF - - CALL h5sclose_f(attr_space, error) CALL check("h5sclose_f",error,total_error) CALL h5sclose_f(attr2_space, error) diff --git a/fortran/test/tH5L_F03.F90 b/fortran/test/tH5L_F03.F90 index a8345c3ca58..a4ece4d7fe4 100644 --- a/fortran/test/tH5L_F03.F90 +++ b/fortran/test/tH5L_F03.F90 @@ -162,7 +162,7 @@ INTEGER(KIND=C_INT) FUNCTION lvisit_cb(group, name, link_info, op_data) bind(C) INTEGER :: nlen, i, istart, iend - op_data%n_obj = op_data%n_obj + 1 + op_data%n_obj = op_data%n_obj + 1_C_INT nlen = 1 DO i = 1, MAX_CHAR_LEN diff --git a/fortran/test/tH5O_F03.F90 b/fortran/test/tH5O_F03.F90 index a4cf282ecca..f9cad325f3b 100644 --- a/fortran/test/tH5O_F03.F90 +++ b/fortran/test/tH5O_F03.F90 @@ -118,10 +118,10 @@ INTEGER FUNCTION compare_h5o_info_t( loc_id, oinfo_f, oinfo_c, field, full_f_fie IF((field .EQ. H5O_INFO_TIME_F).OR.(field .EQ. H5O_INFO_ALL_F))THEN - atime(1:8) = h5gmtime(oinfo_c%atime) - btime(1:8) = h5gmtime(oinfo_c%btime) - ctime(1:8) = h5gmtime(oinfo_c%ctime) - mtime(1:8) = h5gmtime(oinfo_c%mtime) + atime(1:8) = INT(h5gmtime(oinfo_c%atime),C_INT) + btime(1:8) = INT(h5gmtime(oinfo_c%btime),C_INT) + ctime(1:8) = INT(h5gmtime(oinfo_c%ctime),C_INT) + mtime(1:8) = INT(h5gmtime(oinfo_c%mtime),C_INT) DO i = 1, 8 IF( (atime(i) .NE. oinfo_f%atime(i)) )THEN diff --git a/fortran/test/tH5T_F03.F90 b/fortran/test/tH5T_F03.F90 index 65804d0d091..a59cd73f751 100644 --- a/fortran/test/tH5T_F03.F90 +++ b/fortran/test/tH5T_F03.F90 @@ -709,8 +709,8 @@ SUBROUTINE test_array_bkg(total_error) DO i = 1, LENGTH DO j = 1, ALEN cf(i)%a(j) = 100*(i+1) + j - cf(i)%b(j) = (100.*(i+1) + 0.01*j) - cf(i)%c(j) = 100.*(i+1) + 0.02*j + cf(i)%b(j) = (100._sp*REAL(i+1,sp) + 0.01_sp*REAL(j,sp)) + cf(i)%c(j) = 100._dp*REAL(i+1,dp) + 0.02_dp*REAL(j,dp) ENDDO ENDDO @@ -855,7 +855,7 @@ SUBROUTINE test_array_bkg(total_error) ! -------------------------------- DO i = 1, LENGTH DO j = 1, ALEN - fld(i)%b(j) = 1.313 + fld(i)%b(j) = 1.313_sp cf(i)%b(j) = fld(i)%b(j) ENDDO ENDDO @@ -2930,8 +2930,8 @@ SUBROUTINE test_nbit(total_error ) ! dataset datatype (no precision loss during datatype conversion) ! REAL(kind=wp), DIMENSION(1:2,1:5), TARGET :: orig_data = & - RESHAPE( (/188384.00, 19.103516, -1.0831790e9, -84.242188, & - 5.2045898, -49140.000, 2350.2500, -3.2110596e-1, 6.4998865e-5, -0.0000000/) , (/2,5/) ) + RESHAPE( (/188384.00_wp, 19.103516_wp, -1.0831790e9_wp, -84.242188_wp, & + 5.2045898_wp, -49140.000_wp, 2350.2500_wp, -3.2110596e-1_wp, 6.4998865e-5_wp, -0.0000000_wp/) , (/2,5/) ) REAL(kind=wp), DIMENSION(1:2,1:5), TARGET :: new_data INTEGER(size_t) :: PRECISION, offset INTEGER :: error diff --git a/fortran/testpar/async.F90 b/fortran/testpar/async.F90 index 5c7411f6ddb..16c65cf616e 100644 --- a/fortran/testpar/async.F90 +++ b/fortran/testpar/async.F90 @@ -13,8 +13,16 @@ ! Tests async Fortran wrappers. It needs an async VOL. It will skip the tests if ! HDF5_VOL_CONNECTOR is not set or is set to a non-supporting async VOL. ! +#include + MODULE test_async_APIs +#ifdef H5_HAVE_PARALLEL +#ifdef H5_HAVE_MPI_F08 +! USE MPI_F08 +#else +#endif +#endif USE MPI USE HDF5 USE TH5_MISC @@ -40,6 +48,8 @@ MODULE test_async_APIs CHARACTER(LEN=10), TARGET :: app_func = "func_name"//C_NULL_CHAR INTEGER :: app_line = 42 + INTEGER :: mpi_ikind = MPI_INTEGER_KIND + CONTAINS INTEGER(KIND=C_INT) FUNCTION liter_cb(group, name, link_info, op_data) bind(C) @@ -60,7 +70,7 @@ INTEGER(KIND=C_INT) FUNCTION liter_cb(group, name, link_info, op_data) bind(C) CASE(0) liter_cb = 0 CASE(2) - liter_cb = op_data%command*10 + liter_cb = op_data%command*10_C_INT END SELECT op_data%command = op_data_command op_data%type = op_data_type @@ -381,9 +391,10 @@ SUBROUTINE H5D_async_tests(cleanup, total_error) INTEGER, TARGET :: fillvalue = 99 INTEGER :: error ! Error flags - INTEGER :: mpierror ! MPI error flag - INTEGER :: comm, info - INTEGER :: mpi_size, mpi_rank + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI error flag + INTEGER(KIND=MPI_INTEGER_KIND) :: comm + INTEGER(KIND=MPI_INTEGER_KIND) :: info + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_rank comm = MPI_COMM_WORLD info = MPI_INFO_NULL @@ -399,7 +410,7 @@ SUBROUTINE H5D_async_tests(cleanup, total_error) CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl_id, hdferror) CALL check("h5pcreate_f", hdferror, total_error) - CALL h5pset_fapl_mpio_f(fapl_id, MPI_COMM_WORLD, MPI_INFO_NULL, hdferror) + CALL h5pset_fapl_mpio_f(fapl_id, comm, info, hdferror) CALL check("h5pset_fapl_mpio_f", hdferror, total_error) CALL h5fcreate_async_f(filename, H5F_ACC_TRUNC_F, file_id, es_id, error, access_prp = fapl_id ) @@ -581,9 +592,10 @@ SUBROUTINE H5G_async_tests(cleanup, total_error) TYPE(H5G_info_t), DIMENSION(1:3) :: ginfo INTEGER :: error - INTEGER :: mpierror ! MPI error flag - INTEGER :: comm, info - INTEGER :: mpi_size, mpi_rank + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI error flag + INTEGER(KIND=MPI_INTEGER_KIND) :: comm + INTEGER(KIND=MPI_INTEGER_KIND) :: info + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_rank comm = MPI_COMM_WORLD info = MPI_INFO_NULL @@ -709,9 +721,9 @@ SUBROUTINE H5F_async_tests(cleanup, total_error) INTEGER(HID_T) :: ret_file_id INTEGER :: error ! Error flags - INTEGER :: mpierror ! MPI error flag - INTEGER :: comm, info - INTEGER :: mpi_size, mpi_rank + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI error flag + INTEGER(KIND=MPI_INTEGER_KIND) :: comm, info + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_rank comm = MPI_COMM_WORLD info = MPI_INFO_NULL @@ -812,12 +824,12 @@ SUBROUTINE H5L_async_tests(cleanup, total_error) TYPE(iter_info), TARGET :: info TYPE(C_FUNPTR) :: f1 TYPE(C_PTR) :: f2 - INTEGER(C_INT) :: ret_value + INTEGER :: ret_value INTEGER :: error ! Error flags - INTEGER :: mpierror ! MPI error flag - INTEGER :: comm - INTEGER :: mpi_size, mpi_rank + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI error flag + INTEGER(KIND=MPI_INTEGER_KIND) :: comm + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_rank INTEGER(SIZE_T) :: count @@ -1211,10 +1223,10 @@ SUBROUTINE H5O_async_tests(cleanup, total_error) CALL check("H5Oget_info_by_name_async_f", hdferror, total_error) ENDIF - atime(1:8) = h5gmtime(oinfo_f%atime) - btime(1:8) = h5gmtime(oinfo_f%btime) - ctime(1:8) = h5gmtime(oinfo_f%ctime) - mtime(1:8) = h5gmtime(oinfo_f%mtime) + atime(1:8) = INT(h5gmtime(oinfo_f%atime),C_INT) + btime(1:8) = INT(h5gmtime(oinfo_f%btime),C_INT) + ctime(1:8) = INT(h5gmtime(oinfo_f%ctime),C_INT) + mtime(1:8) = INT(h5gmtime(oinfo_f%mtime),C_INT) IF( atime(1) .LT. 2021 .OR. & btime(1).LT. 2021 .OR. & @@ -1244,10 +1256,11 @@ PROGRAM async_test IMPLICIT NONE INTEGER :: total_error = 0 ! sum of the number of errors - INTEGER :: mpierror ! MPI hdferror flag - INTEGER :: mpi_size ! number of processes in the group of communicator - INTEGER :: mpi_rank ! rank of the calling process in the communicator - INTEGER :: required, provided + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI hdferror flag + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size ! number of processes in the group of communicator + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_rank ! rank of the calling process in the communicator + INTEGER(KIND=MPI_INTEGER_KIND) :: required, provided + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_int_type INTEGER(HID_T) :: vol_id INTEGER :: hdferror @@ -1290,7 +1303,7 @@ PROGRAM async_test IF(mpi_rank==0) CALL write_test_status(sum, & 'Testing Initializing mpi_init_thread', total_error) CALL MPI_Barrier(MPI_COMM_WORLD, mpierror) - CALL mpi_abort(MPI_COMM_WORLD, 1, mpierror) + CALL mpi_abort(MPI_COMM_WORLD, 1_MPI_INTEGER_KIND, mpierror) ENDIF IF(mpi_rank==0) CALL write_test_header("ASYNC FORTRAN TESTING") @@ -1408,7 +1421,13 @@ PROGRAM async_test ! CALL h5close_f(hdferror) - CALL MPI_ALLREDUCE(total_error, sum, 1, MPI_INTEGER, MPI_SUM, MPI_COMM_WORLD, mpierror) + IF(h5_sizeof(total_error).EQ.8_size_t)THEN + mpi_int_type=MPI_INTEGER8 + ELSE + mpi_int_type=MPI_INTEGER4 + ENDIF + + CALL MPI_ALLREDUCE(total_error, sum, 1_MPI_INTEGER_KIND, mpi_int_type, MPI_SUM, MPI_COMM_WORLD, mpierror) IF(mpi_rank==0) CALL write_test_footer() @@ -1422,7 +1441,7 @@ PROGRAM async_test ENDIF ELSE WRITE(*,*) 'Errors detected in process ', mpi_rank - CALL mpi_abort(MPI_COMM_WORLD, 1, mpierror) + CALL mpi_abort(MPI_COMM_WORLD, 1_MPI_INTEGER_KIND, mpierror) IF (mpierror .NE. MPI_SUCCESS) THEN WRITE(*,*) "MPI_ABORT *FAILED* Process = ", mpi_rank ENDIF diff --git a/fortran/testpar/hyper.F90 b/fortran/testpar/hyper.F90 index ec3a657afbb..61a3e260797 100644 --- a/fortran/testpar/hyper.F90 +++ b/fortran/testpar/hyper.F90 @@ -25,8 +25,8 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) INTEGER, INTENT(in) :: length ! array length LOGICAL, INTENT(in) :: do_collective ! use collective I/O LOGICAL, INTENT(in) :: do_chunk ! use chunking - INTEGER, INTENT(in) :: mpi_size ! number of processes in the group of communicator - INTEGER, INTENT(in) :: mpi_rank ! rank of the calling process in the communicator + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(in) :: mpi_size ! number of processes in the group of communicator + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(in) :: mpi_rank ! rank of the calling process in the communicator INTEGER, INTENT(inout) :: nerrors ! number of errors INTEGER :: hdferror ! HDF hdferror flag INTEGER(hsize_t), DIMENSION(1) :: dims ! dataset dimensions diff --git a/fortran/testpar/mdset.F90 b/fortran/testpar/mdset.F90 index 6757f4d7491..95e401137e6 100644 --- a/fortran/testpar/mdset.F90 +++ b/fortran/testpar/mdset.F90 @@ -25,8 +25,8 @@ SUBROUTINE multiple_dset_write(length, do_collective, do_chunk, mpi_size, mpi_ra INTEGER, INTENT(in) :: length ! array length LOGICAL, INTENT(in) :: do_collective ! use collective I/O LOGICAL, INTENT(in) :: do_chunk ! use chunking - INTEGER, INTENT(in) :: mpi_size ! number of processes in the group of communicator - INTEGER, INTENT(in) :: mpi_rank ! rank of the calling process in the communicator + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(in) :: mpi_size ! number of processes in the group of communicator + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(in) :: mpi_rank ! rank of the calling process in the communicator INTEGER, INTENT(inout) :: nerrors ! number of errors INTEGER :: hdferror ! HDF hdferror flag INTEGER(hsize_t), DIMENSION(1) :: dims ! dataset dimensions diff --git a/fortran/testpar/mpi_param.F90 b/fortran/testpar/mpi_param.F90 index ba4eaaae963..a57a4c57edd 100644 --- a/fortran/testpar/mpi_param.F90 +++ b/fortran/testpar/mpi_param.F90 @@ -24,18 +24,20 @@ SUBROUTINE mpi_param_03(nerrors) USE TH5_MISC_GEN IMPLICIT NONE + INTEGER, INTENT(inout) :: nerrors ! number of errors + INTEGER, PARAMETER :: logical_kind = MPI_INTEGER_KIND INTEGER :: hdferror ! HDF hdferror flag INTEGER(hid_t) :: fapl_id ! file access identifier - INTEGER :: mpi_size, mpi_size_ret ! number of processes in the group of communicator - INTEGER :: mpierror ! MPI hdferror flag - INTEGER :: mpi_rank ! rank of the calling process in the communicator - - INTEGER :: info, info_ret - INTEGER :: comm, comm_ret - INTEGER :: nkeys - LOGICAL :: flag + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_size_ret ! number of processes in the group of communicator + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI hdferror flag + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_rank ! rank of the calling process in the communicator + + INTEGER(KIND=MPI_INTEGER_KIND) :: info, info_ret + INTEGER(KIND=MPI_INTEGER_KIND) :: comm, comm_ret + INTEGER(KIND=MPI_INTEGER_KIND) :: nkeys + LOGICAL(KIND=logical_kind) :: flag INTEGER :: iconfig CHARACTER(LEN=4) , PARAMETER :: in_key="host" CHARACTER(LEN=10), PARAMETER :: in_value="myhost.org" @@ -62,13 +64,13 @@ SUBROUTINE mpi_param_03(nerrors) ! Split the communicator IF(mpi_rank.EQ.0)THEN - CALL MPI_Comm_split(MPI_COMM_WORLD, 1, mpi_rank, comm, mpierror) + CALL MPI_Comm_split(MPI_COMM_WORLD, 1_MPI_INTEGER_KIND, mpi_rank, comm, mpierror) IF (mpierror .NE. MPI_SUCCESS) THEN WRITE(*,*) "MPI_COMM_SPLIT *FAILED* Process = ", mpi_rank nerrors = nerrors + 1 ENDIF ELSE - CALL MPI_Comm_split(MPI_COMM_WORLD, 0, mpi_rank, comm, mpierror) + CALL MPI_Comm_split(MPI_COMM_WORLD, 0_MPI_INTEGER_KIND, mpi_rank, comm, mpierror) IF (mpierror .NE. MPI_SUCCESS) THEN WRITE(*,*) "MPI_COMM_SPLIT *FAILED* Process = ", mpi_rank nerrors = nerrors + 1 @@ -111,9 +113,9 @@ SUBROUTINE mpi_param_03(nerrors) nerrors = nerrors + 1 ENDIF IF (mpi_rank.EQ.0)THEN - CALL VERIFY("h5pget_fapl_mpio_f", mpi_size_ret, 1, hdferror) + CALL VERIFY("h5pget_fapl_mpio_f", mpi_size_ret, 1_MPI_INTEGER_KIND, hdferror) ELSE - CALL VERIFY("h5pget_fapl_mpio_f", mpi_size_ret, mpi_size-1, hdferror) + CALL VERIFY("h5pget_fapl_mpio_f", mpi_size_ret, INT(mpi_size-1,MPI_INTEGER_KIND), hdferror) ENDIF ! Check info returned @@ -122,9 +124,9 @@ SUBROUTINE mpi_param_03(nerrors) WRITE(*,*) "MPI_INFO_GET_NKEYS *FAILED* Process = ", mpi_rank nerrors = nerrors + 1 ENDIF - CALL VERIFY("h5pget_fapl_mpio_f", nkeys, 1, hdferror) + CALL VERIFY("h5pget_fapl_mpio_f", nkeys, 1_MPI_INTEGER_KIND, hdferror) - CALL MPI_Info_get_nthkey(info_ret, 0, key, mpierror) + CALL MPI_Info_get_nthkey(info_ret, 0_MPI_INTEGER_KIND, key, mpierror) IF (mpierror .NE. MPI_SUCCESS) THEN WRITE(*,*) "MPI_INFO_GET_NTHKEY *FAILED* Process = ", mpi_rank nerrors = nerrors + 1 @@ -136,7 +138,7 @@ SUBROUTINE mpi_param_03(nerrors) WRITE(*,*) "MPI_INFO_GET *FAILED* Process = ", mpi_rank nerrors = nerrors + 1 ENDIF - CALL VERIFY("h5pget_fapl_mpio_f", flag, .TRUE., hdferror) + CALL VERIFY("h5pget_fapl_mpio_f", LOGICAL(flag), .TRUE., hdferror) CALL VERIFY("h5pget_fapl_mpio_f", TRIM(value), in_value, hdferror) ! Free the MPI resources @@ -179,16 +181,17 @@ SUBROUTINE mpi_param_08(nerrors) IMPLICIT NONE INTEGER, INTENT(inout) :: nerrors ! number of errors + INTEGER, PARAMETER :: logical_kind = MPI_INTEGER_KIND INTEGER :: hdferror ! HDF hdferror flag INTEGER(hid_t) :: fapl_id ! file access identifier - INTEGER :: mpi_size, mpi_size_ret ! number of processes in the group of communicator - INTEGER :: mpierror ! MPI hdferror flag - INTEGER :: mpi_rank ! rank of the calling process in the communicator + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_size_ret ! number of processes in the group of communicator + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI hdferror flag + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_rank ! rank of the calling process in the communicator TYPE(MPI_INFO) :: info, info_ret TYPE(MPI_COMM) :: comm, comm_ret - INTEGER :: nkeys - LOGICAL :: flag + INTEGER(KIND=MPI_INTEGER_KIND) :: nkeys + LOGICAL(KIND=logical_kind) :: flag INTEGER :: iconfig CHARACTER(LEN=4) , PARAMETER :: in_key="host" CHARACTER(LEN=10), PARAMETER :: in_value="myhost.org" @@ -215,13 +218,13 @@ SUBROUTINE mpi_param_08(nerrors) ! Split the communicator IF(mpi_rank.EQ.0)THEN - CALL MPI_Comm_split(MPI_COMM_WORLD, 1, mpi_rank, comm, mpierror) + CALL MPI_Comm_split(MPI_COMM_WORLD, 1_MPI_INTEGER_KIND, mpi_rank, comm, mpierror) IF (mpierror .NE. MPI_SUCCESS) THEN WRITE(*,*) "MPI_COMM_SPLIT *FAILED* Process = ", mpi_rank nerrors = nerrors + 1 ENDIF ELSE - CALL MPI_Comm_split(MPI_COMM_WORLD, 0, mpi_rank, comm, mpierror) + CALL MPI_Comm_split(MPI_COMM_WORLD, 0_MPI_INTEGER_KIND, mpi_rank, comm, mpierror) IF (mpierror .NE. MPI_SUCCESS) THEN WRITE(*,*) "MPI_COMM_SPLIT *FAILED* Process = ", mpi_rank nerrors = nerrors + 1 @@ -264,9 +267,9 @@ SUBROUTINE mpi_param_08(nerrors) nerrors = nerrors + 1 ENDIF IF (mpi_rank.EQ.0)THEN - CALL VERIFY("h5pget_fapl_mpio_f", mpi_size_ret, 1, hdferror) + CALL VERIFY("h5pget_fapl_mpio_f", mpi_size_ret, 1_MPI_INTEGER_KIND, hdferror) ELSE - CALL VERIFY("h5pget_fapl_mpio_f", mpi_size_ret, mpi_size-1, hdferror) + CALL VERIFY("h5pget_fapl_mpio_f", mpi_size_ret, INT(mpi_size-1,MPI_INTEGER_KIND), hdferror) ENDIF ! Check info returned @@ -275,9 +278,9 @@ SUBROUTINE mpi_param_08(nerrors) WRITE(*,*) "MPI_INFO_GET_NKEYS *FAILED* Process = ", mpi_rank nerrors = nerrors + 1 ENDIF - CALL VERIFY("h5pget_fapl_mpio_f", nkeys, 1, hdferror) + CALL VERIFY("h5pget_fapl_mpio_f", nkeys, 1_MPI_INTEGER_KIND, hdferror) - CALL MPI_Info_get_nthkey(info_ret, 0, key, mpierror) + CALL MPI_Info_get_nthkey(info_ret, 0_MPI_INTEGER_KIND, key, mpierror) IF (mpierror .NE. MPI_SUCCESS) THEN WRITE(*,*) "MPI_INFO_GET_NTHKEY *FAILED* Process = ", mpi_rank nerrors = nerrors + 1 @@ -289,7 +292,7 @@ SUBROUTINE mpi_param_08(nerrors) WRITE(*,*) "MPI_INFO_GET *FAILED* Process = ", mpi_rank nerrors = nerrors + 1 ENDIF - CALL VERIFY("h5pget_fapl_mpio_f", flag, .TRUE., hdferror) + CALL VERIFY("h5pget_fapl_mpio_f", LOGICAL(flag), .TRUE., hdferror) CALL VERIFY("h5pget_fapl_mpio_f", TRIM(value), in_value, hdferror) ! Free the MPI resources diff --git a/fortran/testpar/multidsetrw.F90 b/fortran/testpar/multidsetrw.F90 index e39900c9158..62eb5d1e8bb 100644 --- a/fortran/testpar/multidsetrw.F90 +++ b/fortran/testpar/multidsetrw.F90 @@ -25,8 +25,8 @@ SUBROUTINE pmultiple_dset_hyper_rw(do_collective, do_chunk, mpi_size, mpi_rank, LOGICAL, INTENT(in) :: do_collective ! use collective IO LOGICAL, INTENT(in) :: do_chunk ! use chunking - INTEGER, INTENT(in) :: mpi_size ! number of processes in the group of communicator - INTEGER, INTENT(in) :: mpi_rank ! rank of the calling process in the communicator + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(in) :: mpi_size ! number of processes in the group of communicator + INTEGER(KIND=MPI_INTEGER_KIND), INTENT(in) :: mpi_rank ! rank of the calling process in the communicator INTEGER, INTENT(inout) :: nerrors ! number of errors CHARACTER(LEN=80):: dsetname ! Dataset name INTEGER(hsize_t), DIMENSION(1:2) :: cdims ! chunk dimensions @@ -156,6 +156,7 @@ SUBROUTINE pmultiple_dset_hyper_rw(do_collective, do_chunk, mpi_size, mpi_rank, CALL h5dwrite_multi_f(ndsets, dset_id, mem_type_id, mem_space_id, file_space_id, buf_md, error, plist_id) CALL check("h5dwrite_multi_f", error, nerrors) + return CALL h5pget_dxpl_mpio_f(plist_id, data_xfer_mode, error) CALL check("h5pget_dxpl_mpio_f", error, nerrors) diff --git a/fortran/testpar/ptest.F90 b/fortran/testpar/ptest.F90 index d2e9d105703..3d7280bbcf8 100644 --- a/fortran/testpar/ptest.F90 +++ b/fortran/testpar/ptest.F90 @@ -21,12 +21,12 @@ PROGRAM parallel_test IMPLICIT NONE - INTEGER :: mpierror ! MPI hdferror flag + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI hdferror flag INTEGER :: hdferror ! HDF hdferror flag 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(KIND=MPI_INTEGER_KIND) :: mpi_size ! number of processes in the group of communicator + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_rank ! rank of the calling process in the communicator INTEGER :: length = 12000 ! length of array INTEGER :: i,j, sum ! use collective MPI I/O @@ -35,6 +35,7 @@ PROGRAM parallel_test ! use chunking LOGICAL, DIMENSION(1:2) :: do_chunk = (/.FALSE.,.TRUE./) CHARACTER(LEN=10), DIMENSION(1:2) :: chr_chunk =(/"contiguous", "chunk "/) + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_int_type ! ! initialize MPI @@ -71,6 +72,7 @@ PROGRAM parallel_test ! ! 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 @@ -80,10 +82,10 @@ PROGRAM parallel_test total_error) ENDDO ENDDO - ! ! test write/read several datasets (independent MPI I/O) ! + 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, & @@ -105,7 +107,13 @@ PROGRAM parallel_test ! CALL h5close_f(hdferror) - CALL MPI_ALLREDUCE(total_error, sum, 1, MPI_INTEGER, MPI_SUM, MPI_COMM_WORLD, mpierror) + IF(h5_sizeof(total_error).EQ.8_size_t)THEN + mpi_int_type=MPI_INTEGER8 + ELSE + mpi_int_type=MPI_INTEGER4 + ENDIF + + CALL MPI_ALLREDUCE(total_error, sum, 1_MPI_INTEGER_KIND, mpi_int_type, MPI_SUM, MPI_COMM_WORLD, mpierror) IF(mpi_rank==0) CALL write_test_footer() @@ -119,7 +127,7 @@ PROGRAM parallel_test ENDIF ELSE WRITE(*,*) 'Errors detected in process ', mpi_rank - CALL mpi_abort(MPI_COMM_WORLD, 1, mpierror) + CALL mpi_abort(MPI_COMM_WORLD, 1_MPI_INTEGER_KIND, mpierror) IF (mpierror .NE. MPI_SUCCESS) THEN WRITE(*,*) "MPI_ABORT *FAILED* Process = ", mpi_rank ENDIF diff --git a/fortran/testpar/subfiling.F90 b/fortran/testpar/subfiling.F90 index a677bea6121..876c1ccf822 100644 --- a/fortran/testpar/subfiling.F90 +++ b/fortran/testpar/subfiling.F90 @@ -25,29 +25,30 @@ PROGRAM subfiling_test IMPLICIT NONE INTEGER :: total_error = 0 ! sum of the number of errors - INTEGER :: mpierror ! MPI hdferror flag - INTEGER :: mpi_rank ! rank of the calling process in the communicator + INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI hdferror flag + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_rank ! rank of the calling process in the communicator #ifdef H5_HAVE_SUBFILING_VFD + INTEGER, PARAMETER :: logical_kind = MPI_INTEGER_KIND CHARACTER(LEN=7), PARAMETER :: filename = "subf.h5" - INTEGER :: hdferror ! HDF hdferror flag - INTEGER :: mpi_size, mpi_size_ret ! number of processes in the group of communicator - INTEGER :: required, provided + INTEGER :: hdferror ! HDF hdferror flag + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_size_ret ! number of processes in the group of communicator + INTEGER(KIND=MPI_INTEGER_KIND) :: required, provided LOGICAL :: file_exists INTEGER(HID_T) :: fapl_id INTEGER(HID_T) :: file_id - INTEGER :: comm, comm_ret - INTEGER :: info, info_ret + INTEGER(KIND=MPI_INTEGER_KIND) :: comm, comm_ret + INTEGER(KIND=MPI_INTEGER_KIND) :: info, info_ret CHARACTER(LEN=3) :: info_val CHARACTER(LEN=180) :: subfname INTEGER :: i, sum INTEGER(C_INT64_T) inode TYPE(H5FD_subfiling_config_t) :: vfd_config TYPE(H5FD_ioc_config_t) :: vfd_config_ioc - LOGICAL :: flag + LOGICAL(KIND=logical_kind) :: flag INTEGER :: nerrors = 0 @@ -56,6 +57,7 @@ PROGRAM subfiling_test CHARACTER(len=8) :: hex1, hex2 CHARACTER(len=1) :: arg + INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_int_type ! ! initialize MPI ! @@ -84,7 +86,7 @@ PROGRAM subfiling_test IF(mpi_rank==0) CALL write_test_status(sum, & 'Testing Initializing mpi_init_thread', total_error) CALL MPI_Barrier(MPI_COMM_WORLD, mpierror) - CALL mpi_abort(MPI_COMM_WORLD, 1, mpierror) + CALL mpi_abort(MPI_COMM_WORLD, 1_MPI_INTEGER_KIND, mpierror) ENDIF ! @@ -101,9 +103,9 @@ PROGRAM subfiling_test IF(mpi_size.GT.2)THEN IF (mpi_rank.LE.1)THEN - CALL MPI_Comm_split(MPI_COMM_WORLD, 1, mpi_rank, comm, mpierror) + CALL MPI_Comm_split(MPI_COMM_WORLD, 1_MPI_INTEGER_KIND, mpi_rank, comm, mpierror) ELSE - CALL MPI_Comm_split(MPI_COMM_WORLD, 0, mpi_rank, comm, mpierror) + CALL MPI_Comm_split(MPI_COMM_WORLD, 0_MPI_INTEGER_KIND, mpi_rank, comm, mpierror) ENDIF CALL MPI_Info_create(info, mpierror) @@ -128,7 +130,7 @@ PROGRAM subfiling_test nerrors = nerrors + 1 ENDIF - CALL mpi_info_get(info_ret,"foo", 3, info_val, flag, mpierror) + CALL mpi_info_get(info_ret,"foo", 3_MPI_INTEGER_KIND, info_val, flag, mpierror) IF(flag .EQV. .TRUE.)THEN IF(info_val.NE."bar")THEN IF(mpi_rank.EQ.0) & @@ -148,7 +150,13 @@ PROGRAM subfiling_test ENDIF - CALL MPI_REDUCE(nerrors, sum, 1, MPI_INTEGER, MPI_SUM, 0, MPI_COMM_WORLD, mpierror) + IF(h5_sizeof(total_error).EQ.8_size_t)THEN + mpi_int_type=MPI_INTEGER8 + ELSE + mpi_int_type=MPI_INTEGER4 + ENDIF + + CALL MPI_REDUCE(nerrors, sum, 1_MPI_INTEGER_KIND, mpi_int_type, MPI_SUM, 0_MPI_INTEGER_KIND, MPI_COMM_WORLD, mpierror) IF(mpi_rank==0) CALL write_test_status(sum, & 'Testing H5Pset/get_mpi_params_f', total_error) @@ -267,10 +275,10 @@ PROGRAM subfiling_test ! Testing modifying defaults for subfiling FD - vfd_config%magic = H5FD_SUBFILING_FAPL_MAGIC_F - vfd_config%version = H5FD_SUBFILING_CURR_FAPL_VERSION_F + vfd_config%magic = INT(H5FD_SUBFILING_FAPL_MAGIC_F,C_INT32_T) + vfd_config%version = INT(H5FD_SUBFILING_CURR_FAPL_VERSION_F,C_INT32_T) vfd_config%require_ioc = .TRUE. - vfd_config%shared_cfg%ioc_selection = SELECT_IOC_ONE_PER_NODE_F + vfd_config%shared_cfg%ioc_selection = INT(SELECT_IOC_ONE_PER_NODE_F,C_INT) vfd_config%shared_cfg%stripe_size = 16*1024*1024 vfd_config%shared_cfg%stripe_count = 3 @@ -299,8 +307,8 @@ PROGRAM subfiling_test IF(mpi_rank==0) CALL write_test_status(nerrors, & 'Testing H5Pset/get_fapl_subfiling_f with custom settings', total_error) - vfd_config_ioc%magic = H5FD_IOC_FAPL_MAGIC_F - vfd_config_ioc%version = H5FD_IOC_CURR_FAPL_VERSION_F + vfd_config_ioc%magic = INT(H5FD_IOC_FAPL_MAGIC_F,C_INT32_T) + vfd_config_ioc%version = INT(H5FD_IOC_CURR_FAPL_VERSION_F,C_INT32_T) vfd_config_ioc%thread_pool_size = 2 nerrors = 0 @@ -374,7 +382,13 @@ PROGRAM subfiling_test ! CALL h5close_f(hdferror) - CALL MPI_ALLREDUCE(total_error, sum, 1, MPI_INTEGER, MPI_SUM, MPI_COMM_WORLD, mpierror) + IF(h5_sizeof(total_error).EQ.8_size_t)THEN + mpi_int_type=MPI_INTEGER8 + ELSE + mpi_int_type=MPI_INTEGER4 + ENDIF + + CALL MPI_ALLREDUCE(total_error, sum, 1_MPI_INTEGER_KIND, mpi_int_type, MPI_SUM, MPI_COMM_WORLD, mpierror) ! ! close MPI @@ -386,7 +400,7 @@ PROGRAM subfiling_test ENDIF ELSE WRITE(*,*) 'Errors detected in process ', mpi_rank - CALL mpi_abort(MPI_COMM_WORLD, 1, mpierror) + CALL mpi_abort(MPI_COMM_WORLD, 1_MPI_INTEGER_KIND, mpierror) IF (mpierror .NE. MPI_SUCCESS) THEN WRITE(*,*) "MPI_ABORT *FAILED* Process = ", mpi_rank ENDIF diff --git a/m4/aclocal_fc.m4 b/m4/aclocal_fc.m4 index f7427924ee2..f8f4fa123b1 100644 --- a/m4/aclocal_fc.m4 +++ b/m4/aclocal_fc.m4 @@ -391,6 +391,8 @@ AC_DEFUN([PAC_FC_NATIVE_INTEGER],[ AC_REQUIRE([PAC_FC_AVAIL_KINDS]) AC_MSG_CHECKING([sizeof of native KINDS]) AC_LANG_PUSH([Fortran]) +saved_FCFLAGS=$FCFLAGS +FCFLAGS=$saved_user_FCFLAGS pack_int_sizeof="" rm -f pac_fconftest.out AC_LANG_CONFTEST([ @@ -424,6 +426,7 @@ rm -f pac_fconftest.out pack_int_sizeof="$2" ]) AC_MSG_RESULT([$pack_int_sizeof]) +FCFLAGS=$saved_FCFLAGS AC_LANG_POP([Fortran]) ]) From 32a68bfabb0eadf1923c726dfa8a7828ab955e7d Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 21 Mar 2024 20:20:35 +0000 Subject: [PATCH 02/12] Committing clang-format changes --- fortran/src/H5f90proto.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index 2ab3a8a6f4f..71d914c1d26 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -519,7 +519,7 @@ H5_FCDLL int_f h5pget_chunk_cache_c(hid_t_f *dapl_id, size_t_f *rdcc_nslots, siz #ifdef H5_HAVE_PARALLEL H5_FCDLL int_f h5pget_mpio_actual_io_mode_c(hid_t_f *dxpl_id, int_f *actual_io_mode); H5_FCDLL int_f h5pget_fapl_mpio_c(hid_t_f *prp_id, int *comm, int *info); -H5_FCDLL int_f h5pset_fapl_mpio_c(hid_t_f *prp_id, void *comm, void *info); +H5_FCDLL int_f h5pset_fapl_mpio_c(hid_t_f *prp_id, void *comm, void *info); H5_FCDLL int_f h5pget_mpi_params_c(hid_t_f *prp_id, int *comm, int *info); H5_FCDLL int_f h5pset_mpi_params_c(hid_t_f *prp_id, void *comm, void *info); H5_FCDLL int_f h5pget_dxpl_mpio_c(hid_t_f *prp_id, int_f *data_xfer_mode); From e073f5c25c330f59abad2c9cb35ae80dd5afa64a Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Thu, 21 Mar 2024 15:52:58 -0500 Subject: [PATCH 03/12] fixed h5fcreate_f --- fortran/src/H5Fff.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fortran/src/H5Fff.F90 b/fortran/src/H5Fff.F90 index e8b765b7696..0c8b1d84099 100644 --- a/fortran/src/H5Fff.F90 +++ b/fortran/src/H5Fff.F90 @@ -120,10 +120,10 @@ SUBROUTINE h5fcreate_f(name, access_flags, file_id, hdferr, & INTERFACE INTEGER(HID_T) FUNCTION H5Fcreate(name, access_flags, & creation_prp_default, access_prp_default) BIND(C,NAME='H5Fcreate') - IMPORT :: C_CHAR + IMPORT :: C_CHAR, C_INT IMPORT :: HID_T CHARACTER(KIND=C_CHAR), DIMENSION(*) :: name - INTEGER, VALUE :: access_flags + INTEGER(C_INT), VALUE :: access_flags INTEGER(HID_T), VALUE :: creation_prp_default INTEGER(HID_T), VALUE :: access_prp_default END FUNCTION H5Fcreate @@ -137,7 +137,7 @@ END FUNCTION H5Fcreate IF (PRESENT(creation_prp)) creation_prp_default = creation_prp IF (PRESENT(access_prp)) access_prp_default = access_prp - file_id = h5fcreate(c_name, access_flags, & + file_id = h5fcreate(c_name, INT(access_flags, C_INT), & creation_prp_default, access_prp_default) hdferr = 0 From cb25f8e621181aa757673393ba1cb25fab01e94b Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Fri, 22 Mar 2024 09:53:02 -0500 Subject: [PATCH 04/12] added option to use mpi_f08 --- fortran/testpar/async.F90 | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/fortran/testpar/async.F90 b/fortran/testpar/async.F90 index 16c65cf616e..aa2416fd24d 100644 --- a/fortran/testpar/async.F90 +++ b/fortran/testpar/async.F90 @@ -17,13 +17,11 @@ MODULE test_async_APIs -#ifdef H5_HAVE_PARALLEL #ifdef H5_HAVE_MPI_F08 -! USE MPI_F08 + USE MPI_F08 #else -#endif -#endif USE MPI +#endif USE HDF5 USE TH5_MISC USE TH5_MISC_GEN @@ -392,8 +390,12 @@ SUBROUTINE H5D_async_tests(cleanup, total_error) INTEGER :: error ! Error flags INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI error flag - INTEGER(KIND=MPI_INTEGER_KIND) :: comm - INTEGER(KIND=MPI_INTEGER_KIND) :: info +#ifdef H5_HAVE_MPI_F08 + TYPE(MPI_COMM) :: comm + TYPE(MPI_INFO) :: info +#else + INTEGER(KIND=MPI_INTEGER_KIND) :: comm, info +#endif INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_rank comm = MPI_COMM_WORLD @@ -593,8 +595,12 @@ SUBROUTINE H5G_async_tests(cleanup, total_error) INTEGER :: error INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI error flag - INTEGER(KIND=MPI_INTEGER_KIND) :: comm - INTEGER(KIND=MPI_INTEGER_KIND) :: info +#ifdef H5_HAVE_MPI_F08 + TYPE(MPI_COMM) :: comm + TYPE(MPI_INFO) :: info +#else + INTEGER(KIND=MPI_INTEGER_KIND) :: comm, info +#endif INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_rank comm = MPI_COMM_WORLD @@ -722,7 +728,12 @@ SUBROUTINE H5F_async_tests(cleanup, total_error) INTEGER :: error ! Error flags INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI error flag +#ifdef H5_HAVE_MPI_F08 + TYPE(MPI_COMM) :: comm + TYPE(MPI_INFO) :: info +#else INTEGER(KIND=MPI_INTEGER_KIND) :: comm, info +#endif INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_rank comm = MPI_COMM_WORLD @@ -828,7 +839,11 @@ SUBROUTINE H5L_async_tests(cleanup, total_error) INTEGER :: error ! Error flags INTEGER(KIND=MPI_INTEGER_KIND) :: mpierror ! MPI error flag +#ifdef H5_HAVE_MPI_F08 + TYPE(MPI_COMM) :: comm +#else INTEGER(KIND=MPI_INTEGER_KIND) :: comm +#endif INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_rank INTEGER(SIZE_T) :: count @@ -1260,7 +1275,11 @@ PROGRAM async_test INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size ! number of processes in the group of communicator INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_rank ! rank of the calling process in the communicator INTEGER(KIND=MPI_INTEGER_KIND) :: required, provided +#ifdef H5_HAVE_MPI_F08 + TYPE(MPI_DATATYPE) :: mpi_int_type +#else INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_int_type +#endif INTEGER(HID_T) :: vol_id INTEGER :: hdferror From 3eeff108055fa51b2634dadacc4e74eccd062ce2 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Fri, 22 Mar 2024 19:50:26 -0500 Subject: [PATCH 05/12] change the kind of logical in the parallel tests --- config/cmake/HDF5UseFortran.cmake | 10 ++++++++++ configure.ac | 12 ++++++++++-- fortran/src/H5config_f.inc.cmake | 2 +- fortran/src/H5config_f.inc.in | 2 +- fortran/testpar/mpi_param.F90 | 20 ++++++++++++++++---- fortran/testpar/subfiling.F90 | 12 +++++++++--- m4/aclocal_fc.f90 | 2 +- m4/aclocal_fc.m4 | 6 +++--- 8 files changed, 51 insertions(+), 15 deletions(-) diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index 743da3d3560..f22d8d2c390 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -117,6 +117,16 @@ else () set (${HDF_PREFIX}_FORTRAN_C_BOOL_IS_UNIQUE 0) endif () +# Check if the fortran compiler supports the intrinsic module "ISO_FORTRAN_ENV" (F08) + +READ_SOURCE("PROGRAM PROG_FC_ISO_FORTRAN_ENV" "END PROGRAM PROG_FC_ISO_FORTRAN_ENV" SOURCE_CODE) +check_fortran_source_compiles (${SOURCE_CODE} HAVE_ISO_FORTRAN_ENV SRC_EXT f90) +if (${HAVE_ISO_FORTRAN_ENV}) + set (${HDF_PREFIX}_HAVE_ISO_FORTRAN_ENV 1) +else () + set (${HDF_PREFIX}_HAVE_ISO_FORTRAN_ENV 0) +endif () + ## Set the sizeof function for use later in the fortran tests if (${HDF_PREFIX}_FORTRAN_HAVE_STORAGE_SIZE) set (FC_SIZEOF_A "STORAGE_SIZE(a, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)") diff --git a/configure.ac b/configure.ac index f33fb8b87b9..d6b20e36103 100644 --- a/configure.ac +++ b/configure.ac @@ -786,6 +786,15 @@ if test "X$HDF_FORTRAN" = "Xyes"; then ## See if the fortran compiler supports the intrinsic function "STORAGE_SIZE" PAC_PROG_FC_STORAGE_SIZE + ## -------------------------------------------------------------------- + ## Checking if the fortran compiler supports ISO_FORTRAN_ENV (Fortran 2008) + HAVE_ISO_FORTRAN_ENV="0" + PAC_PROG_FC_ISO_FORTRAN_ENV + if test "X$CHECK_ISO_FORTRAN_ENV" = "Xyes"; then + HAVE_ISO_FORTRAN_ENV="1" + AC_DEFINE([HAVE_ISO_FORTRAN_ENV], [1], [Define if Fortran supports ISO_FORTRAN_ENV (F08)]) + fi + ## Set the sizeof function for use later in the fortran tests if test "X$HAVE_STORAGE_SIZE_FORTRAN" = "Xyes";then FC_SIZEOF_A="STORAGE_SIZE(a, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)" @@ -802,8 +811,6 @@ if test "X$HDF_FORTRAN" = "Xyes"; then fi fi - ## See if the fortran compiler supports the intrinsic module "ISO_FORTRAN_ENV" - PAC_PROG_FC_ISO_FORTRAN_ENV ## Check KIND and size of native integer PAC_FC_NATIVE_INTEGER @@ -829,6 +836,7 @@ if test "X$HDF_FORTRAN" = "Xyes"; then AC_SUBST([FORTRAN_HAVE_C_LONG_DOUBLE]) AC_SUBST([FORTRAN_C_LONG_DOUBLE_IS_UNIQUE]) AC_SUBST([FORTRAN_C_BOOL_IS_UNIQUE]) + AC_SUBST([HAVE_ISO_FORTRAN_ENV]) AC_SUBST([H5CONFIG_F_NUM_RKIND]) AC_SUBST([H5CONFIG_F_RKIND]) AC_SUBST([H5CONFIG_F_RKIND_SIZEOF]) diff --git a/fortran/src/H5config_f.inc.cmake b/fortran/src/H5config_f.inc.cmake index 44da2befead..e46c99f9773 100644 --- a/fortran/src/H5config_f.inc.cmake +++ b/fortran/src/H5config_f.inc.cmake @@ -79,7 +79,7 @@ ! Define if Fortran C_BOOL is different from default LOGICAL #define H5_FORTRAN_C_BOOL_IS_UNIQUE @H5_FORTRAN_C_BOOL_IS_UNIQUE@ -! Define if the intrinsic module ISO_FORTRAN_ENV exists +! Define if Fortran supports ISO_FORTRAN_ENV (F08) #define H5_HAVE_ISO_FORTRAN_ENV @H5_HAVE_ISO_FORTRAN_ENV@ ! Define the size of C's double diff --git a/fortran/src/H5config_f.inc.in b/fortran/src/H5config_f.inc.in index cb2ec185735..6e465ca014b 100644 --- a/fortran/src/H5config_f.inc.in +++ b/fortran/src/H5config_f.inc.in @@ -47,7 +47,7 @@ ! Define if Fortran C_BOOL is different from default LOGICAL #undef FORTRAN_C_BOOL_IS_UNIQUE -! Define if the intrinsic module ISO_FORTRAN_ENV exists +! Define if Fortran supports ISO_FORTRAN_ENV (F08) #undef HAVE_ISO_FORTRAN_ENV ! Define the size of C's double diff --git a/fortran/testpar/mpi_param.F90 b/fortran/testpar/mpi_param.F90 index a57a4c57edd..09a95d47177 100644 --- a/fortran/testpar/mpi_param.F90 +++ b/fortran/testpar/mpi_param.F90 @@ -18,6 +18,9 @@ SUBROUTINE mpi_param_03(nerrors) +#ifdef H5_HAVE_ISO_FORTRAN_ENV + USE, INTRINSIC :: iso_fortran_env, ONLY : atomic_logical_kind +#endif USE MPI USE HDF5 USE TH5_MISC @@ -27,7 +30,6 @@ SUBROUTINE mpi_param_03(nerrors) INTEGER, INTENT(inout) :: nerrors ! number of errors - INTEGER, PARAMETER :: logical_kind = MPI_INTEGER_KIND INTEGER :: hdferror ! HDF hdferror flag INTEGER(hid_t) :: fapl_id ! file access identifier INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_size_ret ! number of processes in the group of communicator @@ -37,7 +39,11 @@ SUBROUTINE mpi_param_03(nerrors) INTEGER(KIND=MPI_INTEGER_KIND) :: info, info_ret INTEGER(KIND=MPI_INTEGER_KIND) :: comm, comm_ret INTEGER(KIND=MPI_INTEGER_KIND) :: nkeys - LOGICAL(KIND=logical_kind) :: flag +#ifdef H5_HAVE_ISO_FORTRAN_ENV + LOGICAL(KIND=atomic_logical_kind) :: flag +#else + LOGICAL(KIND=MPI_INTEGER_KIND) :: flag +#endif INTEGER :: iconfig CHARACTER(LEN=4) , PARAMETER :: in_key="host" CHARACTER(LEN=10), PARAMETER :: in_value="myhost.org" @@ -173,6 +179,9 @@ SUBROUTINE mpi_param_08(nerrors) #ifdef H5_HAVE_MPI_F08 +#ifdef H5_HAVE_ISO_FORTRAN_ENV + USE, INTRINSIC :: iso_fortran_env, ONLY : atomic_logical_kind +#endif USE MPI_F08 USE HDF5 USE TH5_MISC @@ -181,7 +190,6 @@ SUBROUTINE mpi_param_08(nerrors) IMPLICIT NONE INTEGER, INTENT(inout) :: nerrors ! number of errors - INTEGER, PARAMETER :: logical_kind = MPI_INTEGER_KIND INTEGER :: hdferror ! HDF hdferror flag INTEGER(hid_t) :: fapl_id ! file access identifier INTEGER(KIND=MPI_INTEGER_KIND) :: mpi_size, mpi_size_ret ! number of processes in the group of communicator @@ -191,7 +199,11 @@ SUBROUTINE mpi_param_08(nerrors) TYPE(MPI_INFO) :: info, info_ret TYPE(MPI_COMM) :: comm, comm_ret INTEGER(KIND=MPI_INTEGER_KIND) :: nkeys - LOGICAL(KIND=logical_kind) :: flag +#ifdef H5_HAVE_ISO_FORTRAN_ENV + LOGICAL(KIND=atomic_logical_kind) :: flag +#else + LOGICAL(KIND=MPI_INTEGER_KIND) :: flag +#endif INTEGER :: iconfig CHARACTER(LEN=4) , PARAMETER :: in_key="host" CHARACTER(LEN=10), PARAMETER :: in_value="myhost.org" diff --git a/fortran/testpar/subfiling.F90 b/fortran/testpar/subfiling.F90 index 876c1ccf822..9bee38bcc6f 100644 --- a/fortran/testpar/subfiling.F90 +++ b/fortran/testpar/subfiling.F90 @@ -18,6 +18,9 @@ PROGRAM subfiling_test USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_INT64_T +#ifdef H5_HAVE_ISO_FORTRAN_ENV + USE, INTRINSIC :: iso_fortran_env, ONLY : atomic_logical_kind +#endif USE HDF5 USE MPI USE TH5_MISC @@ -30,7 +33,6 @@ PROGRAM subfiling_test #ifdef H5_HAVE_SUBFILING_VFD - INTEGER, PARAMETER :: logical_kind = MPI_INTEGER_KIND CHARACTER(LEN=7), PARAMETER :: filename = "subf.h5" INTEGER :: hdferror ! HDF hdferror flag @@ -48,7 +50,11 @@ PROGRAM subfiling_test INTEGER(C_INT64_T) inode TYPE(H5FD_subfiling_config_t) :: vfd_config TYPE(H5FD_ioc_config_t) :: vfd_config_ioc - LOGICAL(KIND=logical_kind) :: flag +#ifdef H5_HAVE_ISO_FORTRAN_ENV + LOGICAL(KIND=atomic_logical_kind) :: flag +#else + LOGICAL(KIND=MPI_INTEGER_KIND) :: flag +#endif INTEGER :: nerrors = 0 @@ -131,7 +137,7 @@ PROGRAM subfiling_test ENDIF CALL mpi_info_get(info_ret,"foo", 3_MPI_INTEGER_KIND, info_val, flag, mpierror) - IF(flag .EQV. .TRUE.)THEN + IF(LOGICAL(flag) .EQV. .TRUE.)THEN IF(info_val.NE."bar")THEN IF(mpi_rank.EQ.0) & WRITE(*,*) "Failed H5Pset_mpi_params_f and H5Pget_mpi_params_f sequence" diff --git a/m4/aclocal_fc.f90 b/m4/aclocal_fc.f90 index 939988f64aa..24600242476 100644 --- a/m4/aclocal_fc.f90 +++ b/m4/aclocal_fc.f90 @@ -21,7 +21,7 @@ ! PROGRAM PROG_FC_ISO_FORTRAN_ENV - USE, INTRINSIC :: ISO_FORTRAN_ENV + USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : atomic_logical_kind END PROGRAM PROG_FC_ISO_FORTRAN_ENV PROGRAM PROG_FC_SIZEOF diff --git a/m4/aclocal_fc.m4 b/m4/aclocal_fc.m4 index f8f4fa123b1..6e5703e9132 100644 --- a/m4/aclocal_fc.m4 +++ b/m4/aclocal_fc.m4 @@ -64,11 +64,11 @@ dnl dnl See if the fortran compiler supports the intrinsic module "ISO_FORTRAN_ENV" AC_DEFUN([PAC_PROG_FC_ISO_FORTRAN_ENV],[ - HAVE_ISO_FORTRAN_ENV="no" - AC_MSG_CHECKING([if Fortran compiler supports intrinsic module ISO_FORTRAN_ENV]) + CHECK_ISO_FORTRAN_ENV="no" + AC_MSG_CHECKING([if Fortran compiler supports intrinsic module ISO_FORTRAN_ENV (F08)]) TEST_SRC="`sed -n '/PROGRAM PROG_FC_ISO_FORTRAN_ENV/,/END PROGRAM PROG_FC_ISO_FORTRAN_ENV/p' $srcdir/m4/aclocal_fc.f90`" AC_LINK_IFELSE([$TEST_SRC],[AC_MSG_RESULT([yes]) - HAVE_ISO_FORTRAN_ENV="yes"], + CHECK_ISO_FORTRAN_ENV="yes"], [AC_MSG_RESULT([no])]) ]) From 8ded570017ecad85e80eb87635e6a91de157b571 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Sat, 23 Mar 2024 10:04:47 -0500 Subject: [PATCH 06/12] addressed missing return value from callback --- HDF5Examples/FORTRAN/H5G/h5ex_g_traverse.F90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/HDF5Examples/FORTRAN/H5G/h5ex_g_traverse.F90 b/HDF5Examples/FORTRAN/H5G/h5ex_g_traverse.F90 index 169a0044f74..ab401ce9164 100644 --- a/HDF5Examples/FORTRAN/H5G/h5ex_g_traverse.F90 +++ b/HDF5Examples/FORTRAN/H5G/h5ex_g_traverse.F90 @@ -87,6 +87,7 @@ RECURSIVE INTEGER(KIND=C_INT) FUNCTION op_func(loc_id, name, info, operator_data INTEGER :: ret_val_func ret_val_func = 0 + ret_val = 0 name_string(1:10) = " " len = 0 @@ -142,7 +143,7 @@ RECURSIVE INTEGER(KIND=C_INT) FUNCTION op_func(loc_id, name, info, operator_data funptr = C_FUNLOC(op_func) CALL h5literate_by_name_f(loc_id, name_string, H5_INDEX_NAME_F, H5_ITER_NATIVE_F, idx, & funptr, ptr2, ret_val_func, status) - + ret_val = INT(ret_val_func,C_INT) ENDIF WRITE(*,'(A)') space(1:spaces)//"}" RETURN From b4ebead3e66fe4406fbf10973a8ba1aad99b18c1 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Sat, 23 Mar 2024 10:48:16 -0500 Subject: [PATCH 07/12] added test line to address nvidia --- m4/aclocal_fc.f90 | 1 + 1 file changed, 1 insertion(+) diff --git a/m4/aclocal_fc.f90 b/m4/aclocal_fc.f90 index 24600242476..9e4bfde3c90 100644 --- a/m4/aclocal_fc.f90 +++ b/m4/aclocal_fc.f90 @@ -22,6 +22,7 @@ PROGRAM PROG_FC_ISO_FORTRAN_ENV USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : atomic_logical_kind + LOGICAL(KIND=atomic_logical_kind) :: state END PROGRAM PROG_FC_ISO_FORTRAN_ENV PROGRAM PROG_FC_SIZEOF From 8c3a29ac3f7c85b0dacf333cd7a36b3019988091 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Sat, 23 Mar 2024 22:34:06 -0500 Subject: [PATCH 08/12] terminated strings --- fortran/test/tH5E_F03.F90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fortran/test/tH5E_F03.F90 b/fortran/test/tH5E_F03.F90 index b538e20c530..7060d2ee617 100644 --- a/fortran/test/tH5E_F03.F90 +++ b/fortran/test/tH5E_F03.F90 @@ -298,7 +298,8 @@ SUBROUTINE test_error_stack(total_error) ! push a custom error message onto the stack CALL H5Epush_f(estack_id, file, func, line, & cls_id, major, minor, "%s ERROR TEXT %s %s %s", error, & - arg1=ACHAR(27)//"[31m", arg2=ACHAR(27)//"[0m", arg3=ACHAR(0), arg4=ACHAR(10) ) + arg1=ACHAR(27)//"[31m"//C_NULL_CHAR, arg2=ACHAR(27)//"[0m"//C_NULL_CHAR, & + arg3=ACHAR(0)//C_NULL_CHAR, arg4=ACHAR(10)//C_NULL_CHAR ) CALL check("H5Epush_f", error, total_error) CALL h5eget_num_f(estack_id, count, error) From 028dd8186708c7770266c547a66a55ce114a7dba Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Sat, 23 Mar 2024 22:58:37 -0500 Subject: [PATCH 09/12] nvidia test --- config/cmake/HDFUseFortran.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/cmake/HDFUseFortran.cmake b/config/cmake/HDFUseFortran.cmake index 2d53a506124..dd35c07531d 100644 --- a/config/cmake/HDFUseFortran.cmake +++ b/config/cmake/HDFUseFortran.cmake @@ -80,7 +80,8 @@ set (CHAR_ALLOC set (ISO_FORTRAN_ENV_CODE " PROGRAM main - USE, INTRINSIC :: ISO_FORTRAN_ENV + USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : atomic_logical_kind + LOGICAL(KIND=atomic_logical_kind) :: state END PROGRAM " ) From c640c08b666a4790e0b2a2b6428201745db12c60 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Sat, 23 Mar 2024 23:37:14 -0500 Subject: [PATCH 10/12] nvidia changes --- configure.ac | 2 +- fortran/src/CMakeLists.txt | 5 +++++ fortran/src/H5config_f.inc.cmake | 7 ++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index d6b20e36103..d5c711474f4 100644 --- a/configure.ac +++ b/configure.ac @@ -13,7 +13,7 @@ ## ---------------------------------------------------------------------- ## Initialize configure. ## -AC_PREREQ([2.71]) +AC_PREREQ([2.69]) ## AC_INIT takes the name of the package, the version number, and an ## email address to report bugs. AC_CONFIG_SRCDIR takes a unique file diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index b2ac81ea0c6..80ee2889bc7 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -69,6 +69,11 @@ if (H5_FORTRAN_HAVE_C_SIZEOF) set (CMAKE_H5_FORTRAN_HAVE_C_SIZEOF 1) endif () +set (CMAKE_H5_HAVE_ISO_FORTRAN_ENV 0) +if (H5_HAVE_ISO_FORTRAN_ENV) + set (CMAKE_H5_HAVE_ISO_FORTRAN_ENV 1) +endif () + set (CMAKE_H5_FORTRAN_HAVE_CHAR_ALLOC 0) if (H5_FORTRAN_HAVE_CHAR_ALLOC) set (CMAKE_H5_FORTRAN_HAVE_CHAR_ALLOC 1) diff --git a/fortran/src/H5config_f.inc.cmake b/fortran/src/H5config_f.inc.cmake index e46c99f9773..31c149883cf 100644 --- a/fortran/src/H5config_f.inc.cmake +++ b/fortran/src/H5config_f.inc.cmake @@ -80,7 +80,12 @@ #define H5_FORTRAN_C_BOOL_IS_UNIQUE @H5_FORTRAN_C_BOOL_IS_UNIQUE@ ! Define if Fortran supports ISO_FORTRAN_ENV (F08) -#define H5_HAVE_ISO_FORTRAN_ENV @H5_HAVE_ISO_FORTRAN_ENV@ +#cmakedefine01 CMAKE_H5_HAVE_ISO_FORTRAN_ENV +#if CMAKE_H5_HAVE_ISO_FORTRAN_ENV == 0 +#undef H5_HAVE_ISO_FORTRAN_ENV +#else +#define H5_HAVE_ISO_FORTRAN_ENV +#endif ! Define the size of C's double #define H5_SIZEOF_DOUBLE @H5_SIZEOF_DOUBLE@ From 1e2a159209122405506af88c84f397bd506dfd8f Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Sat, 23 Mar 2024 23:37:34 -0500 Subject: [PATCH 11/12] nvidia changes --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index d5c711474f4..d6b20e36103 100644 --- a/configure.ac +++ b/configure.ac @@ -13,7 +13,7 @@ ## ---------------------------------------------------------------------- ## Initialize configure. ## -AC_PREREQ([2.69]) +AC_PREREQ([2.71]) ## AC_INIT takes the name of the package, the version number, and an ## email address to report bugs. AC_CONFIG_SRCDIR takes a unique file From 48ddd1f892512cf2388daaf7467a09818e8fb058 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Sun, 24 Mar 2024 23:27:19 -0500 Subject: [PATCH 12/12] Updated the documention for H5epush_f --- fortran/src/H5Eff.F90 | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/fortran/src/H5Eff.F90 b/fortran/src/H5Eff.F90 index 162a7508085..20f45473a3b 100644 --- a/fortran/src/H5Eff.F90 +++ b/fortran/src/H5Eff.F90 @@ -306,19 +306,16 @@ END SUBROUTINE h5eset_auto_f !! \param arg19 C style format control strings !! \param arg20 C style format control strings !! -!! \note \p arg[1-20] expects C-style format strings, similar to the -!! system and C functions printf() and fprintf(). -!! Furthermore, special characters, such as ANSI escapes, -!! will only be interpreted correctly if the Fortran equivalent -!! is used. For example, to print \p msg "TEXT" in red and has -!! a space after the text would be: +!! \note \p arg[1-20] expects C-style format strings, similar to the system and C functions printf() and fprintf(). +!! Furthermore, special characters, such as ANSI escapes, will only be interpreted correctly if the Fortran +!! equivalent is used. For example, to print \p msg "TEXT" in red would be: !!

!! \code -!! (..., "%s TEXT %s"//C_NEW_LINE, hdferr, ..., arg1=ACHAR(27)//"[31m", arg2=ACHAR(27)//"[0m" ) +!! (..., "%s TEXT %s", hdferr, ..., arg1=ACHAR(27)//"[31m"//C_NULL_CHAR, arg2=ACHAR(27)//"[0m"//C_NULL_CHAR ) !! \endcode !!
Using "\n" instead of C_NEW_LINE will not be interpereted correctly, and similarly, -!! using "\x1B" instead of ACHAR(27) -!! +!! using "\x1B" instead of ACHAR(27). Also, all \p arg[1-20] characters strings must be +!! NULL terminated. !! !! See C API: @ref H5Epush2() !!