blob: de6b81fb5102c2a0a0a925aab933879d56f4a923 [file] [log] [blame]
<h2>The <code>upc_affinitysize</code> function</h2>
<h4>Synopsis</h4>
<pre>
#include &lt;upc.h&gt;
size_t upc_affinitysize(size_t totalsize,
size_t nbytes,
size_t threadid);
</pre>
<p>
<h4>Description</h4>
<p>
The <code>upc_affinitysize </code> function is a convenience function which calculates the exact size
of the local portion of the data in a shared object with affinity to <code>threadid</code>.
<p>In the case of a dynamically allocated shared object, the <code>totalsize</code> argument
shall be <code>nbytes*nblocks</code> and the <code>nbytes</code> argument shall be <code>nbytes</code>,
where <code>nblocks</code> and <code>nbytes</code> are exactly as passed to <code>upc_global_alloc</code> or
<code>upc_all_alloc</code> when the object was allocated.
<p>In the case of a statically allocated shared object with declaration:
<pre>
shared [b] t d[s];
</pre>
the <code>totalsize</code> argument shall be <code>s * sizeof(t)</code> and the <code>nbytes</code> argument
shall be <code>b * sizeof(t)</code>. If the block size is indefinite, <code>nbytes</code> shall be 0.
<p><code>threadid</code> shall be a value in <code>0..(THREADS-1)</code>.
<p>&nbsp
<p>&nbsp
<p><a href="terms.html">Terms, definitions, and symbols</a><br>
<p><a href="index.html">Back to index of all UPC functions</a>