Hi all,
I'm having some trouble grasping h5dset_extent_f's use within an
unlimited, chunked dataset. I repeatably see
> HDF5-DIAG: Error detected in HDF5 (1.8.4) thread 47063872457504:
> #000: ../../../src/H5Dio.c line 245 in H5Dwrite(): file selection+offset
> not within extent
> major: Dataspace
> minor: Out of range
when calling h5dwrite_f. but I believe the hyperslab I want to write
is within the extended extent.
Attached is a small, commented recreate for ifort or gfortran against
serial HDF5 1.8.4 (build and run with 'h5fc test.F90 && ./a.out').
Any help would be much appreciated,
Rhys
PROGRAM TEST
USE HDF5
IMPLICIT NONE
INTEGER(HID_T) :: file, cparams, dataset, memspace, filespace, dataspace
INTEGER(HSIZE_T) :: start(1), dims(1), maxdims(1)
INTEGER :: error, i
! Open the output file
CALL h5open_f (error)
CALL h5fcreate_f ("test.h5", H5F_ACC_TRUNC_F, file, error)
! Create chunked dataset to store discrete solution times
dims = 2
maxdims = H5S_UNLIMITED_F
CALL h5screate_simple_f (1, dims, dataspace, error, maxdims)
CALL h5pcreate_f (H5P_DATASET_CREATE_F, cparams, error)
dims = 1
CALL h5pset_chunk_f (cparams, 1, dims, error)
CALL h5pset_fill_time_f (cparams, H5D_FILL_TIME_NEVER_F, error)
CALL h5dcreate_f (file, "t", H5T_NATIVE_DOUBLE, dataspace, &
dataset, error, dcpl_id = cparams)
! Create dataspace describing how a scalar is stored in memory
dims = 1
CALL h5screate_simple_f (1, dims, memspace, error)
! Create dataspace describing how one solution time is stored on disk
CALL h5dget_space_f (dataset, filespace, error)
! Write first scalar
start = 0
dims = 1
CALL h5sselect_hyperslab_f (filespace, H5S_SELECT_SET_F, &
start, dims, error)
CALL h5dwrite_f (dataset, H5T_NATIVE_DOUBLE, 123d0, &
dims, error, memspace, filespace)
! Write second scalar
start = 1
dims = 1
CALL h5sselect_hyperslab_f (filespace, H5S_SELECT_SET_F, &
start, dims, error)
CALL h5dwrite_f (dataset, H5T_NATIVE_DOUBLE, 456d0, &
dims, error, memspace, filespace)
! Extend dataset to handle third scalar
error = 0
dims = 3
CALL h5dset_extent_f (dataset, dims, error)
IF (error < 0) CALL ABORT
! Write third scalar, which gives messages like the following
! HDF5-DIAG: Error detected in HDF5 (1.8.4) thread 47089750993696:
! #000: ../../../src/H5Dio.c line 245 in H5Dwrite(): file selection+offset not within extent
! major: Dataspace
! minor: Out of range
start = 2
dims = 1
CALL h5sselect_hyperslab_f (filespace, H5S_SELECT_SET_F, &
start, dims, error)
CALL h5dwrite_f (dataset, H5T_NATIVE_DOUBLE, 789d0, &
dims, error, memspace, filespace)
! Tear down
CALL h5fclose_f (file, error)
CALL h5pclose_f (cparams, error)
CALL h5dclose_f (dataset, error)
CALL h5sclose_f (memspace, error)
CALL h5sclose_f (filespace, error)
CALL h5close_f (error)
END PROGRAM TEST
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org