Files
hdf5/develop/group___p_h5_f.html
T
2026-09-02 01:23:41 +00:00

254 lines
16 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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=11"/>
<meta name="generator" content="Doxygen 1.16.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>HDF5: Parallel</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="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="cookie.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">
$(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="hdf5doxy.css" rel="stylesheet" type="text/css"/>
<link href="doxygen-awesome.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>
<div style="background:#FFDDDD;font-size:120%;text-align:center;margin:0;padding:5px">Help us improve by taking our short survey: <a href="https://www.hdfgroup.org/website-survey/">https://www.hdfgroup.org/website-survey/</a></div>
<!-- ... other metadata & script includes ... -->
<script type="text/javascript" src="doxygen-awesome-tabs.js"></script>
<script type="text/javascript">
DoxygenAwesomeTabs.init()
</script>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-57FMZK4S7X"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-57FMZK4S7X');
</script>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectlogo"><img alt="Logo" src="HDFG-logo.png"/></td>
<td id="projectalign">
<div id="projectname">HDF5<span id="projectnumber">&#160;Last Updated on 2026-09-02</span>
</div>
<div id="projectbrief">The HDF5 Field Guide</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.16.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search/",'.html');
</script>
<script type="text/javascript">
$(function() { codefold.init(); });
</script>
<div id="main-nav">
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="_getting_started.html"><span>Getting&#160;started</span></a></li>
<li><a href="_u_g.html"><span>User&#160;Guide</span></a></li>
<li><a href="_r_m.html"><span>Reference&#160;Manual</span></a></li>
<li><a href="_cookbook.html"><span>Cookbook</span></a></li>
<li><a href="_t_n.html"><span>Technical&#160;Notes</span></a></li>
<li><a href="_r_f_c.html"><span>RFCs</span></a></li>
<li><a href="_s_p_e_c.html"><span>Specifications</span></a></li>
<li><a href="_g_l_s.html"><span>Glossary</span></a></li>
<li><a href="_f_t_s.html"><span>Full-Text&#160;Search</span></a></li>
<li><a href="_about.html"><span>About</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<span id="MSearchSelect" class="search-icon" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()"><span class="search-icon-dropdown"></span></span>
<input type="text" id="MSearchField" value="" placeholder="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()"><div id="MSearchCloseImg" class="close-icon"></div></a>
</span>
</div>
</li>
</ul>
</div>
</div><!-- main-nav -->
</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">
$(function(){initNavTree('group___p_h5_f.html','',''); });
</script>
<div id="container">
<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">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div class="header">
<div class="headertitle"><div class="title">Parallel <div class="ingroups"><a class="el" href="group___h5_f.html">Files (H5F)</a></div></div></div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 id="header-details" class="groupheader">Detailed Description</h2>
<div class="textblock"></div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 id="header-func-members" class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga5356a1bee667b2a7dd1b657c820755fd" id="r_ga5356a1bee667b2a7dd1b657c820755fd"><td class="memItemLeft"><a class="el" href="_h5public_8h.html#a3b079ecf932a5c599499cf7e298af160">herr_t</a>&#160;</td><td class="memItemRight"><a class="el" href="#ga5356a1bee667b2a7dd1b657c820755fd">H5Fget_mpi_atomicity</a> (<a class="el" href="_h5_ipublic_8h.html#a0045db7ff9c22ad35db6ae91662e1943">hid_t</a> file_id, bool *flag)</td></tr>
<tr class="memdesc:ga5356a1bee667b2a7dd1b657c820755fd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Retrieves the atomicity mode in use. <br /></td></tr>
<tr class="memitem:gaaefabc54e36a2d13325e9a853400f359" id="r_gaaefabc54e36a2d13325e9a853400f359"><td class="memItemLeft"><a class="el" href="_h5public_8h.html#a3b079ecf932a5c599499cf7e298af160">herr_t</a>&#160;</td><td class="memItemRight"><a class="el" href="#gaaefabc54e36a2d13325e9a853400f359">H5Fset_mpi_atomicity</a> (<a class="el" href="_h5_ipublic_8h.html#a0045db7ff9c22ad35db6ae91662e1943">hid_t</a> file_id, bool flag)</td></tr>
<tr class="memdesc:gaaefabc54e36a2d13325e9a853400f359"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the MPI atomicity mode. <br /></td></tr>
</table>
<a name="doc-func-members" id="doc-func-members"></a><h2 id="header-doc-func-members" class="groupheader">Function Documentation</h2>
<a id="ga5356a1bee667b2a7dd1b657c820755fd" name="ga5356a1bee667b2a7dd1b657c820755fd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga5356a1bee667b2a7dd1b657c820755fd">&#9670;&#160;</a></span>H5Fget_mpi_atomicity()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_h5public_8h.html#a3b079ecf932a5c599499cf7e298af160">herr_t</a> H5Fget_mpi_atomicity </td>
<td>(</td>
<td class="paramtype"><a class="el" href="_h5_ipublic_8h.html#a0045db7ff9c22ad35db6ae91662e1943">hid_t</a></td> <td class="paramname"><span class="paramname"><em>file_id</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool *</td> <td class="paramname"><span class="paramname"><em>flag</em></span>&#160;)</td>
</tr>
</table>
</div><div class="memdoc">
<p>Retrieves the atomicity mode in use. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">file_id</td><td>File identifier </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">flag</td><td>Logical flag for atomicity setting. Valid values are: <ul>
<li>1 &ndash; MPI file access is set to atomic mode. </li>
<li>0 &ndash; MPI file access is set to nonatomic mode. </li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns a non-negative value if successful; otherwise, returns a negative value.</dd></dl>
<p><a class="el" href="#ga5356a1bee667b2a7dd1b657c820755fd" title="Retrieves the atomicity mode in use.">H5Fget_mpi_atomicity()</a> retrieves the current consistency semantics mode for data access for the file <code class="param">file_id</code>.</p>
<p>Upon successful return, <code class="param">flag</code> will be set to <code>1</code> if file access is set to atomic mode and <code>0</code> if file access is set to nonatomic mode.</p>
<dl class="section see"><dt>See also</dt><dd><a href="https://support.hdfgroup.org/releases/hdf5/documentation/rfc/RFC%20PHDF5%20Consistency%20Semantics%20MC%20120328.docx.pdf">Enabling a Strict Consistency Semantics Model in Parallel HDF5</a></dd></dl>
<dl class="section since"><dt>Since</dt><dd>1.8.9 </dd></dl>
</div>
</div>
<a id="gaaefabc54e36a2d13325e9a853400f359" name="gaaefabc54e36a2d13325e9a853400f359"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaaefabc54e36a2d13325e9a853400f359">&#9670;&#160;</a></span>H5Fset_mpi_atomicity()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_h5public_8h.html#a3b079ecf932a5c599499cf7e298af160">herr_t</a> H5Fset_mpi_atomicity </td>
<td>(</td>
<td class="paramtype"><a class="el" href="_h5_ipublic_8h.html#a0045db7ff9c22ad35db6ae91662e1943">hid_t</a></td> <td class="paramname"><span class="paramname"><em>file_id</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool</td> <td class="paramname"><span class="paramname"><em>flag</em></span>&#160;)</td>
</tr>
</table>
</div><div class="memdoc">
<p>Sets the MPI atomicity mode. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">file_id</td><td>File identifier </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">flag</td><td>Logical flag for atomicity setting. Valid values are: <ul>
<li><code>1</code> &ndash; Sets MPI file access to atomic mode. </li>
<li><code>0</code> &ndash; Sets MPI file access to nonatomic mode. </li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Returns a non-negative value if successful; otherwise, returns a negative value.</dd></dl>
<dl class="section user"><dt>Motivation</dt><dd><a class="el" href="#gaaefabc54e36a2d13325e9a853400f359" title="Sets the MPI atomicity mode.">H5Fset_mpi_atomicity()</a> is applicable only in parallel environments using MPI I/O. The function is one of the tools used to ensure sequential consistency. This means that a set of operations will behave as though they were performed in a serial order consistent with the program order.</dd></dl>
<p><a class="el" href="#gaaefabc54e36a2d13325e9a853400f359" title="Sets the MPI atomicity mode.">H5Fset_mpi_atomicity()</a> sets MPI consistency semantics for data access to the file, <code class="param">file_id</code>.</p>
<p>If <code class="param">flag</code> is set to <code>1</code>, all file access operations will appear atomic, guaranteeing sequential consistency. If <code class="param">flag</code> is set to <code>0</code>, enforcement of atomic file access will be turned off.</p>
<p><a class="el" href="#gaaefabc54e36a2d13325e9a853400f359" title="Sets the MPI atomicity mode.">H5Fset_mpi_atomicity()</a> is a collective function and all participating processes must pass the same values for <code class="param">file_id</code> and <code class="param">flag</code>.</p>
<p>This function is available only when the HDF5 library is configured with parallel support (<span class="tt">HDF5_ENABLE_PARALLEL</span>). It is useful only when used with the <a class="el" href="_h5_f_dmpio_8h.html#a7a231bc1d78744088a4e1d297284cabf">H5FD_MPIO</a> driver (see <a class="el" href="group___f_a_p_l.html#ga7519d659a83ef5717d7a5d95baf0e9b1" title="Stores MPI IO communicator information to the file access property list.">H5Pset_fapl_mpio()</a>). </p>
<dl class="section attention"><dt>Attention</dt><dd><p class="startdd"><a class="el" href="#gaaefabc54e36a2d13325e9a853400f359" title="Sets the MPI atomicity mode.">H5Fset_mpi_atomicity()</a> calls <span class="tt">MPI_File_set_atomicity</span> underneath and is not supported if the execution platform does not support <span class="tt">MPI_File_set_atomicity</span>. When it is supported and used, the performance of data access operations may drop significantly.</p>
<p class="enddd">In certain scenarios, even when <span class="tt">MPI_File_set_atomicity</span> is supported, setting atomicity with <a class="el" href="#gaaefabc54e36a2d13325e9a853400f359" title="Sets the MPI atomicity mode.">H5Fset_mpi_atomicity()</a> and <code class="param">flag</code> set to 1 does not always yield strictly atomic updates. For example, some <a class="el" href="group___h5_d.html#ga98f44998b67587662af8b0d8a0a75906" title="Writes raw data from a buffer to a dataset.">H5Dwrite()</a> calls translate to multiple <span class="tt">MPI_File_write_at</span> calls. This happens in all cases where the high-level file access routine translates to multiple lower level file access routines. The following scenarios will raise this issue: </p><ul>
<li>Non-contiguous file access using independent I/O </li>
<li>Partial collective I/O using chunked access </li>
<li>Collective I/O using filters or when data conversion is required</li>
</ul>
<p>This issue arises because MPI atomicity is a matter of MPI file access operations rather than HDF5 access operations. But the user is normally seeking atomicity at the HDF5 level. To accomplish this, the application must set a barrier after a write, <a class="el" href="group___h5_d.html#ga98f44998b67587662af8b0d8a0a75906" title="Writes raw data from a buffer to a dataset.">H5Dwrite()</a>, but before the next read, <a class="el" href="group___h5_d.html#ga8287d5a7be7b8e55ffeff68f7d26811c" title="Reads raw data from a dataset into a provided buffer.">H5Dread()</a>, in addition to calling <a class="el" href="#gaaefabc54e36a2d13325e9a853400f359" title="Sets the MPI atomicity mode.">H5Fset_mpi_atomicity()</a>.The barrier will guarantee that all underlying write operations execute atomically before the read operations starts. This ensures additional ordering semantics and will normally produce the desired behavior. </p>
</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a href="https://support.hdfgroup.org/releases/hdf5/documentation/rfc/RFC%20PHDF5%20Consistency%20Semantics%20MC%20120328.docx.pdf">Enabling a Strict Consistency Semantics Model in Parallel HDF5</a></dd></dl>
<dl class="section since"><dt>Since</dt><dd>1.8.9 </dd></dl>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="page-nav" class="page-nav-panel">
<div id="page-nav-resize-handle"></div>
<div id="page-nav-tree">
<div id="page-nav-contents">
</div><!-- page-nav-contents -->
</div><!-- page-nav-tree -->
</div><!-- page-nav -->
</div><!-- container -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.16.1 </li>
</ul>
</div>
</body>
</html>