1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>HDF5: A Brief Introduction to Parallel HDF5</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function() { init_search(); });
/* @license-end */
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="hdf5doxy.css" rel="stylesheet" type="text/css">
<!-- <link href="hdf5doxy.css" rel="stylesheet" type="text/css"/>
-->
<script type="text/javascript" src="hdf5_navtree_hacks.js"></script>
</head>
<body>
<div style="background:#FFDDDD;font-size:120%;text-align:center;margin:0;padding:5px">Please, help us to better serve our user community by answering the following short survey: <a href="https://www.hdfgroup.org/website-survey/">https://www.hdfgroup.org/website-survey/</a></div>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="HDFG-logo.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname"><a href="https://www.hdfgroup.org">HDF5</a>
 <span id="projectnumber">1.15.0.117d579</span>
</div>
<div id="projectbrief">API Reference</div>
</td>
<td> <div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.svg"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('_intro_par_h_d_f5.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="PageDoc"><div class="header">
<div class="headertitle">
<div class="title">A Brief Introduction to Parallel HDF5 </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>Navigate back: <a class="el" href="index.html">Main</a> / <a class="el" href="_getting_started.html">Getting Started with HDF5</a> </p><hr />
<p>If you are new to HDF5 please see the <a class="el" href="_learn_basics.html">Learning the Basics</a> topic first.</p>
<h1><a class="anchor" id="sec_pintro_overview"></a>
Overview of Parallel HDF5 (PHDF5) Design</h1>
<p>There were several requirements that we had for Parallel HDF5 (PHDF5). These were: </p><ul>
<li>Parallel HDF5 files had to be compatible with serial HDF5 files and sharable between different serial and parallel platforms. </li>
<li>Parallel HDF5 had to be designed to have a single file image to all processes, rather than having one file per process. Having one file per process can cause expensive post processing, and the files are not usable by different processes. </li>
<li>A standard parallel I/O interface had to be portable to different platforms.</li>
</ul>
<p>With these requirements of HDF5 our initial target was to support MPI programming, but not for shared memory programming. We had done some experimentation with thread-safe support for Pthreads and for OpenMP, and decided to use these.</p>
<p>Implementation requirements were to: </p><ul>
<li>Not use Threads, since they were not commonly supported in 1998 when we were looking at this. </li>
<li>Not have a reserved process, as this might interfere with parallel algorithms. </li>
<li>Not spawn any processes, as this is not even commonly supported now.</li>
</ul>
<p>The following shows the Parallel HDF5 implementation layers.</p>
<h2><a class="anchor" id="subsec_pintro_prog"></a>
Parallel Programming with HDF5</h2>
<p>This tutorial assumes that you are somewhat familiar with parallel programming with MPI (Message Passing Interface).</p>
<p>If you are not familiar with parallel programming, here is a tutorial that may be of interest: <a href="http://www.nersc.gov/users/training/online-tutorials/introduction-to-scientific-i-o/?show_all=1">Tutorial on HDF5 I/O tuning at NERSC</a></p>
<p>Some of the terms that you must understand in this tutorial are: </p><ul>
<li>
<p class="startli"><b>MPI Communicator</b> Allows a group of processes to communicate with each other.</p>
<p class="endli">Following are the MPI routines for initializing MPI and the communicator and finalizing a session with MPI: </p><table class="doxtable">
<tr>
<th>C </th><th>Fortran </th><th>Description </th></tr>
<tr>
<td>MPI_Init </td><td>MPI_INIT </td><td>Initialize MPI (MPI_COMM_WORLD usually) </td></tr>
<tr>
<td>MPI_Comm_size </td><td>MPI_COMM_SIZE </td><td>Define how many processes are contained in the communicator </td></tr>
<tr>
<td>MPI_Comm_rank </td><td>MPI_COMM_RANK </td><td>Define the process ID number within the communicator (from 0 to n-1) </td></tr>
<tr>
<td>MPI_Finalize </td><td>MPI_FINALIZE </td><td>Exiting MPI </td></tr>
</table>
</li>
<li>
<b>Collective</b> MPI defines this to mean all processes of the communicator must participate in the right order. </li>
</ul>
<p>Parallel HDF5 opens a parallel file with a communicator. It returns a file handle to be used for future access to the file.</p>
<p>All processes are required to participate in the collective Parallel HDF5 API. Different files can be opened using different communicators.</p>
<p>Examples of what you can do with the Parallel HDF5 collective API: </p><ul>
<li>File Operation: Create, open and close a file </li>
<li>Object Creation: Create, open, and close a dataset </li>
<li>Object Structure: Extend a dataset (increase dimension sizes) </li>
<li>Dataset Operations: Write to or read from a dataset (Array data transfer can be collective or independent.)</li>
</ul>
<p>Once a file is opened by the processes of a communicator: </p><ul>
<li>All parts of the file are accessible by all processes. </li>
<li>All objects in the file are accessible by all processes. </li>
<li>Multiple processes write to the same dataset. </li>
<li>Each process writes to an individual dataset.</li>
</ul>
<p>Please refer to the Supported Configuration Features Summary in the release notes for the current release of HDF5 for an up-to-date list of the platforms that we support Parallel HDF5 on.</p>
<h2><a class="anchor" id="subsec_pintro_create_file"></a>
Creating and Accessing a File with PHDF5</h2>
<p>The programming model for creating and accessing a file is as follows: </p><ol>
<li>
Set up an access template object to control the file access mechanism. </li>
<li>
Open the file. </li>
<li>
Close the file. </li>
</ol>
<p>Each process of the MPI communicator creates an access template and sets it up with MPI parallel access information. This is done with the <a class="el" href="group___p_l_c_r.html#gaf1b11da01d4d45d788c45f8bc5f0cbfa" title="Creates a new property list as an instance of a property list class.">H5Pcreate</a> call to obtain the file access property list and the <a class="el" href="group___f_a_p_l.html#gaa0204810c1fea1667d62cf7c176416ff" title="Stores MPI IO communicator information to the file access property list.">H5Pset_fapl_mpio</a> call to set up parallel I/O access.</p>
<p>Following is example code for creating an access template in HDF5: <em>C</em> </p><div class="fragment"><div class="line">23 MPI_Comm comm = MPI_COMM_WORLD;</div>
<div class="line">24 MPI_Info info = MPI_INFO_NULL;</div>
<div class="line">25</div>
<div class="line">26 <span class="comment">/*</span></div>
<div class="line"><span class="comment">27 * Initialize MPI</span></div>
<div class="line"><span class="comment">28 */</span></div>
<div class="line">29 MPI_Init(&argc, &argv);</div>
<div class="line">30 MPI_Comm_size(comm, &mpi_size);</div>
<div class="line">31 MPI_Comm_rank(comm, &mpi_rank);</div>
<div class="line">32</div>
<div class="line">33 <span class="comment">/*</span></div>
<div class="line"><span class="comment">34 * Set up file access property list with parallel I/O access</span></div>
<div class="line"><span class="comment">35 */</span></div>
<div class="line">36 plist_id = <a class="code" href="group___p_l_c_r.html#gaf1b11da01d4d45d788c45f8bc5f0cbfa">H5Pcreate</a>(<a class="code" href="_h5_ppublic_8h.html#a60ec2d4334addfc0eda89614598ee38e">H5P_FILE_ACCESS</a>); 37 <a class="code" href="group___f_a_p_l.html#gaa0204810c1fea1667d62cf7c176416ff">H5Pset_fapl_mpio</a>(plist_id, comm, info);</div>
<div class="ttc" id="a_h5_ppublic_8h_html_a60ec2d4334addfc0eda89614598ee38e"><div class="ttname"><a href="_h5_ppublic_8h.html#a60ec2d4334addfc0eda89614598ee38e">H5P_FILE_ACCESS</a></div><div class="ttdeci">#define H5P_FILE_ACCESS</div><div class="ttdef"><b>Definition:</b> H5Ppublic.h:52</div></div>
<div class="ttc" id="agroup___f_a_p_l_html_gaa0204810c1fea1667d62cf7c176416ff"><div class="ttname"><a href="group___f_a_p_l.html#gaa0204810c1fea1667d62cf7c176416ff">H5Pset_fapl_mpio</a></div><div class="ttdeci">H5_DLL herr_t H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info)</div><div class="ttdoc">Stores MPI IO communicator information to the file access property list.</div></div>
<div class="ttc" id="agroup___p_l_c_r_html_gaf1b11da01d4d45d788c45f8bc5f0cbfa"><div class="ttname"><a href="group___p_l_c_r.html#gaf1b11da01d4d45d788c45f8bc5f0cbfa">H5Pcreate</a></div><div class="ttdeci">hid_t H5Pcreate(hid_t cls_id)</div><div class="ttdoc">Creates a new property list as an instance of a property list class.</div></div>
</div><!-- fragment --><p><em>Fortran</em> </p><div class="fragment"><div class="line">23 comm = MPI_COMM_WORLD</div>
<div class="line">24 info = MPI_INFO_NULL</div>
<div class="line">25</div>
<div class="line">26 CALL MPI_INIT(mpierror)</div>
<div class="line">27 CALL MPI_COMM_SIZE(comm, mpi_size, mpierror)</div>
<div class="line">28 CALL MPI_COMM_RANK(comm, mpi_rank, mpierror)</div>
<div class="line">29 !</div>
<div class="line">30 ! Initialize FORTRAN <span class="keyword">interface </span></div>
<div class="line">31 !</div>
<div class="line">32 CALL <a class="code" href="group___f_h5.html#ga041e8ea7a216ab58ddc59bf6751393d6">h5open_f</a>(error)</div>
<div class="line">33</div>
<div class="line">34 !</div>
<div class="line">35 ! Setup file access property list with parallel I/O access.</div>
<div class="line">36 !</div>
<div class="line">37 CALL <a class="code" href="group___f_h5_p.html#gae34064e5081802ef4c8e3c84e279b6c8">h5pcreate_f</a>(H5P_FILE_ACCESS_F, plist_id, error) 38 CALL <a class="code" href="group___f_h5_p.html#ga8d7db44d6ae18047ec3e3b607c3b7175">h5pset_fapl_mpio_f</a>(plist_id, comm, info, error)</div>
<div class="ttc" id="agroup___f_h5_html_ga041e8ea7a216ab58ddc59bf6751393d6"><div class="ttname"><a href="group___f_h5.html#ga041e8ea7a216ab58ddc59bf6751393d6">h5lib::h5open_f</a></div><div class="ttdeci">subroutine, public h5open_f(error)</div><div class="ttdoc">Initializes HDF5 Fortran interface.</div><div class="ttdef"><b>Definition:</b> H5_ff.F90:182</div></div>
<div class="ttc" id="agroup___f_h5_p_html_ga8d7db44d6ae18047ec3e3b607c3b7175"><div class="ttname"><a href="group___f_h5_p.html#ga8d7db44d6ae18047ec3e3b607c3b7175">h5p::h5pset_fapl_mpio_f</a></div><div class="ttdeci">subroutine h5pset_fapl_mpio_f(prp_id, comm, info, hdferr)</div><div class="ttdoc">Stores MPI IO communicator information to the file access property list.</div><div class="ttdef"><b>Definition:</b> H5Pff.F90:5136</div></div>
<div class="ttc" id="agroup___f_h5_p_html_gae34064e5081802ef4c8e3c84e279b6c8"><div class="ttname"><a href="group___f_h5_p.html#gae34064e5081802ef4c8e3c84e279b6c8">h5p::h5pcreate_f</a></div><div class="ttdeci">subroutine h5pcreate_f(class, prp_id, hdferr)</div><div class="ttdoc">Creates a new property as an instance of a property list class.</div><div class="ttdef"><b>Definition:</b> H5Pff.F90:245</div></div>
</div><!-- fragment --><p>The following example programs create an HDF5 file using Parallel HDF5: <a href="https://github.com/HDFGroup/hdf5-examples/blob/master/C/H5Parallel/ph5_file_create.c">C: file_create.c</a> <a href="https://github.com/HDFGroup/hdf5-examples/blob/master/Fortran/H5Parallel/ph5_f90_file_create.F90">F90: file_create.F90</a></p>
<h2><a class="anchor" id="subsec_pintro_create_dset"></a>
Creating and Accessing a Dataset with PHDF5</h2>
<p>The programming model for creating and accessing a dataset is as follows: </p><ol>
<li>
Create or open a Parallel HDF5 file with a collective call to: <a class="el" href="group___h5_d.html#ga0647ba4bbd26d5230cc07f3a5685b2cf">H5Dcreate</a> <a class="el" href="_h5version_8h.html#a7dba2e5b2045f31c0932123ffb54f7a3">H5Dopen</a> </li>
<li>
Obtain a copy of the file transfer property list and set it to use collective or independent I/O. <ul>
<li>
Do this by first passing a data transfer property list class type to: <a class="el" href="group___p_l_c_r.html#gaf1b11da01d4d45d788c45f8bc5f0cbfa" title="Creates a new property list as an instance of a property list class.">H5Pcreate</a> </li>
<li>
<p class="startli">Then set the data transfer mode to either use independent I/O access or to use collective I/O, with a call to: <a class="el" href="group___d_x_p_l.html#ga001a22b64f60b815abf5de8b4776f09e" title="Sets data transfer mode.">H5Pset_dxpl_mpio</a></p>
<p class="interli">Following are the parameters required by this call: <em>C</em> </p><div class="fragment"><div class="line"><a class="code" href="_h5public_8h.html#a3b079ecf932a5c599499cf7e298af160">herr_t</a> <a class="code" href="group___d_x_p_l.html#ga001a22b64f60b815abf5de8b4776f09e">H5Pset_dxpl_mpio</a> (<a class="code" href="_h5_ipublic_8h.html#a0045db7ff9c22ad35db6ae91662e1943">hid_t</a> dxpl_id, <a class="code" href="_h5_f_dmpi_8h.html#a99bc5a964089fea144e7056b004bcc16">H5FD_mpio_xfer_t</a> xfer_mode )</div>
<div class="line"> dxpl_id IN: Data transfer <span class="keyword">property</span> list identifier</div>
<div class="line"> xfer_mode IN: Transfer mode:</div>
<div class="line"> <a class="code" href="_h5_f_dmpi_8h.html#a99bc5a964089fea144e7056b004bcc16a6c67820a8798cd75a6f0ebbb44e9a2af">H5FD_MPIO_INDEPENDENT</a> - use independent I/O access</div>
<div class="line"> (<span class="keywordflow">default</span>)</div>
<div class="line"> <a class="code" href="_h5_f_dmpi_8h.html#a99bc5a964089fea144e7056b004bcc16a75d4dc80546ad3c16d2d7647ab267fab">H5FD_MPIO_COLLECTIVE</a> - use collective I/O access</div>
<div class="ttc" id="a_h5_f_dmpi_8h_html_a99bc5a964089fea144e7056b004bcc16"><div class="ttname"><a href="_h5_f_dmpi_8h.html#a99bc5a964089fea144e7056b004bcc16">H5FD_mpio_xfer_t</a></div><div class="ttdeci">H5FD_mpio_xfer_t</div><div class="ttdef"><b>Definition:</b> H5FDmpi.h:36</div></div>
<div class="ttc" id="a_h5_f_dmpi_8h_html_a99bc5a964089fea144e7056b004bcc16a6c67820a8798cd75a6f0ebbb44e9a2af"><div class="ttname"><a href="_h5_f_dmpi_8h.html#a99bc5a964089fea144e7056b004bcc16a6c67820a8798cd75a6f0ebbb44e9a2af">H5FD_MPIO_INDEPENDENT</a></div><div class="ttdeci">@ H5FD_MPIO_INDEPENDENT</div><div class="ttdef"><b>Definition:</b> H5FDmpi.h:37</div></div>
<div class="ttc" id="a_h5_f_dmpi_8h_html_a99bc5a964089fea144e7056b004bcc16a75d4dc80546ad3c16d2d7647ab267fab"><div class="ttname"><a href="_h5_f_dmpi_8h.html#a99bc5a964089fea144e7056b004bcc16a75d4dc80546ad3c16d2d7647ab267fab">H5FD_MPIO_COLLECTIVE</a></div><div class="ttdeci">@ H5FD_MPIO_COLLECTIVE</div><div class="ttdef"><b>Definition:</b> H5FDmpi.h:38</div></div>
<div class="ttc" id="a_h5_ipublic_8h_html_a0045db7ff9c22ad35db6ae91662e1943"><div class="ttname"><a href="_h5_ipublic_8h.html#a0045db7ff9c22ad35db6ae91662e1943">hid_t</a></div><div class="ttdeci">int64_t hid_t</div><div class="ttdef"><b>Definition:</b> H5Ipublic.h:60</div></div>
<div class="ttc" id="a_h5public_8h_html_a3b079ecf932a5c599499cf7e298af160"><div class="ttname"><a href="_h5public_8h.html#a3b079ecf932a5c599499cf7e298af160">herr_t</a></div><div class="ttdeci">int herr_t</div><div class="ttdef"><b>Definition:</b> H5public.h:235</div></div>
<div class="ttc" id="agroup___d_x_p_l_html_ga001a22b64f60b815abf5de8b4776f09e"><div class="ttname"><a href="group___d_x_p_l.html#ga001a22b64f60b815abf5de8b4776f09e">H5Pset_dxpl_mpio</a></div><div class="ttdeci">H5_DLL herr_t H5Pset_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t xfer_mode)</div><div class="ttdoc">Sets data transfer mode.</div></div>
</div><!-- fragment --><p class="endli"><em>Fortran</em> </p><div class="fragment"><div class="line">h5pset_dxpl_mpi_f (prp_id, data_xfer_mode, hdferr)</div>
<div class="line"> prp_id IN: Property List Identifier (INTEGER (HID_T))</div>
<div class="line"> data_xfer_mode IN: Data transfer mode (INTEGER)</div>
<div class="line"> H5FD_MPIO_INDEPENDENT_F (0)</div>
<div class="line"> H5FD_MPIO_COLLECTIVE_F (1)</div>
<div class="line"> hdferr IN: Error code (INTEGER)</div>
</div><!-- fragment --> </li>
<li>
<p class="startli">Access the dataset with the defined transfer property list. All processes that have opened a dataset may do collective I/O. Each process may do an independent and arbitrary number of data I/O access calls, using: <a class="el" href="group___h5_d.html#ga98f44998b67587662af8b0d8a0a75906" title="Writes raw data from a buffer to a dataset.">H5Dwrite</a> <a class="el" href="group___h5_d.html#ga8287d5a7be7b8e55ffeff68f7d26811c" title="Reads raw data from a dataset into a provided buffer.">H5Dread</a></p>
<p class="endli">If a dataset is unlimited, you can extend it with a collective call to: <a class="el" href="group___h5_d.html#gac4c0ff57977b1f39c1055296e39cbe91" title="Extends a dataset.">H5Dextend</a> </p>
</li>
</ul>
</li>
</ol>
<p>The following code demonstrates a collective write using Parallel HDF5: <em>C</em> </p><div class="fragment"><div class="line"> 95 <span class="comment">/*</span></div>
<div class="line"><span class="comment"> 96 * Create property list for collective dataset write.</span></div>
<div class="line"><span class="comment"> 97 */</span></div>
<div class="line"> 98 plist_id = <a class="code" href="group___p_l_c_r.html#gaf1b11da01d4d45d788c45f8bc5f0cbfa">H5Pcreate</a> (<a class="code" href="_h5_ppublic_8h.html#a6f9c8a5aba72c0445fff384bf418a80d">H5P_DATASET_XFER</a>); 99 <a class="code" href="group___d_x_p_l.html#ga001a22b64f60b815abf5de8b4776f09e">H5Pset_dxpl_mpio</a> (plist_id, <a class="code" href="_h5_f_dmpi_8h.html#a99bc5a964089fea144e7056b004bcc16a75d4dc80546ad3c16d2d7647ab267fab">H5FD_MPIO_COLLECTIVE</a>);</div>
<div class="line">100</div>
<div class="line">101 status = <a class="code" href="group___h5_d.html#ga98f44998b67587662af8b0d8a0a75906">H5Dwrite</a> (dset_id, <a class="code" href="group___p_d_t_n_a_t.html#ga3cf93ffc6782be68070ef8e00f219ec2">H5T_NATIVE_INT</a>, memspace, filespace,</div>
<div class="line">102 plist_id, data);</div>
<div class="ttc" id="a_h5_ppublic_8h_html_a6f9c8a5aba72c0445fff384bf418a80d"><div class="ttname"><a href="_h5_ppublic_8h.html#a6f9c8a5aba72c0445fff384bf418a80d">H5P_DATASET_XFER</a></div><div class="ttdeci">#define H5P_DATASET_XFER</div><div class="ttdef"><b>Definition:</b> H5Ppublic.h:55</div></div>
<div class="ttc" id="agroup___h5_d_html_ga98f44998b67587662af8b0d8a0a75906"><div class="ttname"><a href="group___h5_d.html#ga98f44998b67587662af8b0d8a0a75906">H5Dwrite</a></div><div class="ttdeci">herr_t H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, const void *buf)</div><div class="ttdoc">Writes raw data from a buffer to a dataset.</div></div>
<div class="ttc" id="agroup___p_d_t_n_a_t_html_ga3cf93ffc6782be68070ef8e00f219ec2"><div class="ttname"><a href="group___p_d_t_n_a_t.html#ga3cf93ffc6782be68070ef8e00f219ec2">H5T_NATIVE_INT</a></div><div class="ttdeci">#define H5T_NATIVE_INT</div><div class="ttdef"><b>Definition:</b> H5Tpublic.h:767</div></div>
</div><!-- fragment --><p><em>Fortran</em> </p><div class="fragment"><div class="line">108 ! Create <span class="keyword">property</span> list <span class="keywordflow">for</span> collective dataset write</div>
<div class="line">109 !</div>
<div class="line">110 CALL <a class="code" href="group___f_h5_p.html#gae34064e5081802ef4c8e3c84e279b6c8">h5pcreate_f</a> (H5P_DATASET_XFER_F, plist_id, error) 111 CALL <a class="code" href="group___f_h5_p.html#gaa0e7d553d7de22e918d585ecc8b41bc6">h5pset_dxpl_mpio_f</a> (plist_id, H5FD_MPIO_COLLECTIVE_F, error)</div>
<div class="line">112</div>
<div class="line">113 !</div>
<div class="line">114 ! Write the dataset collectively.</div>
<div class="line">115 !</div>
<div class="line">116 CALL <a class="code" href="group___f_h5_d.html#ga474d18ed38c193fd1eb36b1b73f65ea8">h5dwrite_f</a> (dset_id, H5T_NATIVE_INTEGER, data, dimsfi, error, &</div>
<div class="line">117 file_space_id = filespace, mem_space_id = memspace, xfer_prp = plist_id)</div>
<div class="ttc" id="agroup___f_h5_d_html_ga474d18ed38c193fd1eb36b1b73f65ea8"><div class="ttname"><a href="group___f_h5_d.html#ga474d18ed38c193fd1eb36b1b73f65ea8">h5d::h5dwrite_f</a></div><div class="ttdeci">subroutine h5dwrite_f(dset_id, mem_type_id, buf, hdferr, mem_space_id, file_space_id, xfer_prp)</div><div class="ttdoc">Writes raw data from a buffer to a dataset.</div><div class="ttdef"><b>Definition:</b> H5Dff.F90:1633</div></div>
<div class="ttc" id="agroup___f_h5_p_html_gaa0e7d553d7de22e918d585ecc8b41bc6"><div class="ttname"><a href="group___f_h5_p.html#gaa0e7d553d7de22e918d585ecc8b41bc6">h5p::h5pset_dxpl_mpio_f</a></div><div class="ttdeci">subroutine h5pset_dxpl_mpio_f(prp_id, data_xfer_mode, hdferr)</div><div class="ttdoc">Sets data transfer mode.</div><div class="ttdef"><b>Definition:</b> H5Pff.F90:5450</div></div>
</div><!-- fragment --><p>The following example programs create an HDF5 dataset using Parallel HDF5: <a href="https://github.com/HDFGroup/hdf5-examples/blob/master/C/H5Parallel/ph5_dataset.c">C: dataset.c</a> <a href="https://github.com/HDFGroup/hdf5-examples/blob/master/Fortran/H5Parallel/ph5_f90_dataset.F90">F90: dataset.F90</a></p>
<h3><a class="anchor" id="subsec_pintro_hyperslabs"></a>
Hyperslabs</h3>
<p>The programming model for writing and reading hyperslabs is: /li Each process defines the memory and file hyperslabs. /li Each process executes a partial write/read call which is either collective or independent.</p>
<p>The memory and file hyperslabs in the first step are defined with the <a class="el" href="group___h5_s.html#ga6adfdf1b95dc108a65bf66e97d38536d" title="Selects a hyperslab region to add to the current selected region.">H5Sselect_hyperslab</a>.</p>
<p>The start (or offset), count, stride, and block parameters define the portion of the dataset to write to. By changing the values of these parameters you can write hyperslabs with Parallel HDF5 by contiguous hyperslab, by regularly spaced data in a column/row, by patterns, and by chunks:</p>
<table class="doxtable">
<tr>
<td><ul>
<li><a class="el" href="_intro_par_cont_hyperslab.html">Writing by Contiguous Hyperslab</a> </li>
</ul>
</td></tr>
<tr>
<td><ul>
<li><a class="el" href="_intro_par_regular_spaced.html">Writing by Regularly Spaced Data</a> </li>
</ul>
</td></tr>
<tr>
<td><ul>
<li><a class="el" href="_intro_par_pattern.html">Writing by Pattern</a> </li>
</ul>
</td></tr>
<tr>
<td><ul>
<li><a class="el" href="_intro_par_chunk.html">Writing by Chunk</a> </li>
</ul>
</td></tr>
</table>
<hr />
<p> Navigate back: <a class="el" href="index.html">Main</a> / <a class="el" href="_getting_started.html">Getting Started with HDF5</a> </p>
</div></div><!-- contents -->
</div><!-- PageDoc -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated on Sat Sep 9 2023 00:28:26 for HDF5 by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.9.1 </li>
</ul>
</div>
</body>
</html>
|