H5FDmpio.h 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  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. * Programmer: Robb Matzke
  15. * Monday, August 2, 1999
  16. *
  17. * Purpose: The public header file for the mpio driver.
  18. */
  19. #ifndef H5FDmpio_H
  20. #define H5FDmpio_H
  21. /* Macros */
  22. #ifdef H5_HAVE_PARALLEL
  23. #define H5FD_MPIO (H5FDperform_init(H5FD_mpio_init))
  24. #else
  25. #define H5FD_MPIO (H5I_INVALID_HID)
  26. #endif /* H5_HAVE_PARALLEL */
  27. #ifdef H5_HAVE_PARALLEL
  28. /*Turn on H5FDmpio_debug if H5F_DEBUG is on */
  29. #ifdef H5F_DEBUG
  30. #ifndef H5FDmpio_DEBUG
  31. #define H5FDmpio_DEBUG
  32. #endif
  33. #endif
  34. /* Global var whose value comes from environment variable */
  35. /* (Defined in H5FDmpio.c) */
  36. H5_DLLVAR hbool_t H5FD_mpi_opt_types_g;
  37. /* Function prototypes */
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. H5_DLL hid_t H5FD_mpio_init(void);
  42. /**
  43. * \ingroup FAPL
  44. *
  45. * \brief Stores MPI IO communicator information to the file access property list
  46. *
  47. * \fapl_id
  48. * \param[in] comm MPI-2 communicator
  49. * \param[in] info MPI-2 info object
  50. * \returns \herr_t
  51. *
  52. * \details H5Pset_fapl_mpio() stores the user-supplied MPI IO parameters \p
  53. * comm, for communicator, and \p info, for information, in the file
  54. * access property list \p fapl_id. That property list can then be used
  55. * to create and/or open a file.
  56. *
  57. * H5Pset_fapl_mpio() is available only in the parallel HDF5 library
  58. * and is not a collective function.
  59. *
  60. * \p comm is the MPI communicator to be used for file open, as defined
  61. * in \c MPI_File_open of MPI-2. This function makes a duplicate of the
  62. * communicator, so modifications to \p comm after this function call
  63. * returns have no effect on the file access property list.
  64. *
  65. * \p info is the MPI Info object to be used for file open, as defined
  66. * in MPI_File_open() of MPI-2. This function makes a duplicate copy of
  67. * the Info object, so modifications to the Info object after this
  68. * function call returns will have no effect on the file access
  69. * property list.
  70. *
  71. * If the file access property list already contains previously-set
  72. * communicator and Info values, those values will be replaced and the
  73. * old communicator and Info object will be freed.
  74. *
  75. * \note Raw dataset chunk caching is not currently supported when using this
  76. * file driver in read/write mode. All calls to H5Dread() and H5Dwrite()
  77. * will access the disk directly, and H5Pset_cache() and
  78. * H5Pset_chunk_cache() will have no effect on performance.\n
  79. * Raw dataset chunk caching is supported when this driver is used in
  80. * read-only mode.
  81. *
  82. * \version 1.4.5 Handling of the MPI Communicator and Info object changed at
  83. * this release. A duplicate of each of these is now stored in the property
  84. * list instead of pointers to each.
  85. * \since 1.4.0
  86. *
  87. */
  88. H5_DLL herr_t H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info);
  89. /**
  90. * \ingroup FAPL
  91. *
  92. * \brief Returns MPI IO communicator information
  93. *
  94. * \fapl_id
  95. * \param[out] comm MPI-2 communicator
  96. * \param[out] info MPI-2 info object
  97. * \returns \herr_t
  98. *
  99. * \details If the file access property list is set to the #H5FD_MPIO driver,
  100. * H5Pget_fapl_mpio() returns duplicates of the stored MPI communicator
  101. * and Info object through the \p comm and \p info pointers, if those
  102. * values are non-null.
  103. *
  104. * Since the MPI communicator and Info object are duplicates of the
  105. * stored information, future modifications to the access property list
  106. * will not affect them. It is the responsibility of the application to
  107. * free these objects.
  108. *
  109. * \version 1.4.5 Handling of the MPI Communicator and Info object changed at
  110. * this release. A duplicate of each of these is now stored in the
  111. * property list instead of pointers to each.
  112. * \since 1.4.0
  113. *
  114. */
  115. H5_DLL herr_t H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm /*out*/, MPI_Info *info /*out*/);
  116. /**
  117. * \ingroup DXPL
  118. *
  119. * \brief Sets data transfer mode
  120. *
  121. * \dxpl_id
  122. * \param[in] xfer_mode Transfer mode
  123. * \returns \herr_t
  124. *
  125. * \details H5Pset_dxpl_mpio() sets the data transfer property list \p dxpl_id
  126. * to use transfer mode \p xfer_mode. The property list can then be
  127. * used to control the I/O transfer mode during data I/O operations.
  128. *
  129. * Valid transfer modes are #H5FD_MPIO_INDEPENDENT (default) and
  130. * #H5FD_MPIO_COLLECTIVE.
  131. *
  132. * \since 1.4.0
  133. *
  134. */
  135. H5_DLL herr_t H5Pset_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t xfer_mode);
  136. /**
  137. * \ingroup DXPL
  138. *
  139. * \brief Returns the data transfer mode
  140. *
  141. * \dxpl_id
  142. * \param[out] xfer_mode Transfer mode
  143. * \returns \herr_t
  144. *
  145. * \details H5Pget_dxpl_mpio() queries the data transfer mode currently set in
  146. * the data transfer property list \p dxpl_id.
  147. *
  148. * Upon return, \p xfer_mode contains the data transfer mode, if it is
  149. * non-null.
  150. *
  151. * H5Pget_dxpl_mpio() is not a collective function.
  152. *
  153. * \since 1.4.0
  154. *
  155. */
  156. H5_DLL herr_t H5Pget_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t *xfer_mode /*out*/);
  157. /**
  158. * \ingroup DXPL
  159. *
  160. * \brief Sets data transfer mode
  161. *
  162. * \dxpl_id
  163. * \param[in] opt_mode Transfer mode
  164. * \returns \herr_t
  165. *
  166. * \details H5Pset_dxpl_mpio() sets the data transfer property list \p dxpl_id
  167. * to use transfer mode xfer_mode. The property list can then be used
  168. * to control the I/O transfer mode during data I/O operations.
  169. *
  170. * Valid transfer modes are #H5FD_MPIO_INDEPENDENT (default) and
  171. * #H5FD_MPIO_COLLECTIVE.
  172. *
  173. * \since 1.4.0
  174. *
  175. */
  176. H5_DLL herr_t H5Pset_dxpl_mpio_collective_opt(hid_t dxpl_id, H5FD_mpio_collective_opt_t opt_mode);
  177. /**
  178. * \ingroup DXPL
  179. *
  180. * \brief Sets a flag specifying linked-chunk I/O or multi-chunk I/O
  181. *
  182. * \dxpl_id
  183. * \param[in] opt_mode Transfer mode
  184. * \returns \herr_t
  185. *
  186. * \details H5Pset_dxpl_mpio_chunk_opt() specifies whether I/O is to be
  187. * performed as linked-chunk I/O or as multi-chunk I/O. This function
  188. * overrides the HDF5 library's internal algorithm for determining
  189. * which mechanism to use.
  190. *
  191. * When an application uses collective I/O with chunked storage, the
  192. * HDF5 library normally uses an internal algorithm to determine
  193. * whether that I/O activity should be conducted as one linked-chunk
  194. * I/O or as multi-chunk I/O. H5Pset_dxpl_mpio_chunk_opt() is provided
  195. * so that an application can override the library's algorithm in
  196. * circumstances where the library might lack the information needed to
  197. * make an optimal decision.
  198. *
  199. * H5Pset_dxpl_mpio_chunk_opt() works by setting one of the following
  200. * flags in the parameter \p opt_mode:
  201. * - #H5FD_MPIO_CHUNK_ONE_IO - Do one-link chunked I/O
  202. * - #H5FD_MPIO_CHUNK_MULTI_IO - Do multi-chunked I/O
  203. *
  204. * This function works by setting a corresponding property in the
  205. * dataset transfer property list \p dxpl_id.
  206. *
  207. * The library performs I/O in the specified manner unless it
  208. * determines that the low-level MPI IO package does not support the
  209. * requested behavior; in such cases, the HDF5 library will internally
  210. * use independent I/O.
  211. *
  212. * Use of this function is optional.
  213. *
  214. * \since 1.8.0
  215. *
  216. */
  217. H5_DLL herr_t H5Pset_dxpl_mpio_chunk_opt(hid_t dxpl_id, H5FD_mpio_chunk_opt_t opt_mode);
  218. /**
  219. * \ingroup DXPL
  220. *
  221. * \brief Sets a numeric threshold for linked-chunk I/O
  222. *
  223. * \dxpl_id
  224. * \param[in] num_chunk_per_proc
  225. * \returns \herr_t
  226. *
  227. * \details H5Pset_dxpl_mpio_chunk_opt_num() sets a numeric threshold for the
  228. * use of linked-chunk I/O.
  229. *
  230. * The library will calculate the average number of chunks selected by
  231. * each process when doing collective access with chunked storage. If
  232. * the number is greater than the threshold set in \p
  233. * num_chunk_per_proc, the library will use linked-chunk I/O;
  234. * otherwise, a separate I/O process will be invoked for each chunk
  235. * (multi-chunk I/O).
  236. *
  237. * \since 1.8.0
  238. *
  239. */
  240. H5_DLL herr_t H5Pset_dxpl_mpio_chunk_opt_num(hid_t dxpl_id, unsigned num_chunk_per_proc);
  241. /**
  242. * \ingroup DXPL
  243. *
  244. * \brief Sets a ratio threshold for collective I/O
  245. *
  246. * \dxpl_id
  247. * \param[in] percent_num_proc_per_chunk
  248. * \returns \herr_t
  249. *
  250. * \details H5Pset_dxpl_mpio_chunk_opt_ratio() sets a threshold for the use of
  251. * collective I/O based on the ratio of processes with collective
  252. * access to a dataset with chunked storage. The decision whether to
  253. * use collective I/O is made on a per-chunk basis.
  254. *
  255. * The library will calculate the percentage of the total number of
  256. * processes, the ratio, that hold selections in each chunk. If that
  257. * percentage is greater than the threshold set in \p
  258. * percent_proc_per_chunk, the library will do collective I/O for this
  259. * chunk; otherwise, independent I/O will be done for the chunk.
  260. *
  261. * \since 1.8.0
  262. *
  263. */
  264. H5_DLL herr_t H5Pset_dxpl_mpio_chunk_opt_ratio(hid_t dxpl_id, unsigned percent_num_proc_per_chunk);
  265. #ifdef __cplusplus
  266. }
  267. #endif
  268. #endif /* H5_HAVE_PARALLEL */
  269. #endif