H5ACpublic.h 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789
  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  2. * Copyright by The HDF Group. *
  3. * Copyright by the Board of Trustees of the University of Illinois. *
  4. * All rights reserved. *
  5. * *
  6. * This file is part of HDF5. The full HDF5 copyright notice, including *
  7. * terms governing use, modification, and redistribution, is contained in *
  8. * the COPYING file, which can be found at the root of the source code *
  9. * distribution tree, or in https://www.hdfgroup.org/licenses. *
  10. * If you do not have access to either file, you may request a copy from *
  11. * help@hdfgroup.org. *
  12. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  13. /*-------------------------------------------------------------------------
  14. *
  15. * Created: H5ACpublic.h
  16. * Jul 10 1997
  17. * Robb Matzke
  18. *
  19. * Purpose: Public include file for cache functions.
  20. *
  21. *-------------------------------------------------------------------------
  22. */
  23. #ifndef H5ACpublic_H
  24. #define H5ACpublic_H
  25. /* Public headers needed by this file */
  26. #include "H5public.h"
  27. #include "H5Cpublic.h"
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. /****************************************************************************
  32. *
  33. * structure H5AC_cache_config_t
  34. *
  35. * H5AC_cache_config_t is a public structure intended for use in public APIs.
  36. * At least in its initial incarnation, it is basically a copy of struct
  37. * H5C_auto_size_ctl_t, minus the report_fcn field, and plus the
  38. * dirty_bytes_threshold field.
  39. *
  40. * The report_fcn field is omitted, as including it would require us to
  41. * make H5C_t structure public.
  42. *
  43. * The dirty_bytes_threshold field does not appear in H5C_auto_size_ctl_t,
  44. * as synchronization between caches on different processes is handled at
  45. * the H5AC level, not at the level of H5C. Note however that there is
  46. * considerable interaction between this value and the other fields in this
  47. * structure.
  48. *
  49. * Similarly, the open_trace_file, close_trace_file, and trace_file_name
  50. * fields do not appear in H5C_auto_size_ctl_t, as most trace file
  51. * issues are handled at the H5AC level. The one exception is storage of
  52. * the pointer to the trace file, which is handled by H5C.
  53. *
  54. * The structure is in H5ACpublic.h as we may wish to allow different
  55. * configuration options for metadata and raw data caches.
  56. *
  57. * The fields of the structure are discussed individually below:
  58. *
  59. * version: Integer field containing the version number of this version
  60. * of the H5AC_cache_config_t structure. Any instance of
  61. * H5AC_cache_config_t passed to the cache must have a known
  62. * version number, or an error will be flagged.
  63. *
  64. * rpt_fcn_enabled: Boolean field used to enable and disable the default
  65. * reporting function. This function is invoked every time the
  66. * automatic cache resize code is run, and reports on its activities.
  67. *
  68. * This is a debugging function, and should normally be turned off.
  69. *
  70. * open_trace_file: Boolean field indicating whether the trace_file_name
  71. * field should be used to open a trace file for the cache.
  72. *
  73. * *** DEPRECATED *** Use H5Fstart/stop logging functions instead
  74. *
  75. * The trace file is a debugging feature that allow the capture of
  76. * top level metadata cache requests for purposes of debugging and/or
  77. * optimization. This field should normally be set to FALSE, as
  78. * trace file collection imposes considerable overhead.
  79. *
  80. * This field should only be set to TRUE when the trace_file_name
  81. * contains the full path of the desired trace file, and either
  82. * there is no open trace file on the cache, or the close_trace_file
  83. * field is also TRUE.
  84. *
  85. * close_trace_file: Boolean field indicating whether the current trace
  86. * file (if any) should be closed.
  87. *
  88. * *** DEPRECATED *** Use H5Fstart/stop logging functions instead
  89. *
  90. * See the above comments on the open_trace_file field. This field
  91. * should be set to FALSE unless there is an open trace file on the
  92. * cache that you wish to close.
  93. *
  94. * trace_file_name: Full path of the trace file to be opened if the
  95. * open_trace_file field is TRUE.
  96. *
  97. * *** DEPRECATED *** Use H5Fstart/stop logging functions instead
  98. *
  99. * In the parallel case, an ascii representation of the mpi rank of
  100. * the process will be appended to the file name to yield a unique
  101. * trace file name for each process.
  102. *
  103. * The length of the path must not exceed H5AC__MAX_TRACE_FILE_NAME_LEN
  104. * characters.
  105. *
  106. * evictions_enabled: Boolean field used to either report the current
  107. * evictions enabled status of the cache, or to set the cache's
  108. * evictions enabled status.
  109. *
  110. * In general, the metadata cache should always be allowed to
  111. * evict entries. However, in some cases it is advantageous to
  112. * disable evictions briefly, and thereby postpone metadata
  113. * writes. However, this must be done with care, as the cache
  114. * can grow quickly. If you do this, re-enable evictions as
  115. * soon as possible and monitor cache size.
  116. *
  117. * At present, evictions can only be disabled if automatic
  118. * cache resizing is also disabled (that is, ( incr_mode ==
  119. * H5C_incr__off ) && ( decr_mode == H5C_decr__off )). There
  120. * is no logical reason why this should be so, but it simplifies
  121. * implementation and testing, and I can't think of any reason
  122. * why it would be desirable. If you can think of one, I'll
  123. * revisit the issue.
  124. *
  125. * set_initial_size: Boolean flag indicating whether the size of the
  126. * initial size of the cache is to be set to the value given in
  127. * the initial_size field. If set_initial_size is FALSE, the
  128. * initial_size field is ignored.
  129. *
  130. * initial_size: If enabled, this field contain the size the cache is
  131. * to be set to upon receipt of this structure. Needless to say,
  132. * initial_size must lie in the closed interval [min_size, max_size].
  133. *
  134. * min_clean_fraction: double in the range 0 to 1 indicating the fraction
  135. * of the cache that is to be kept clean. This field is only used
  136. * in parallel mode. Typical values are 0.1 to 0.5.
  137. *
  138. * max_size: Maximum size to which the cache can be adjusted. The
  139. * supplied value must fall in the closed interval
  140. * [MIN_MAX_CACHE_SIZE, MAX_MAX_CACHE_SIZE]. Also, max_size must
  141. * be greater than or equal to min_size.
  142. *
  143. * min_size: Minimum size to which the cache can be adjusted. The
  144. * supplied value must fall in the closed interval
  145. * [H5C__MIN_MAX_CACHE_SIZE, H5C__MAX_MAX_CACHE_SIZE]. Also, min_size
  146. * must be less than or equal to max_size.
  147. *
  148. * epoch_length: Number of accesses on the cache over which to collect
  149. * hit rate stats before running the automatic cache resize code,
  150. * if it is enabled.
  151. *
  152. * At the end of an epoch, we discard prior hit rate data and start
  153. * collecting afresh. The epoch_length must lie in the closed
  154. * interval [H5C__MIN_AR_EPOCH_LENGTH, H5C__MAX_AR_EPOCH_LENGTH].
  155. *
  156. *
  157. * Cache size increase control fields:
  158. *
  159. * incr_mode: Instance of the H5C_cache_incr_mode enumerated type whose
  160. * value indicates how we determine whether the cache size should be
  161. * increased. At present there are two possible values:
  162. *
  163. * H5C_incr__off: Don't attempt to increase the size of the cache
  164. * automatically.
  165. *
  166. * When this increment mode is selected, the remaining fields
  167. * in the cache size increase section ar ignored.
  168. *
  169. * H5C_incr__threshold: Attempt to increase the size of the cache
  170. * whenever the average hit rate over the last epoch drops
  171. * below the value supplied in the lower_hr_threshold
  172. * field.
  173. *
  174. * Note that this attempt will fail if the cache is already
  175. * at its maximum size, or if the cache is not already using
  176. * all available space.
  177. *
  178. * Note that you must set decr_mode to H5C_incr__off if you
  179. * disable metadata cache entry evictions.
  180. *
  181. * lower_hr_threshold: Lower hit rate threshold. If the increment mode
  182. * (incr_mode) is H5C_incr__threshold and the hit rate drops below the
  183. * value supplied in this field in an epoch, increment the cache size by
  184. * size_increment. Note that cache size may not be incremented above
  185. * max_size, and that the increment may be further restricted by the
  186. * max_increment field if it is enabled.
  187. *
  188. * When enabled, this field must contain a value in the range [0.0, 1.0].
  189. * Depending on the incr_mode selected, it may also have to be less than
  190. * upper_hr_threshold.
  191. *
  192. * increment: Double containing the multiplier used to derive the new
  193. * cache size from the old if a cache size increment is triggered.
  194. * The increment must be greater than 1.0, and should not exceed 2.0.
  195. *
  196. * The new cache size is obtained my multiplying the current max cache
  197. * size by the increment, and then clamping to max_size and to stay
  198. * within the max_increment as necessary.
  199. *
  200. * apply_max_increment: Boolean flag indicating whether the max_increment
  201. * field should be used to limit the maximum cache size increment.
  202. *
  203. * max_increment: If enabled by the apply_max_increment field described
  204. * above, this field contains the maximum number of bytes by which the
  205. * cache size can be increased in a single re-size.
  206. *
  207. * flash_incr_mode: Instance of the H5C_cache_flash_incr_mode enumerated
  208. * type whose value indicates whether and by which algorithm we should
  209. * make flash increases in the size of the cache to accommodate insertion
  210. * of large entries and large increases in the size of a single entry.
  211. *
  212. * The addition of the flash increment mode was occasioned by performance
  213. * problems that appear when a local heap is increased to a size in excess
  214. * of the current cache size. While the existing re-size code dealt with
  215. * this eventually, performance was very bad for the remainder of the
  216. * epoch.
  217. *
  218. * At present, there are two possible values for the flash_incr_mode:
  219. *
  220. * H5C_flash_incr__off: Don't perform flash increases in the size of
  221. * the cache.
  222. *
  223. * H5C_flash_incr__add_space: Let x be either the size of a newly
  224. * newly inserted entry, or the number of bytes by which the
  225. * size of an existing entry has been increased.
  226. *
  227. * If
  228. * x > flash_threshold * current max cache size,
  229. *
  230. * increase the current maximum cache size by x * flash_multiple
  231. * less any free space in the cache, and star a new epoch. For
  232. * now at least, pay no attention to the maximum increment.
  233. *
  234. * In both of the above cases, the flash increment pays no attention to
  235. * the maximum increment (at least in this first incarnation), but DOES
  236. * stay within max_size.
  237. *
  238. * With a little thought, it should be obvious that the above flash
  239. * cache size increase algorithm is not sufficient for all circumstances
  240. * -- for example, suppose the user round robins through
  241. * (1/flash_threshold) +1 groups, adding one data set to each on each
  242. * pass. Then all will increase in size at about the same time, requiring
  243. * the max cache size to at least double to maintain acceptable
  244. * performance, however the above flash increment algorithm will not be
  245. * triggered.
  246. *
  247. * Hopefully, the add space algorithms detailed above will be sufficient
  248. * for the performance problems encountered to date. However, we should
  249. * expect to revisit the issue.
  250. *
  251. * flash_multiple: Double containing the multiple described above in the
  252. * H5C_flash_incr__add_space section of the discussion of the
  253. * flash_incr_mode section. This field is ignored unless flash_incr_mode
  254. * is H5C_flash_incr__add_space.
  255. *
  256. * flash_threshold: Double containing the factor by which current max cache
  257. * size is multiplied to obtain the size threshold for the add_space flash
  258. * increment algorithm. The field is ignored unless flash_incr_mode is
  259. * H5C_flash_incr__add_space.
  260. *
  261. *
  262. * Cache size decrease control fields:
  263. *
  264. * decr_mode: Instance of the H5C_cache_decr_mode enumerated type whose
  265. * value indicates how we determine whether the cache size should be
  266. * decreased. At present there are four possibilities.
  267. *
  268. * H5C_decr__off: Don't attempt to decrease the size of the cache
  269. * automatically.
  270. *
  271. * When this increment mode is selected, the remaining fields
  272. * in the cache size decrease section are ignored.
  273. *
  274. * H5C_decr__threshold: Attempt to decrease the size of the cache
  275. * whenever the average hit rate over the last epoch rises
  276. * above the value supplied in the upper_hr_threshold
  277. * field.
  278. *
  279. * H5C_decr__age_out: At the end of each epoch, search the cache for
  280. * entries that have not been accessed for at least the number
  281. * of epochs specified in the epochs_before_eviction field, and
  282. * evict these entries. Conceptually, the maximum cache size
  283. * is then decreased to match the new actual cache size. However,
  284. * this reduction may be modified by the min_size, the
  285. * max_decrement, and/or the empty_reserve.
  286. *
  287. * H5C_decr__age_out_with_threshold: Same as age_out, but we only
  288. * attempt to reduce the cache size when the hit rate observed
  289. * over the last epoch exceeds the value provided in the
  290. * upper_hr_threshold field.
  291. *
  292. * Note that you must set decr_mode to H5C_decr__off if you
  293. * disable metadata cache entry evictions.
  294. *
  295. * upper_hr_threshold: Upper hit rate threshold. The use of this field
  296. * varies according to the current decr_mode:
  297. *
  298. * H5C_decr__off or H5C_decr__age_out: The value of this field is
  299. * ignored.
  300. *
  301. * H5C_decr__threshold: If the hit rate exceeds this threshold in any
  302. * epoch, attempt to decrement the cache size by size_decrement.
  303. *
  304. * Note that cache size may not be decremented below min_size.
  305. *
  306. * Note also that if the upper_threshold is 1.0, the cache size
  307. * will never be reduced.
  308. *
  309. * H5C_decr__age_out_with_threshold: If the hit rate exceeds this
  310. * threshold in any epoch, attempt to reduce the cache size
  311. * by evicting entries that have not been accessed for more
  312. * than the specified number of epochs.
  313. *
  314. * decrement: This field is only used when the decr_mode is
  315. * H5C_decr__threshold.
  316. *
  317. * The field is a double containing the multiplier used to derive the
  318. * new cache size from the old if a cache size decrement is triggered.
  319. * The decrement must be in the range 0.0 (in which case the cache will
  320. * try to contract to its minimum size) to 1.0 (in which case the
  321. * cache will never shrink).
  322. *
  323. * apply_max_decrement: Boolean flag used to determine whether decrements
  324. * in cache size are to be limited by the max_decrement field.
  325. *
  326. * max_decrement: Maximum number of bytes by which the cache size can be
  327. * decreased in a single re-size. Note that decrements may also be
  328. * restricted by the min_size of the cache, and (in age out modes) by
  329. * the empty_reserve field.
  330. *
  331. * epochs_before_eviction: Integer field used in H5C_decr__age_out and
  332. * H5C_decr__age_out_with_threshold decrement modes.
  333. *
  334. * This field contains the number of epochs an entry must remain
  335. * unaccessed before it is evicted in an attempt to reduce the
  336. * cache size. If applicable, this field must lie in the range
  337. * [1, H5C__MAX_EPOCH_MARKERS].
  338. *
  339. * apply_empty_reserve: Boolean field controlling whether the empty_reserve
  340. * field is to be used in computing the new cache size when the
  341. * decr_mode is H5C_decr__age_out or H5C_decr__age_out_with_threshold.
  342. *
  343. * empty_reserve: To avoid a constant racheting down of cache size by small
  344. * amounts in the H5C_decr__age_out and H5C_decr__age_out_with_threshold
  345. * modes, this field allows one to require that any cache size
  346. * reductions leave the specified fraction of unused space in the cache.
  347. *
  348. * The value of this field must be in the range [0.0, 1.0]. I would
  349. * expect typical values to be in the range of 0.01 to 0.1.
  350. *
  351. *
  352. * Parallel Configuration Fields:
  353. *
  354. * In PHDF5, all operations that modify metadata must be executed collectively.
  355. *
  356. * We used to think that this was enough to ensure consistency across the
  357. * metadata caches, but since we allow processes to read metadata individually,
  358. * the order of dirty entries in the LRU list can vary across processes,
  359. * which can result in inconsistencies between the caches.
  360. *
  361. * PHDF5 uses several strategies to prevent such inconsistencies in metadata,
  362. * all of which use the fact that the same stream of dirty metadata is seen
  363. * by all processes for purposes of synchronization. This is done by
  364. * having each process count the number of bytes of dirty metadata generated,
  365. * and then running a "sync point" whenever this count exceeds a user
  366. * specified threshold (see dirty_bytes_threshold below).
  367. *
  368. * The current metadata write strategy is indicated by the
  369. * metadata_write_strategy field. The possible values of this field, along
  370. * with the associated metadata write strategies are discussed below.
  371. *
  372. * dirty_bytes_threshold: Threshold of dirty byte creation used to
  373. * synchronize updates between caches. (See above for outline and
  374. * motivation.)
  375. *
  376. * This value MUST be consistent across all processes accessing the
  377. * file. This field is ignored unless HDF5 has been compiled for
  378. * parallel.
  379. *
  380. * metadata_write_strategy: Integer field containing a code indicating the
  381. * desired metadata write strategy. The valid values of this field
  382. * are enumerated and discussed below:
  383. *
  384. *
  385. * H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY:
  386. *
  387. * When metadata_write_strategy is set to this value, only process
  388. * zero is allowed to write dirty metadata to disk. All other
  389. * processes must retain dirty metadata until they are informed at
  390. * a sync point that the dirty metadata in question has been written
  391. * to disk.
  392. *
  393. * When the sync point is reached (or when there is a user generated
  394. * flush), process zero flushes sufficient entries to bring it into
  395. * compliance with its min clean size (or flushes all dirty entries in
  396. * the case of a user generated flush), broad casts the list of
  397. * entries just cleaned to all the other processes, and then exits
  398. * the sync point.
  399. *
  400. * Upon receipt of the broadcast, the other processes mark the indicated
  401. * entries as clean, and leave the sync point as well.
  402. *
  403. *
  404. * H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED:
  405. *
  406. * In the distributed metadata write strategy, process zero still makes
  407. * the decisions as to what entries should be flushed, but the actual
  408. * flushes are distributed across the processes in the computation to
  409. * the extent possible.
  410. *
  411. * In this strategy, when a sync point is triggered (either by dirty
  412. * metadata creation or manual flush), all processes enter a barrier.
  413. *
  414. * On the other side of the barrier, process 0 constructs an ordered
  415. * list of the entries to be flushed, and then broadcasts this list
  416. * to the caches in all the processes.
  417. *
  418. * All processes then scan the list of entries to be flushed, flushing
  419. * some, and marking the rest as clean. The algorithm for this purpose
  420. * ensures that each entry in the list is flushed exactly once, and
  421. * all are marked clean in each cache.
  422. *
  423. * Note that in the case of a flush of the cache, no message passing
  424. * is necessary, as all processes have the same list of dirty entries,
  425. * and all of these entries must be flushed. Thus in this case it is
  426. * sufficient for each process to sort its list of dirty entries after
  427. * leaving the initial barrier, and use this list as if it had been
  428. * received from process zero.
  429. *
  430. * To avoid possible messages from the past/future, all caches must
  431. * wait until all caches are done before leaving the sync point.
  432. *
  433. ****************************************************************************/
  434. #define H5AC__CURR_CACHE_CONFIG_VERSION 1
  435. #define H5AC__MAX_TRACE_FILE_NAME_LEN 1024
  436. #define H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY 0
  437. #define H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED 1
  438. /**
  439. * H5AC_cache_config_t is a public structure intended for use in public APIs.
  440. * At least in its initial incarnation, it is basically a copy of \c struct
  441. * \c H5C_auto_size_ctl_t, minus the \c report_fcn field, and plus the
  442. * \c dirty_bytes_threshold field.
  443. *
  444. * The \c report_fcn field is omitted, as including it would require us to make
  445. * \c H5C_t structure public.
  446. *
  447. * The \c dirty_bytes_threshold field does not appear in \c H5C_auto_size_ctl_t,
  448. * as synchronization between caches on different processes is handled at the \c
  449. * H5AC level, not at the level of \c H5C. Note however that there is
  450. * considerable interaction between this value and the other fields in this
  451. * structure.
  452. *
  453. * Similarly, the \c open_trace_file, \c close_trace_file, and \c
  454. * trace_file_name fields do not appear in \c H5C_auto_size_ctl_t, as most trace
  455. * file issues are handled at the \c H5AC level. The one exception is storage
  456. * of the pointer to the trace file, which is handled by \c H5C.
  457. *
  458. * The structure is in H5ACpublic.h as we may wish to allow different
  459. * configuration options for metadata and raw data caches.
  460. */
  461. //! <!-- [H5AC_cache_config_t_snip] -->
  462. typedef struct H5AC_cache_config_t {
  463. /* general configuration fields: */
  464. //! <!-- [H5AC_cache_config_t_general_snip] -->
  465. int version;
  466. /**< Integer field indicating the the version of the H5AC_cache_config_t
  467. * in use. This field should be set to #H5AC__CURR_CACHE_CONFIG_VERSION
  468. * (defined in H5ACpublic.h). */
  469. hbool_t rpt_fcn_enabled;
  470. /**< Boolean flag indicating whether the adaptive cache resize report
  471. * function is enabled. This field should almost always be set to disabled
  472. * (0). Since resize algorithm activity is reported via stdout, it MUST be
  473. * set to disabled (0) on Windows machines.\n
  474. * The report function is not supported code, and can be expected to change
  475. * between versions of the library. Use it at your own risk. */
  476. hbool_t open_trace_file;
  477. /**< Boolean field indicating whether the
  478. * \ref H5AC_cache_config_t.trace_file_name "trace_file_name"
  479. * field should be used to open a trace file for the cache.\n
  480. * The trace file is a debugging feature that allows the capture
  481. * of top level metadata cache requests for purposes of debugging
  482. * and/or optimization. This field should normally be set to 0, as
  483. * trace file collection imposes considerable overhead.\n
  484. * This field should only be set to 1 when the
  485. * \ref H5AC_cache_config_t.trace_file_name "trace_file_name"
  486. * contains the full path of the desired trace file, and either
  487. * there is no open trace file on the cache, or the
  488. * \ref H5AC_cache_config_t.close_trace_file "close_trace_file"
  489. * field is also 1.\n
  490. * The trace file feature is unsupported unless used at the
  491. * direction of The HDF Group. It is intended to allow The HDF
  492. * Group to collect a trace of cache activity in cases of occult
  493. * failures and/or poor performance seen in the field, so as to aid
  494. * in reproduction in the lab. If you use it absent the direction
  495. * of The HDF Group, you are on your own. */
  496. hbool_t close_trace_file;
  497. /**< Boolean field indicating whether the current trace file
  498. *(if any) should be closed.\n
  499. * See the above comments on the \ref H5AC_cache_config_t.open_trace_file
  500. * "open_trace_file" field. This field should be set to 0 unless there is
  501. * an open trace file on the cache that you wish to close.\n
  502. * The trace file feature is unsupported unless used at the direction of
  503. * The HDF Group. It is intended to allow The HDF Group to collect a trace
  504. * of cache activity in cases of occult failures and/or poor performance
  505. * seen in the field, so as to aid in reproduction in the lab. If you use
  506. * it absent the direction of The HDF Group, you are on your own. */
  507. char trace_file_name[H5AC__MAX_TRACE_FILE_NAME_LEN + 1];
  508. /**< Full path of the trace file to be opened if the
  509. * \ref H5AC_cache_config_t.open_trace_file "open_trace_file" field is set
  510. * to 1.\n
  511. * In the parallel case, an ascii representation of the MPI rank of the
  512. * process will be appended to the file name to yield a unique trace file
  513. * name for each process.\n
  514. * The length of the path must not exceed #H5AC__MAX_TRACE_FILE_NAME_LEN
  515. * characters.\n
  516. * The trace file feature is unsupported unless used at the direction of
  517. * The HDF Group. It is intended to allow The HDF Group to collect a trace
  518. * of cache activity in cases of occult failures and/or poor performance
  519. * seen in the field, so as to aid in reproduction in the lab. If you use
  520. * it absent the direction of The HDF Group, you are on your own. */
  521. hbool_t evictions_enabled;
  522. /**< A boolean flag indicating whether evictions from the metadata cache
  523. * are enabled. This flag is initially set to enabled (1).\n
  524. * In rare circumstances, the raw data throughput quirements may be so high
  525. * that the user wishes to postpone metadata writes so as to reserve I/O
  526. * throughput for raw data. The \p evictions_enabled field exists to allow
  527. * this. However, this is an extreme step, and you have no business doing
  528. * it unless you have read the User Guide section on metadata caching, and
  529. * have considered all other options carefully.\n
  530. * The \p evictions_enabled field may not be set to disabled (0)
  531. * unless all adaptive cache resizing code is disabled via the
  532. * \ref H5AC_cache_config_t.incr_mode "incr_mode",
  533. * \ref H5AC_cache_config_t.flash_incr_mode "flash_incr_mode",
  534. * \ref H5AC_cache_config_t.decr_mode "decr_mode" fields.\n
  535. * When this flag is set to disabled (\c 0), the metadata cache will not
  536. * attempt to evict entries to make space for new entries, and thus will
  537. * grow without bound.\n
  538. * Evictions will be re-enabled when this field is set back to \c 1.
  539. * This should be done as soon as possible. */
  540. hbool_t set_initial_size;
  541. /**< Boolean flag indicating whether the cache should be created
  542. * with a user specified initial size. */
  543. size_t initial_size;
  544. /**< If \ref H5AC_cache_config_t.set_initial_size "set_initial_size"
  545. * is set to 1, \p initial_size must contain he desired initial size in
  546. * bytes. This value must lie in the closed interval
  547. * [ \p min_size, \p max_size ]. (see below) */
  548. double min_clean_fraction;
  549. /**< This field specifies the minimum fraction of the cache
  550. * that must be kept either clean or empty.\n
  551. * The value must lie in the interval [0.0, 1.0]. 0.01 is a good place to
  552. * start in the serial case. In the parallel case, a larger value is needed
  553. * -- see the overview of the metadata cache in the
  554. * “Metadata Caching in HDF5” section of the -- <em>HDF5 User’s Guide</em>
  555. * for details. */
  556. size_t max_size;
  557. /**< Upper bound (in bytes) on the range of values that the
  558. * adaptive cache resize code can select as the maximum cache size. */
  559. size_t min_size;
  560. /**< Lower bound (in bytes) on the range of values that the
  561. * adaptive cache resize code can select as the minimum cache * size. */
  562. long int epoch_length;
  563. /**< Number of cache accesses between runs of the adaptive cache resize
  564. * code. 50,000 is a good starting number. */
  565. //! <!-- [H5AC_cache_config_t_general_snip] -->
  566. /* size increase control fields: */
  567. //! <!-- [H5AC_cache_config_t_incr_snip] -->
  568. enum H5C_cache_incr_mode incr_mode;
  569. /**< Enumerated value indicating the operational mode of the automatic
  570. * cache size increase code. At present, only two values listed in
  571. * #H5C_cache_incr_mode are legal. */
  572. double lower_hr_threshold;
  573. /**< Hit rate threshold used by the hit rate threshold cache size
  574. * increment algorithm.\n
  575. * When the hit rate over an epoch is below this threshold and the cache
  576. * is full, the maximum size of the cache is multiplied by increment
  577. * (below), and then clipped as necessary to stay within \p max_size, and
  578. * possibly \p max_increment.\n
  579. * This field must lie in the interval [0.0, 1.0]. 0.8 or 0.9 is a good
  580. * place to start. */
  581. double increment;
  582. /**< Factor by which the hit rate threshold cache size increment
  583. * algorithm multiplies the current cache max size to obtain a tentative
  584. * new cache size.\n
  585. * The actual cache size increase will be clipped to satisfy the \p max_size
  586. * specified in the general configuration, and possibly max_increment
  587. * below.\n
  588. * The parameter must be greater than or equal to 1.0 -- 2.0 is a reasonable
  589. * value.\n
  590. * If you set it to 1.0, you will effectively disable cache size increases.
  591. */
  592. hbool_t apply_max_increment;
  593. /**< Boolean flag indicating whether an upper limit should be applied to
  594. * the size of cache size increases. */
  595. size_t max_increment;
  596. /**< Maximum number of bytes by which cache size can be increased in a
  597. * single step -- if applicable. */
  598. enum H5C_cache_flash_incr_mode flash_incr_mode;
  599. /**< Enumerated value indicating the operational mode of the flash cache
  600. * size increase code. At present, only two listed values in
  601. * #H5C_cache_flash_incr_mode are legal.*/
  602. double flash_multiple;
  603. /**< The factor by which the size of the triggering entry / entry size
  604. * increase is multiplied to obtain the initial cache size increment. This
  605. * increment may be reduced to reflect existing free space in the cache and
  606. * the \p max_size field above.\n
  607. * The parameter must lie in the interval [0.0, 1.0]. 0.1 or 0.05 is a good
  608. * place to start.\n
  609. * At present, this field must lie in the range [0.1, 10.0]. */
  610. double flash_threshold;
  611. /**< The factor by which the current maximum cache size is multiplied to
  612. * obtain the minimum size entry / entry size increase which may trigger a
  613. * flash cache size increase. \n
  614. * At present, this value must lie in the range [0.1, 1.0]. */
  615. //! <!-- [H5AC_cache_config_t_incr_snip] -->
  616. /* size decrease control fields: */
  617. //! <!-- [H5AC_cache_config_t_decr_snip] -->
  618. enum H5C_cache_decr_mode decr_mode;
  619. /**< Enumerated value indicating the operational mode of the tomatic
  620. * cache size decrease code. At present, the values listed in
  621. * #H5C_cache_decr_mode are legal.*/
  622. double upper_hr_threshold;
  623. /**< Hit rate threshold for the hit rate threshold and ageout with hit
  624. * rate threshold cache size decrement algorithms.\n
  625. * When \p decr_mode is #H5C_decr__threshold, and the hit rate over a given
  626. * epoch exceeds the supplied threshold, the current maximum cache
  627. * size is multiplied by decrement to obtain a tentative new (and smaller)
  628. * maximum cache size.\n
  629. * When \p decr_mode is #H5C_decr__age_out_with_threshold, there is
  630. * no attempt to find and evict aged out entries unless the hit rate in
  631. * the previous epoch exceeded the supplied threshold.\n
  632. * This field must lie in the interval [0.0, 1.0].\n
  633. * For #H5C_incr__threshold, .9995 or .99995 is a good place to start.\n
  634. * For #H5C_decr__age_out_with_threshold, .999 might be more useful.*/
  635. double decrement;
  636. /**< In the hit rate threshold cache size decrease algorithm, this
  637. * parameter contains the factor by which the current max cache size is
  638. * multiplied to produce a tentative new cache size.\n
  639. * The actual cache size decrease will be clipped to satisfy the
  640. * \ref H5AC_cache_config_t.min_size "min_size" specified in the general
  641. * configuration, and possibly \ref H5AC_cache_config_t.max_decrement
  642. * "max_decrement".\n
  643. * The parameter must be be in the interval [0.0, 1.0].\n
  644. * If you set it to 1.0, you will effectively
  645. * disable cache size decreases. 0.9 is a reasonable starting point. */
  646. hbool_t apply_max_decrement;
  647. /**< Boolean flag indicating ether an upper limit should be applied to
  648. * the size of cache size decreases. */
  649. size_t max_decrement;
  650. /**< Maximum number of bytes by which the maximum cache size can be
  651. * decreased in any single step -- if applicable.*/
  652. int epochs_before_eviction;
  653. /**< In the ageout based cache size reduction algorithms, this field
  654. * contains the minimum number of epochs an entry must remain unaccessed in
  655. * cache before the cache size reduction algorithm tries to evict it. 3 is a
  656. * reasonable value. */
  657. hbool_t apply_empty_reserve;
  658. /**< Boolean flag indicating whether the ageout based decrement
  659. * algorithms will maintain a empty reserve when decreasing cache size. */
  660. double empty_reserve;
  661. /**< Empty reserve as a fraction maximum cache size if applicable.\n When
  662. * so directed, the ageout based algorithms will not decrease the maximum
  663. * cache size unless the empty reserve can be met.\n The parameter must lie
  664. * in the interval [0.0, 1.0]. 0.1 or 0.05 is a good place to start. */
  665. //! <!-- [H5AC_cache_config_t_decr_snip] -->
  666. /* parallel configuration fields: */
  667. //! <!-- [H5AC_cache_config_t_parallel_snip] -->
  668. size_t dirty_bytes_threshold;
  669. /**< Threshold number of bytes of dirty metadata generation for
  670. * triggering synchronizations of the metadata caches serving the target
  671. * file in the parallel case.\n Synchronization occurs whenever the number
  672. * of bytes of dirty metadata created since the last synchronization exceeds
  673. * this limit.\n This field only applies to the parallel case. While it is
  674. * ignored elsewhere, it can still draw a value out of bounds error.\n It
  675. * must be consistent across all caches on any given file.\n By default,
  676. * this field is set to 256 KB. It shouldn't be more than half the current
  677. * max cache size times the min clean fraction. */
  678. int metadata_write_strategy;
  679. /**< Desired metadata write strategy. The valid values for this field
  680. * are:\n #H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY: Specifies the only
  681. * process zero is allowed to write dirty metadata to disk.\n
  682. * #H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED: Specifies that process zero
  683. * still makes the decisions as to what entries should be flushed, but the
  684. * actual flushes are distributed across the processes in the computation to
  685. * the extent possible.\n The src/H5ACpublic.h include file in the HDF5
  686. * library has detailed information on each strategy. */
  687. //! <!-- [H5AC_cache_config_t_parallel_snip] -->
  688. } H5AC_cache_config_t;
  689. //! <!-- [H5AC_cache_config_t_snip] -->
  690. #define H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION 1
  691. #define H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE -1
  692. #define H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX 100
  693. //! <!-- [H5AC_cache_image_config_t_snip] -->
  694. /**
  695. * H5AC_cache_image_config_t is a public structure intended for use in public
  696. * APIs. At least in its initial incarnation, it is a copy of \c struct \c
  697. * H5C_cache_image_ctl_t.
  698. */
  699. typedef struct H5AC_cache_image_config_t {
  700. int version;
  701. /**< Integer field containing the version number of this version of the \c
  702. * H5C_image_ctl_t structure. Any instance of \c H5C_image_ctl_t passed
  703. * to the cache must have a known version number, or an error will be
  704. * flagged.
  705. */
  706. hbool_t generate_image;
  707. /**< Boolean flag indicating whether a cache image should be created on file
  708. * close.
  709. */
  710. hbool_t save_resize_status;
  711. /**< Boolean flag indicating whether the cache image should include the
  712. * adaptive cache resize configuration and status. Note that this field
  713. * is ignored at present.
  714. */
  715. int entry_ageout;
  716. /**< Integer field indicating the maximum number of times a
  717. * prefetched entry can appear in subsequent cache images. This field
  718. * exists to allow the user to avoid the buildup of infrequently used
  719. * entries in long sequences of cache images.
  720. *
  721. * The value of this field must lie in the range \ref
  722. * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE (-1) to \ref
  723. * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX (100).
  724. *
  725. * \ref H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE means that no limit is
  726. * imposed on number of times a prefeteched entry can appear in subsequent
  727. * cache images.
  728. *
  729. * A value of 0 prevents prefetched entries from being included in cache
  730. * images.
  731. *
  732. * Positive integers restrict prefetched entries to the specified number
  733. * of appearances.
  734. *
  735. * Note that the number of subsequent cache images that a prefetched entry
  736. * has appeared in is tracked in an 8 bit field. Thus, while \ref
  737. * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__MAX can be increased from its current
  738. * value, any value in excess of 255 will be the functional equivalent of
  739. * \ref H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE.
  740. */
  741. } H5AC_cache_image_config_t;
  742. //! <!-- [H5AC_cache_image_config_t_snip] -->
  743. #ifdef __cplusplus
  744. }
  745. #endif
  746. #endif