I need help with arrays bigger than 7 dimensions in Fortran with HDF5.
Here’s a simplified version of my code:
PROGRAM H5_RDWT
USE HDF5
IMPLICIT NONE
CHARACTER(LEN=8), PARAMETER :: filename = "dsetf.h5"
CHARACTER(LEN=4), PARAMETER :: dsetname = "dset"
INTEGER(HID_T) :: file_id, dset_id
INTEGER :: error
INTEGER, DIMENSION(2,2,2,2,2,2,2,2) :: dset_data, data_out
INTEGER(HSIZE_T), DIMENSION(8) :: data_dims = [2,2,2,2,2,2,2,2]
CALL h5open_f(error)
CALL h5fopen_f(filename, H5F_ACC_RDWR_F, file_id, error)
CALL h5dopen_f(file_id, dsetname, dset_id, error)
CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, dset_data, data_dims, error)
CALL h5dread_f(dset_id, H5T_NATIVE_INTEGER, data_out, data_dims, error)
CALL h5dclose_f(dset_id, error)
CALL h5fclose_f(file_id, error)
CALL h5close_f(error)
END PROGRAM H5_RDWT
Compiler Command:
gfortran -o test test.f90 -I/pfs/work/g2pbloch/my_hdf5/hdf5-1.14.0/hdf5/include -L/pfs/work/g2pbloch/my_hdf5/hdf5-1.14.0/hdf5/lib -lhdf5_fortran
Errors:
test.f90:22:75:
22 | CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, dset_data, data_dims, error)
| 1
Error: There is no specific subroutine for the generic ‘h5dwrite_f’ at (1)
test.f90:25:73:
25 | CALL h5dread_f(dset_id, H5T_NATIVE_INTEGER, data_out, data_dims, error)
| 1
Error: There is no specific subroutine for the generic ‘h5dread_f’ at (1)
Questions:
- Is there a limit to array dimensions with HDF5 in Fortran?
- How can I resolve these compilation errors?
Any advice or workaround would be appreciated!
Thanks!
Environment:
Fortran: Gfortran 12.2.0
HDF5: 14.0
OS: CentOS Linux release 7.4.1708