Page tree









Sets the size of the chunks used to store a chunked layout dataset


H5P_SET_CHUNK ( plist, ndims, dim )


herr_t H5Pset_chunk(hid_t plist,
            int ndims,
            const hsize_t * dim

Fortran90 Interface: h5pset_chunk_f

SUBROUTINE h5pset_chunk_f(prp_id, ndims, dims, hdferr) 
  INTEGER(HID_T), INTENT(IN) :: prp_id  ! Property list identifier 
  INTEGER, INTENT(IN) :: ndims          ! Number of chunk dimensions
  INTEGER(HSIZE_T), DIMENSION(ndims), INTENT(IN) :: dims    
                                        ! Array containing sizes of
                                        ! chunk dimensions
  INTEGER, INTENT(OUT) :: hdferr        ! Error code
                                        ! 0 on success and -1 on failure
END SUBROUTINE h5pset_chunk_f

hid_t plistIN: Dataset creation property list identifier
int ndimsIN: The number of dimensions of each chunk
const hsize_t * dim    IN: An array defining the size, in dataset elements, of each chunk


H5P_SET_CHUNK sets the size of the chunks used to store a chunked layout dataset. This function is only valid for dataset creation property lists.

The ndims parameter currently must be the same size as the rank of the dataset.

The values of the dim array define the size of the chunks to store the dataset's raw data. The unit of measure for dim values is dataset elements.

As a side-effect of this function, the layout of the dataset is changed to H5D_CHUNKED, if it is not already so set. (See H5P_SET_LAYOUT.)

Chunk size cannot exceed the size of a fixed-size dataset. For example, a dataset consisting of a 5x4 fixed-size array cannot be defined with 10x10 chunks.

Chunk maximums:

  • The maximum number of elements in a chunk is 232-1 which is equal to 4,294,967,295. If the number of elements in a chunk is set via H5P_SET_CHUNK to a value greater than 232-1, then H5P_SET_CHUNK will fail.
  • The maximum size for any chunk is 4GB. If a chunk that is larger than 4GB attempts to be written with H5D_WRITE, then H5D_WRITE will fail.



Returns a non-negative value if successful; otherwise returns a negative value.


examples / h5_extend.c [70:73]
 1.10/master  HDFFV/hdf5  Copy
    /* Modify dataset creation properties, i.e. enable chunking  */
    prop = H5Pcreate (H5P_DATASET_CREATE);
    status = H5Pset_chunk (prop, RANK, chunk_dims);

fortran / examples / h5_extend.f90 [108:110]
 1.10/master  HDFFV/hdf5  Copy
  CALL h5pcreate_f(H5P_DATASET_CREATE_F, crp_list, error)

  CALL h5pset_chunk_f(crp_list, RANK, dimsc, error)

Release    Change
1.8.16Added chunk size limit note to Description.

--- Last Modified: August 07, 2019 | 12:08 PM