Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Content Layer
id1195548671
Content Column
width50.00001%
id1195578110
classrm_pagetree_col mobile-hide
Content Block
id1195578111
 
Content Column
width50.00001%
id1195548673
classhdf-rm-main-column
Content Block
id1195548672

Include Content
render-without-blockstrue
page.rm-navbar
HTML Wrap
classhdf-print-only

Page Title

HTML Wrap
classhdf-rm-summary-block

Hdf rm anchor
AnchorNamesummary

Excerpt

Sets the raw data chunk cache parameters

HTML Wrap
classhdf-rm-content-block

Hdf rm anchor
AnchorNameprocedure

Procedure:
HTML Wrap
classhdf-rm-section
HTML Wrap
classhdf_procedure

H5P_SET_CACHE ( plist_id, mdc_nelmts, rdcc_nslots, rdcc_nbytes, rdcc_w0 )

Note

Motivation: Setting raw data chunk cache parameters can be done with H5P_SET_CACHE, H5P_SET_CHUNK_CACHE, or a combination of both. H5P_SET_CACHE is used to adjust the chunk cache parameters for all datasets via a global setting for the file, and H5P_SET_CHUNK_CACHE is used to adjust the chunk cache parameters for individual datasets. When both are used, parameters set with H5P_SET_CHUNK_CACHE will override any parameters set with H5P_SET_CACHE.

Optimum chunk cache parameters may vary widely depending on different data layout and access patterns. For datasets with low performance requirements for example, changing the cache settings can save memory.

Note:  Raw dataset chunk caching is not currently supported when using the MPI I/O and MPI POSIX file drivers driver in read/write mode; see H5P_SET_FAPL_MPIO and H5P_SET_FAPL_MPIPOSIX, respectively . When using one of these this file driversdriver, all calls to H5D_READ and H5D_WRITE will access the disk directly, and H5P_SET_CACHE will have no effect on performance.

Raw dataset chunk caching is supported when these drivers are used in read-only mode.

Hdf rm anchor
AnchorNamesignature

Signature:
HTML Wrap
classhdf-rm-section
HTML Wrap
classhdf-togglebox hdf-c

HTML Add Class
hdf-togglebutton-visible
hdf-togglebutton-visible
selector.hdf-togglebutton.hdf-c

HTML
<pre><code class="language-c">herr_t H5Pset_cache(hid_t plist_id,
        int mdc_nelmts,
        size_t rdcc_nslots,
        size_t rdcc_nbytes,
        double rdcc_w0)</code></pre>
HTML Wrap
classhdf-togglebox hdf-fortran hdf-togglebox-hidden

HTML Add Class
hdf-togglebutton-visible
hdf-togglebutton-visible
selector.hdf-togglebutton.hdf-fortran

HTML
<pre><code class="language-fortran">Fortran90 Interface: h5pset_cache_f

SUBROUTINE h5pset_cache_f(prp_id, mdc_nelmts, rdcc_nslots, rdcc_nbytes, rdcc_w0, hdferr)
  IMPLICIT NONE
  INTEGER(HID_T), INTENT(IN) :: prp_id        ! Property list identifier
  INTEGER, INTENT(IN) :: mdc_nelmts           ! No longer used; any value passed
                                              ! is ignored.
  INTEGER(SIZE_T), INTENT(IN) :: rdcc_nslots  ! The number of chunk slots
                                              ! in the raw data chunk cache.
  INTEGER(SIZE_T), INTENT(IN) :: rdcc_nbytes  ! Total size of the raw data
                                              ! chunk cache in bytes.
  REAL, INTENT(IN) :: rdcc_w0                 ! Preemption policy
  INTEGER, INTENT(OUT) :: hdferr              ! Error code
                                              ! 0 on success and -1 on failure
END SUBROUTINE h5pset_cache_f
</code></pre>

Hdf rm anchor
AnchorNameparameters

Parameters:
HTML Wrap
classhdf-rm-section
hid_t plist_idIN: File access property list identifier
int mdc_nelmtsIN: No longer used; any value passed is ignored
size_t rdcc_nslots

IN: The number of chunk slots in the raw data chunk cache for this dataset

Increasing this value reduces the number of cache collisions, but slightly increases the memory used. Due to the hashing strategy, this value should ideally be a prime number. As a rule of thumb, this value should be at least 10 times the number of chunks that can fit in rdcc_nbytes bytes. For maximum performance, this value should be set approximately 100 times that number of chunks. The default value is 521.

size_t rdcc_nbytes

IN: Total size of the raw data chunk cache in bytes

The default size is 1 MB per dataset.

double rdcc_w0

IN: The chunk preemption policy for all datasets

This must be between 0 and 1 inclusive and indicates the weighting according to which chunks which have been fully read or written are penalized when determining which chunks to flush from cache. A value of 0 means fully read or written chunks are treated no differently than other chunks (the preemption is strictly LRU) while a value of 1 means fully read or written chunks are always preempted before other chunks. If your application only reads or writes data once, this can be safely set to 1. Otherwise, this should be set lower depending on how often you re-read or re-write the same data.

The default value is 0.75. If the value passed is H5D_CHUNK_CACHE_W0_DEFAULT, then the property will not be set on dapl_id, and the parameter will come from the file access property list.

Hdf rm anchor
AnchorNamedescription

Description:
HTML Wrap
classhdf-rm-section

H5P_SET_CACHE sets the number of elements, the total number of bytes, and the preemption policy value for all datasets in a file on the file’s file access property list.

The raw data chunk cache inserts chunks into the cache by first computing a hash value using the address of a chunk and then by using that hash value as the chunk’s index into the table of cached chunks. In other words, the size of this hash table and the number of possible hash values is determined by the rdcc_nslots parameter. If a different chunk in the cache has the same hash value, a collision will occur, which will reduce efficiency. If inserting the chunk into the cache would cause the cache to be too big, then the cache will be pruned according to the rdcc_w0 parameter.

The mdc_nelmts parameter is no longer used; any value passed in that parameter will be ignored.

Hdf rm anchor
AnchorNamereturns

Returns:
HTML Wrap
classhdf-rm-section

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

Hdf rm anchor
AnchorNameexample

Example:
HTML Wrap
classhdf-rm-section

Coming Soon!

Comment
HTML Wrap
classhdf-togglebox hdf-c

Bitbucket Server file
repoSlughdf5
branchIdrefs/heads/1.10/master
projectKeyHDFFV
filepathexamples/h5_subset.c
showLineNumberstrue
lineStart32
progLangcpp
lineEnd42
applicationLink5ac7b370-7412-3c8c-ad20-807a68261336

HTML Wrap
classhdf-togglebox hdf-fortran hdf-togglebox-hidden

Bitbucket Server file
repoSlughdf5
branchIdrefs/heads/1.10/master
projectKeyHDFFV
filepathfortran/examples/compound.f90
showLineNumberstrue
lineStart25
progLangplain
lineEnd35
applicationLink5ac7b370-7412-3c8c-ad20-807a68261336

Hdf rm anchor
AnchorNamehistory

History:
HTML Wrap
classhdf-rm-section
Release    Change
1.8.0In C, use of the mdc_nelmts parameter discontinued.
Metadata cache configuration is managed with H5P_SET_MDC_CONFIG and H5P_GET_MDC_CONFIG.
1.6.1Fortran rdcc_nbytes parameter type changed to INTEGER(SIZE_T).
1.6.0In C, the rdcc_nbytes and rdcc_nelmts parameters changed from type int to size_t.