diff options
author | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2022-10-06 16:08:56 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-06 16:08:56 (GMT) |
commit | e80079fd21ffe6978ac69e7632e069cc44874675 (patch) | |
tree | b1f75384a0df8385cb8ad5e13b233554c20bdfa1 /fortran/testpar | |
parent | a322eb6147f243e1d45934ddfc1cfa6f69a0ddec (diff) | |
download | hdf5-e80079fd21ffe6978ac69e7632e069cc44874675.zip hdf5-e80079fd21ffe6978ac69e7632e069cc44874675.tar.gz hdf5-e80079fd21ffe6978ac69e7632e069cc44874675.tar.bz2 |
Subfiling Fortran wrapper work. (#2143)
* added C ref. for Fortran constants
* added C ref. for Fortran constants
* move constant paramters to H5* module listing
* added back comment
* Fortran subfiling and ioc FD with tests. H5Pset/get_mpi_params wrappers with tests, misc.. parallel test clean-up.
* misc. fixes
* fixed CMake testpar issues, formatted, misc. updates
* updated tests
Diffstat (limited to 'fortran/testpar')
-rw-r--r-- | fortran/testpar/CMakeLists.txt | 44 | ||||
-rw-r--r-- | fortran/testpar/CMakeTests.cmake | 1 | ||||
-rw-r--r-- | fortran/testpar/Makefile.am | 5 | ||||
-rw-r--r-- | fortran/testpar/hyper.F90 | 31 | ||||
-rw-r--r-- | fortran/testpar/mdset.F90 | 1 | ||||
-rw-r--r-- | fortran/testpar/ptest.F90 | 4 | ||||
-rw-r--r-- | fortran/testpar/subfiling.F90 | 391 |
7 files changed, 454 insertions, 23 deletions
diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt index c6712d3..e395937 100644 --- a/fortran/testpar/CMakeLists.txt +++ b/fortran/testpar/CMakeLists.txt @@ -4,7 +4,7 @@ project (HDF5_FORTRAN_TESTPAR C Fortran) #----------------------------------------------------------------------------- # Setup include Directories #----------------------------------------------------------------------------- -set (TESTPAR_INCLUDES ${MPI_Fortran_INCLUDE_DIRS} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src)) +set (TESTPAR_INCLUDES ${MPI_Fortran_INCLUDE_DIRS} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src) if (NOT BUILD_SHARED_LIBS) set (TESTPAR_INCLUDES ${TESTPAR_INCLUDES} ${CMAKE_Fortran_MODULE_DIRECTORY}/static) else () @@ -53,12 +53,50 @@ else () ) endif () -#set_property(TARGET parallel_test APPEND PROPERTY LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">) -#set_property(TARGET parallel_test APPEND PROPERTY LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>) if(MSVC) set_property(TARGET parallel_test PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() +#-- Adding test for subfiling_test +add_executable (subfiling_test + subfiling.F90 +) +target_include_directories (subfiling_test + PRIVATE ${TESTPAR_INCLUDES} +) +target_compile_options(subfiling_test + PRIVATE + "${HDF5_CMAKE_Fortran_FLAGS}" + $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> +) +if (NOT BUILD_SHARED_LIBS) + target_link_libraries (subfiling_test + PRIVATE + ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ${LINK_Fortran_LIBS} + $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"ws2_32.lib"> + ) + set_target_properties (subfiling_test PROPERTIES + FOLDER test/fortran + LINKER_LANGUAGE Fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) +else () + target_link_libraries (subfiling_test + PRIVATE + ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${LINK_Fortran_LIBS} + $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"ws2_32.lib"> + ) + set_target_properties (subfiling_test PROPERTIES + FOLDER test/fortran + LINKER_LANGUAGE Fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + ) +endif () + +if(MSVC) + set_property(TARGET subfiling_test PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") +endif() + if (HDF5_TEST_FORTRAN AND HDF5_TEST_PARALLEL) include (CMakeTests.cmake) endif () diff --git a/fortran/testpar/CMakeTests.cmake b/fortran/testpar/CMakeTests.cmake index 02eb897..1d893d5 100644 --- a/fortran/testpar/CMakeTests.cmake +++ b/fortran/testpar/CMakeTests.cmake @@ -16,3 +16,4 @@ ############################################################################## ############################################################################## add_test (NAME MPI_TEST_FORT_parallel_test COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:parallel_test> ${MPIEXEC_POSTFLAGS}) +add_test (NAME MPI_TEST_FORT_subfiling_test COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:subfiling_test> ${MPIEXEC_POSTFLAGS})
\ No newline at end of file diff --git a/fortran/testpar/Makefile.am b/fortran/testpar/Makefile.am index 00538f4..bd5c725 100644 --- a/fortran/testpar/Makefile.am +++ b/fortran/testpar/Makefile.am @@ -33,14 +33,15 @@ else endif # These are our main targets -TEST_PROG_PARA=parallel_test +TEST_PROG_PARA=parallel_test subfiling_test check_PROGRAMS=$(TEST_PROG_PARA) # Temporary files -CHECK_CLEANFILES+=parf[12].h5 +CHECK_CLEANFILES+=parf[12].h5 subf.h5* # Test source files parallel_test_SOURCES=ptest.F90 hyper.F90 mdset.F90 +subfiling_test_SOURCES=subfiling.F90 # The tests depend on several libraries. LDADD=$(LIBH5FTEST) $(LIBH5TEST) $(LIBH5F) $(LIBHDF5) diff --git a/fortran/testpar/hyper.F90 b/fortran/testpar/hyper.F90 index 4dc18a7..910fe1f 100644 --- a/fortran/testpar/hyper.F90 +++ b/fortran/testpar/hyper.F90 @@ -29,7 +29,6 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) 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, INTENT(inout) :: nerrors ! number of errors - INTEGER :: mpierror ! MPI hdferror flag INTEGER :: hdferror ! HDF hdferror flag INTEGER(hsize_t), DIMENSION(1) :: dims ! dataset dimensions INTEGER(hsize_t), DIMENSION(1) :: cdims ! chunk dimensions @@ -285,33 +284,33 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) CALL check("h5pcreate_f", hdferror, nerrors) CALL h5pset_fapl_mpio_f(fapl_id, MPI_COMM_WORLD, MPI_INFO_NULL, hdferror) - CALL check("h5pcreate_f", hdferror, nerrors) + CALL check("h5pset_fapl_mpio_f", hdferror, nerrors) CALL h5fopen_f(filename, H5F_ACC_RDWR_F, file_id, hdferror, access_prp = fapl_id) - CALL check("h5pcreate_f", hdferror, nerrors) + CALL check("h5fopen_f", hdferror, nerrors) CALL h5screate_simple_f(1, dims, fspace_id, hdferror) - CALL check("h5pcreate_f", hdferror, nerrors) + CALL check("h5screate_simple_f", hdferror, nerrors) CALL h5screate_simple_f(1, dims, mspace_id, hdferror) - CALL check("h5pcreate_f", hdferror, nerrors) + CALL check(" h5screate_simple_f", hdferror, nerrors) CALL h5dopen_f(file_id, "dset", dset_id, hdferror) - CALL check("h5pcreate_f", hdferror, nerrors) + CALL check("h5dopen_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) + 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("h5pcreate_f", hdferror, nerrors) + CALL check("h5sselect_hyperslab_f", hdferror, nerrors) ! ! create a property list for collective dataset read @@ -322,7 +321,7 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) IF (do_collective) THEN CALL h5pset_dxpl_mpio_f(dxpl_id, H5FD_MPIO_COLLECTIVE_F, hdferror) - CALL check("h5pcreate_f", hdferror, nerrors) + CALL check("h5pset_dxpl_mpio_f", hdferror, nerrors) ENDIF ! @@ -330,29 +329,29 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) ! 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) + CALL check("h5dread_f", hdferror, nerrors) ! ! close HDF5 I/O ! CALL h5pclose_f(fapl_id, hdferror) - CALL check("h5pcreate_f", hdferror, nerrors) + CALL check("h5pclose_f", hdferror, nerrors) CALL h5pclose_f(dxpl_id, hdferror) - CALL check("h5pcreate_f", hdferror, nerrors) + CALL check("h5pclose_f", hdferror, nerrors) CALL h5sclose_f(fspace_id, hdferror) - CALL check("h5pcreate_f", hdferror, nerrors) + CALL check("h5sclose_f", hdferror, nerrors) CALL h5sclose_f(mspace_id, hdferror) - CALL check("h5pcreate_f", hdferror, nerrors) + CALL check("h5sclose_f", hdferror, nerrors) CALL h5dclose_f(dset_id, hdferror) - CALL check("h5pcreate_f", hdferror, nerrors) + CALL check("h5dclose_f", hdferror, nerrors) CALL h5fclose_f(file_id, hdferror) - CALL check("h5pcreate_f", hdferror, nerrors) + CALL check("h5fclose_f", hdferror, nerrors) ! ! compare read and write data. each process compares a subset of the array diff --git a/fortran/testpar/mdset.F90 b/fortran/testpar/mdset.F90 index 9aa7b9e..917c193 100644 --- a/fortran/testpar/mdset.F90 +++ b/fortran/testpar/mdset.F90 @@ -29,7 +29,6 @@ SUBROUTINE multiple_dset_write(length, do_collective, do_chunk, mpi_size, mpi_ra 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, INTENT(inout) :: nerrors ! number of errors - INTEGER :: mpierror ! MPI hdferror flag INTEGER :: hdferror ! HDF hdferror flag INTEGER(hsize_t), DIMENSION(1) :: dims ! dataset dimensions INTEGER(hsize_t), DIMENSION(1) :: cdims ! chunk dimensions diff --git a/fortran/testpar/ptest.F90 b/fortran/testpar/ptest.F90 index 30abb88..0883ac2 100644 --- a/fortran/testpar/ptest.F90 +++ b/fortran/testpar/ptest.F90 @@ -29,7 +29,7 @@ PROGRAM parallel_test 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 + INTEGER :: i,j, sum ! use collective MPI I/O LOGICAL, DIMENSION(1:2) :: do_collective = (/.FALSE.,.TRUE./) CHARACTER(LEN=11), DIMENSION(1:2) :: chr_collective =(/"independent", "collective "/) @@ -82,6 +82,8 @@ PROGRAM parallel_test ! CALL h5close_f(hdferror) + CALL MPI_ALLREDUCE(total_error, sum, 1, MPI_INTEGER, MPI_SUM, MPI_COMM_WORLD, mpierror) + ! ! close MPI ! diff --git a/fortran/testpar/subfiling.F90 b/fortran/testpar/subfiling.F90 new file mode 100644 index 0000000..330bab8 --- /dev/null +++ b/fortran/testpar/subfiling.F90 @@ -0,0 +1,391 @@ +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! Copyright by The HDF Group. * +! Copyright by the Board of Trustees of the University of Illinois. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the COPYING file, which can be found at the root of the source code * +! distribution tree, or in https://www.hdfgroup.org/licenses. * +! If you do not have access to either file, you may request a copy from * +! help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + +! +! main program for subfiling HDF5 Fortran tests +! + +#include <H5config_f.inc> + +PROGRAM subfiling_test + USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_INT64_T + USE HDF5 + USE MPI + USE TH5_MISC + + 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 + +#ifdef H5_HAVE_SUBFILING_VFD + + 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 + LOGICAL :: file_exists + + INTEGER(HID_T) :: fapl_id + INTEGER(HID_T) :: file_id + INTEGER :: comm, comm_ret + INTEGER :: 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 + + INTEGER :: nerrors = 0 + + INTEGER(HID_T) :: driver_id + + ! + ! initialize MPI + ! + required = MPI_THREAD_MULTIPLE + CALL mpi_init_thread(required, provided, mpierror) + IF (mpierror .NE. MPI_SUCCESS) THEN + WRITE(*,*) "MPI_INIT_THREAD *FAILED*" + nerrors = nerrors + 1 + ENDIF + IF (provided .NE. required) THEN + WRITE(*,*) "MPI doesn't support MPI_Init_thread with MPI_THREAD_MULTIPLE *FAILED*" + nerrors = nerrors + 1 + ENDIF + CALL mpi_comm_rank( MPI_COMM_WORLD, mpi_rank, mpierror ) + IF (mpierror .NE. MPI_SUCCESS) THEN + WRITE(*,*) "MPI_COMM_RANK *FAILED* Process = ", mpi_rank + nerrors = nerrors + 1 + ENDIF + CALL mpi_comm_size( MPI_COMM_WORLD, mpi_size, mpierror ) + IF (mpierror .NE. MPI_SUCCESS) THEN + WRITE(*,*) "MPI_COMM_SIZE *FAILED* Process = ", mpi_rank + nerrors = nerrors + 1 + ENDIF + + IF(nerrors.NE.0)THEN + 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) + ENDIF + + ! + ! initialize the HDF5 fortran interface + ! + CALL h5open_f(hdferror) + + ! *********************************** + ! Test H5Pset/get_mpi_params_f APIs + ! *********************************** + nerrors = 0 + IF(mpi_size.GT.2)THEN + + IF (mpi_rank.LE.1)THEN + CALL MPI_Comm_split(MPI_COMM_WORLD, 1, mpi_rank, comm, mpierror) + ELSE + CALL MPI_Comm_split(MPI_COMM_WORLD, 0, mpi_rank, comm, mpierror) + ENDIF + + CALL MPI_Info_create(info, mpierror) + CALL MPI_Info_set( info, "foo", "bar", mpierror) + + IF (mpi_rank.LE.1)THEN + + CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl_id, hdferror) + CALL check("h5pcreate_f", hdferror, nerrors) + + CALL H5Pset_mpi_params_f(fapl_id, comm, info, hdferror) + CALL check("H5Pset_mpi_params_f", hdferror, nerrors) + + CALL H5Pget_mpi_params_f(fapl_id, comm_ret, info_ret, hdferror) + CALL check("H5Pget_mpi_params_f", hdferror, nerrors) + + CALL mpi_comm_size(comm_ret, mpi_size_ret, mpierror) + + IF(mpi_size_ret.NE.2)THEN + IF(mpi_rank.EQ.0) & + WRITE(*,*) "Failed H5Pset_mpi_params_f and H5Pget_mpi_params_f sequence" + nerrors = nerrors + 1 + ENDIF + + CALL mpi_info_get(info_ret,"foo", 3, info_val, flag, mpierror) + IF(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" + nerrors = nerrors + 1 + ENDIF + ELSE + IF(mpi_rank.EQ.0) & + WRITE(*,*) "Failed to find info value with mpi_info_get" + nerrors = nerrors + 1 + ENDIF + CALL h5pclose_f(fapl_id, hdferror) + ENDIF + + CALL MPI_Comm_free(comm, mpierror) + CALL MPI_Info_free(info, mpierror) + + ENDIF + + CALL MPI_REDUCE(nerrors, sum, 1, MPI_INTEGER, MPI_SUM, 0, MPI_COMM_WORLD, mpierror) + IF(mpi_rank==0) CALL write_test_status(sum, & + 'Testing H5Pset/get_mpi_params_f', total_error) + + ! ********************************************************* + ! Setup file access property list with subfiling I/O access + ! ********************************************************* + + nerrors = 0 + CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl_id, hdferror) + CALL check("h5pcreate_f", hdferror, nerrors) + + CALL H5Pset_mpi_params_f(fapl_id, MPI_COMM_WORLD, MPI_INFO_NULL, hdferror) + CALL check("H5Pset_mpi_params_f", hdferror, nerrors) + + CALL H5Pget_mpi_params_f(fapl_id, comm, info, hdferror) + CALL check("H5Pset_mpi_params_f", hdferror, nerrors) + + CALL mpi_comm_size(comm, mpi_size_ret, mpierror) + IF(mpi_size_ret.NE.mpi_size)THEN + IF(mpi_rank.EQ.0) & + WRITE(*,*) "Failed H5Pset_mpi_params_f and H5Pget_mpi_params_f sequence" + nerrors = nerrors + 1 + ENDIF + + IF(mpi_rank==0) CALL write_test_status(nerrors, & + 'Testing H5Pset/get_mpi_params_f with defaults ', total_error) + + ! Verify no new enum parameters have been added in C and not updated in Fortran + IF( IOC_SELECTION_OPTIONS_F .NE. 4)THEN + IF(mpi_rank.EQ.0) & + WRITE(*,*) "Mismatch between Fortran and C H5FD_subfiling_ioc_select_t definitions" + nerrors = nerrors + 1 + ENDIF + + IF(mpi_rank==0) CALL write_test_status(nerrors, & + 'Testing Subfiling FD is registered', total_error) + + ! ********************************************************* + ! Check the default subfiling parameters + ! ********************************************************* + nerrors = 0 + CALL h5pset_fapl_subfiling_f(fapl_id, hdferror) + CALL check("h5pset_fapl_subfiling_f", hdferror, nerrors) + + CALL h5pget_driver_f(fapl_id, driver_id, hdferror) + CALL check("h5pget_driver_f", hdferror, nerrors) + + IF( driver_id .NE. H5FD_SUBFILING_F) THEN + WRITE(*,*) "Wrong file driver type returned" + nerrors = nerrors + 1 + ENDIF + + ! ********************************************************* + ! Check the default parameters for subfiling and ioc + ! ********************************************************* + + CALL h5pget_fapl_subfiling_f(fapl_id, vfd_config, hdferror) + CALL check("h5pget_fapl_subfiling_f", hdferror, nerrors) + + CALL h5pset_fapl_ioc_f(vfd_config%ioc_fapl_id, hdferror) + CALL check("h5pset_fapl_ioc_f", hdferror, nerrors) + + CALL h5pget_fapl_ioc_f(vfd_config%ioc_fapl_id, vfd_config_ioc, hdferror) + CALL check("h5pget_fapl_ioc_f", hdferror, nerrors) + + IF(vfd_config%magic .NE. H5FD_SUBFILING_FAPL_MAGIC_F .OR. & + vfd_config%version .NE. H5FD_SUBFILING_CURR_FAPL_VERSION_F .OR. & + vfd_config%require_ioc .NEQV. .TRUE. .OR. & + vfd_config%shared_cfg%ioc_selection .NE. SELECT_IOC_ONE_PER_NODE_F .OR. & + vfd_config%shared_cfg%stripe_size .NE. H5FD_SUBFILING_DEFAULT_STRIPE_SIZE_F .OR. & + vfd_config%shared_cfg%stripe_count .NE. H5FD_SUBFILING_DEFAULT_STRIPE_COUNT_F & + )THEN + IF(mpi_rank.EQ.0) & + WRITE(*,*) "Failed h5pget_fapl_subfiling_f" + nerrors = nerrors + 1 + ENDIF + + IF(mpi_rank==0) CALL write_test_status(nerrors, & + 'Testing H5Pset/get_fapl_subfiling_f with defaults', total_error) + + nerrors = 0 + IF(vfd_config_ioc%magic.NE. H5FD_IOC_FAPL_MAGIC_F .OR. & + vfd_config_ioc%version .NE. H5FD_IOC_CURR_FAPL_VERSION_F .OR. & + vfd_config_ioc%thread_pool_size .NE. H5FD_IOC_DEFAULT_THREAD_POOL_SIZE_F & + )THEN + IF(mpi_rank.EQ.0) & + WRITE(*,*) "Failed h5pget_fapl_ioc_f" + nerrors = nerrors + 1 + ENDIF + + IF(mpi_rank==0) CALL write_test_status(nerrors, & + 'Testing H5Pset/get_fapl_ioc_f with defaults', total_error) + + ! ********************************************************* + ! Testing creating a file with subfiling, default settings + ! ********************************************************* + + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, hdferror, access_prp = fapl_id) + CALL check("h5fcreate_f", hdferror, nerrors) + + CALL h5fclose_f(file_id, hdferror) + CALL check("h5fclose_f", hdferror, nerrors) + + IF(mpi_rank==0) CALL write_test_status(nerrors, & + 'Testing H5Fcreate with subfiling with default settings', total_error) + + ! ********************************************************* + ! Testing creating a file with subfiling, modified settings + ! ********************************************************* + + ! 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%require_ioc = .TRUE. + vfd_config%shared_cfg%ioc_selection = SELECT_IOC_ONE_PER_NODE_F + vfd_config%shared_cfg%stripe_size = 16*1024*1024 + vfd_config%shared_cfg%stripe_count = 3 + + nerrors = 0 + CALL h5pset_fapl_subfiling_f(fapl_id, hdferror, vfd_config) + CALL check("h5pset_fapl_ioc_f", hdferror, nerrors) + + CALL h5pget_fapl_subfiling_f(fapl_id, vfd_config, hdferror) + CALL check("h5pget_fapl_ioc_f", hdferror, nerrors) + + IF(vfd_config%magic .NE. H5FD_SUBFILING_FAPL_MAGIC_F .OR. & + vfd_config%version .NE. H5FD_SUBFILING_CURR_FAPL_VERSION_F .OR. & + vfd_config%require_ioc .NEQV. .TRUE. .OR. & + vfd_config%shared_cfg%ioc_selection .NE. SELECT_IOC_ONE_PER_NODE_F .OR. & + vfd_config%shared_cfg%stripe_size .NE. 16*1024*1024 .OR. & + vfd_config%shared_cfg%stripe_count .NE. 3 & + )THEN + IF(mpi_rank.EQ.0) & + WRITE(*,*) "Failed h5pget_fapl_subfiling_f" + nerrors = nerrors + 1 + ENDIF + + 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%thread_pool_size = 2 + + nerrors = 0 + CALL h5pset_fapl_ioc_f(vfd_config%ioc_fapl_id, hdferror, vfd_config_ioc) + CALL check("h5pset_fapl_ioc_f", hdferror, nerrors) + + CALL h5pget_fapl_ioc_f(vfd_config%ioc_fapl_id, vfd_config_ioc, hdferror) + CALL check("h5pget_fapl_ioc_f", hdferror, nerrors) + + IF(vfd_config_ioc%magic .NE. H5FD_IOC_FAPL_MAGIC_F .OR. & + vfd_config_ioc%version .NE. H5FD_IOC_CURR_FAPL_VERSION_F .OR. & + vfd_config_ioc%thread_pool_size .NE. 2 & + )THEN + IF(mpi_rank.EQ.0) & + WRITE(*,*) "Failed h5pget_fapl_ioc_f" + nerrors = nerrors + 1 + ENDIF + IF(mpi_rank==0) CALL write_test_status(nerrors, & + 'Testing H5Pset/get_fapl_ioc_f with custom settings', total_error) + + ! ********************************************************* + ! Testing creating a file with subfiling, custom settings + ! ********************************************************* + + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, hdferror, access_prp = fapl_id) + CALL check("h5pcreate_f", hdferror, nerrors) + + CALL h5fclose_f(file_id, hdferror) + CALL check("h5fclose_f", hdferror, nerrors) + + IF(mpi_rank.EQ.0)THEN + INQUIRE(FILE=filename, EXIST=file_exists) + IF(.NOT.file_exists)THEN + WRITE(*,"(A,A)") "Failed to find the stub subfile ",TRIM(filename) + nerrors = nerrors + 1 + ENDIF + + CALL EXECUTE_COMMAND_LINE("stat --format='%i' "//filename//" >> tmp_inode", EXITSTAT=i) + IF(i.ne.0)THEN + WRITE(*,"(A,A)") "Failed to stat the stub subfile ",TRIM(filename) + nerrors = nerrors + 1 + ENDIF + + OPEN(11,FILE="tmp_inode") + READ(11,*) inode + CLOSE(11,STATUS="delete") + + DO i = 1, vfd_config%shared_cfg%stripe_count + WRITE(subfname,'(A,".subfile_",I0,"_",I0,"_of_",I0)') filename,inode,i,vfd_config%shared_cfg%stripe_count + INQUIRE(FILE=subfname, EXIST=file_exists) + IF(.NOT.file_exists)THEN + WRITE(*,"(A,A)") "Failed to create the subfile ",TRIM(subfname) + nerrors = nerrors + 1 + ENDIF + ENDDO + + ENDIF + + CALL h5pclose_f(fapl_id, hdferror) + CALL check("h5pclose_f", hdferror, nerrors) + + IF(mpi_rank==0) CALL write_test_status(nerrors, & + 'Testing H5Fcreate with subfiling with custom settings', total_error) + + ! + ! close HDF5 interface + ! + CALL h5close_f(hdferror) + + CALL MPI_ALLREDUCE(total_error, sum, 1, MPI_INTEGER, MPI_SUM, MPI_COMM_WORLD, mpierror) + + ! + ! close MPI + ! + IF (sum == 0) THEN + CALL mpi_finalize(mpierror) + IF (mpierror .NE. MPI_SUCCESS) THEN + WRITE(*,*) "MPI_FINALIZE *FAILED* Process = ", mpi_rank + ENDIF + ELSE + WRITE(*,*) 'Errors detected in process ', mpi_rank + CALL mpi_abort(MPI_COMM_WORLD, 1, mpierror) + IF (mpierror .NE. MPI_SUCCESS) THEN + WRITE(*,*) "MPI_ABORT *FAILED* Process = ", mpi_rank + ENDIF + ENDIF + ! + ! end main program + ! + +#else + + CALL mpi_init(mpierror) + CALL mpi_comm_rank(MPI_COMM_WORLD, mpi_rank, mpierror) + IF(mpi_rank==0) CALL write_test_status( -1, & + 'Subfiling not enabled', total_error) + CALL mpi_finalize(mpierror) + +#endif + +END PROGRAM subfiling_test |