HDFGroup / HDFGroup/hdf5

Issue with 1.14.0 HDF5 in Fortran

Open
#5,803 0 comments 0 reactions 1 assignee Claimed by @brtnfld View on GitHub
Dominant language
C
Stars
988
Forks
355
Avg merge
4d 2h
Merged PRs (30d)
12

Description

I am not sure if this is the right place to ask about this, but see attached output_1.txt showing the error messages from HDF5 at the bottom of the file.

[output_1.txt](https://github.com/user-attachments/files/22266772/output_1.txt)

I cannot share the full code but I will put the part that calls HDF5 below:

```
call createAndOpenH5EmptyFile("output_HDF", hdf5_file_id, hdf5_plist_id)
call addIntegerAttribute(hdf5_file_id, "num_phases", 3)
call addIntegerVectorAttribute(hdf5_file_id, "nx_ny_nz", dims_global)
call CloseH5File(hdf5_file_id, hdf5_plist_id)

call openExistingH5ReadWrite("Generated_microstructure_EVPFFTX_HDF", hdf5_file_id, hdf5_plist_id)
call readOrWriteDatasetStateful(euler_angles_HDF5,"euler_angles", dims_global, xyz_offset, hdf5_file_id, "write")
call CloseH5File(hdf5_file_id, hdf5_plist_id)
```
The first part of file creation and add attribute works just fine, the file is created and the attributes are added. The second part attempts to write a 4D data of euler_angles of dimensions (3, 256, 256, 256) into the file. The custom wrapper "readOrWriteDatasetStateful" identifies that euler_angles_HDF5 is a 4D variable, and calls the following H5 subroutine:

`call h5dwrite_f(dset_id, dtype_id, data, array_subsize, ierr, memspace, filespace, p_access_list)`

The default real data type in the outer code is 1.0d0 and the H5 subroutines all use real64. The code is compiled with mpif90 but it only uses one CPU when running. The HDF5 and other libraries are built in a conda environment, where this code is also executed.

The code reaches the h5dwrite_f call and begins printing a lot of "mca_fbtl_posix_pwritev: error in writev:Bad address" messages before failing, starting with the error messages (see attached file):

```
mca_fbtl_posix_pwritev: error in writev:Bad address
mca_fbtl_posix_pwritev: error in writev:Bad address
HDF5-DIAG: Error detected in HDF5 (1.14.0) MPI-process 0:
#000: H5B.c line 986 in H5B__insert_helper(): can't insert subtree
major: B-Tree node
minor: Unable to insert object
#001: H5B.c line 1089 in H5B__insert_helper(): unable to unprotect child
major: B-Tree node
minor: Unable to unprotect metadata

```

I cannot figure out what might cause this and searching the bad address message also doesn't yield any useful results on google. Any help would be much appreciated!

PS: Some more findings: writing data for 32x32x32 and 64x64x64 size data works perfectly fine, but has those issues for 128x128x128 and 256x256x256 and presumably larger data too. ChatGPT suggests it is an error from openMPI, but I have no clue what might be causing it because the same HDF5 calls work perfectly fine in a different code.

The example above tries to write a 4-dimensional real data. But the same errors show up when trying to write integer data too.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.