Error to write and read HDF5 data with MPI in Fortran

Dear all,

I am trying to write and read HDF5 dataset to do post-processing in a workstation. However, I got the below errors, while it works well in a HPC system. We have tried to change the compiler, system environments and the version of HDF5, but all of them do not work. If someone can give me some tips, I appreciate very much.

######################################################
Error in write HDF5 dataset:
HDF5-DIAG: Error detected in HDF5 (1.10.1) HDF5-DIAG: Error detected in HDF5 (1.10.1) MPI-process 18:
#000: H5Dio.c line 269 in H5Dwrite(): can’t prepare for writing data
major: Dataset
minor: Write failed
#001: H5Dio.c line 345 in H5D__pre_write(): can’t write data
major: Dataset
minor: Write failed
#002: H5Dio.c line 791 in H5D__write(): can’t write data
major: Dataset
minor: Write failed
#003: H5Dmpio.c line 527 in H5D__contig_collective_write(): couldn’t finish shared collective MPI-IO
major: Low-level I/O
minor: Write failed
#004: H5Dmpio.c line 1398 in H5D__inter_collective_io(): couldn’t finish collective MPI-IO
major: Low-level I/O
minor: Can’t get value
#005: H5Dmpio.c line 1442 in H5D__final_collective_io(): optimized write failed
major: Dataset
minor: Write failed
#006: H5Dmpio.c line 295 in H5D__mpio_select_write(): can’t finish collective parallel write
major: Low-level I/O
minor: Write failed
#007: H5Fio.c line 195 in H5F_block_write(): write through page buffer failed
major: Low-level I/O
minor: Write failed
#008: H5PB.c line 1041 in H5PB_write(): write through metadata accumulator failed
major: Page Buffering
minor: Write failed
#009: H5Faccum.c line 834 in H5F__accum_write(): file write failed
major: Low-level I/O
minor: Write failed
#010: H5FDint.c line 308 in H5FD_write(): driver write request failed
major: Virtual File Layer
minor: Write failed
#011: H5FDmpio.c line 1793 in H5FD_mpio_write(): MPI_File_set_view failed
major: Internal error (too specific to document in detail)
minor: Some MPI function failed
#012: H5FDmpio.c line 1793 in H5FD_mpio_write(): Other I/O error , error stack:
ADIO_Set_view(48): **iobadoverlap displacements of filetype must be in a monotonically nondecreasing order
major: Internal error (too specific to document in detail)
minor: MPI Error String

######################################################
Code in write HDF5 data:
subroutine h5_savedata(g, var_name)
implicit none
real(8), dimension(lx, ny, nz) :: g
character(len=*) :: var_name

call H5Pcreate_f(H5P_FILE_ACCESS_F, prp_id, hdferr)
call H5Pset_fapl_mpio_f(prp_id, MPI_COMM_WORLD, MPI_INFO_NULL, hdferr)
call H5Fopen_f(h5_name, H5F_ACC_RDWR_F, file_id, hdferr, ACCESS_PRP=prp_id)
call H5Pclose_f(prp_id, hdferr)

call H5Screate_simple_f(dim, data_size, space_id, hdferr)
call H5Dcreate_f(file_id, var_name, H5T_NATIVE_DOUBLE, space_id, dset_id, hdferr)
call H5Sclose_f(space_id, hdferr)

call H5Screate_simple_f(dim, part_size, part_id, hdferr)
call H5Dget_space_f(dset_id, space_id, hdferr)
call H5Sselect_hyperslab_f(space_id, H5S_SELECT_SET_F, part_start, part_size, hdferr)
call H5Pcreate_f(H5P_DATASET_XFER_F, prp_id, hdferr)
call H5Pset_dxpl_mpio_f(prp_id, H5FD_MPIO_COLLECTIVE_F, hdferr)
call H5Dwrite_f(dset_id, H5T_NATIVE_DOUBLE, g, data_size, hdferr, part_id, space_id, prp_id)

call H5Pclose_f(prp_id, hdferr)
call H5Dclose_f(dset_id, hdferr)
call H5Sclose_f(part_id, hdferr)
call H5Sclose_f(space_id, hdferr)
call H5Fclose_f(file_id, hdferr)

return
end subroutine
(similar error in reading HDF5 file in the workstation, but no error in a HPC), Thanks a lot!

I’m assuming you are calling h5open_f offscreen.
You might want to check the hdferr values to ensure something did not fail; otherwise, all the steps shown should work.

Are you calling h5pset_file_space_strategy_f somewhere in your process? For your information, page buffering does not work in parallel.

Have you checked your HDF5 installation to see if all the tests pass?

Thanks a lot, brtnfld. I shall follow your suggestions to look up this settings.

I am not sure whether I am calling h5pset_file_space_strategy_f or not. Since I am new user of it, but I will learn more about it. Thanks for your hints.

Dear brtnfld, I tried to use the latest version, 1.14.05.

I configured the setup with: ./configure --prefix=/opt/software/hdf5_1405_diy --enable-fortran CC=mpicc CXX=mpicxx FC=mpiifort --enable-parallel

However, I got the following error in the configure:
configure: error: unable to link a simple MPI-IO Fortran program

Is there anything wrong with my configure command? or else issues.

Best,
Bin

We solved the issue with MPI-IO Fortran, but the initial errors are still there, even with the latest HDF5 version. I appreciate any further tips from you. Thanks!

I would ensure you are not enabling page buffering, as it does not work in parallel.

Thanks, brtnfld. Then, could you tell me how to add the page buffer in the configuration? Thanks in advance!