98 lines
15 KiB
HTML
Executable File
98 lines
15 KiB
HTML
Executable File
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
|
<title>MPI On Cell (Documentation): src/ppu/communication/moc_barrier_ppu.c Source File</title>
|
|
<link href="../../doxygen.css" rel="stylesheet" type="text/css">
|
|
<link href="../../tabs.css" rel="stylesheet" type="text/css">
|
|
</head><body>
|
|
<!-- Generated by Doxygen 1.5.6 -->
|
|
<div class="navigation" id="top">
|
|
<div class="tabs">
|
|
<ul>
|
|
<li><a href="../../main.html"><span>Main Page</span></a></li>
|
|
<li><a href="../../modules.html"><span>Modules</span></a></li>
|
|
<li><a href="../../annotated.html"><span>Data Structures</span></a></li>
|
|
<li class="current"><a href="../../files.html"><span>Files</span></a></li>
|
|
</ul>
|
|
</div>
|
|
<h1>src/ppu/communication/moc_barrier_ppu.c</h1><a href="../../d1/d72/moc__barrier__ppu_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#include <stdio.h></span>
|
|
<a name="l00002"></a>00002 <span class="preprocessor">#include <string.h></span>
|
|
<a name="l00003"></a>00003
|
|
<a name="l00004"></a>00004 <span class="preprocessor">#include <<a class="code" href="../../d0/d3a/spu_2moc_8h.html">moc.h</a>></span>
|
|
<a name="l00005"></a>00005 <span class="preprocessor">#include <<a class="code" href="../../d9/db3/imoc_8h.html">internal/imoc.h</a>></span>
|
|
<a name="l00006"></a>00006 <span class="preprocessor">#include <<a class="code" href="../../d8/d98/imoc__macros__ppu_8h.html">internal/ppu/imoc_macros_ppu.h</a>></span>
|
|
<a name="l00007"></a>00007 <span class="preprocessor">#include <<a class="code" href="../../d6/d09/imoc__core__ppu_8h.html">internal/ppu/imoc_core_ppu.h</a>></span>
|
|
<a name="l00008"></a>00008
|
|
<a name="l00009"></a><a class="code" href="../../d1/d72/moc__barrier__ppu_8c.html#8a4118b9364b4bb700441e9e9dd9c3ab">00009</a> <span class="preprocessor">#define IMOC_BARRIER_TAG 1</span>
|
|
<a name="l00010"></a>00010 <span class="preprocessor"></span>
|
|
<a name="l00011"></a><a class="code" href="../../db/dc2/group__broadcast.html#g110b00d5a4d9f970ddf8e9bd4c2d8834">00011</a> <span class="keywordtype">int</span> <a class="code" href="../../db/dc2/group__broadcast.html#g110b00d5a4d9f970ddf8e9bd4c2d8834" title="Blocks the caller until all processes in the communicator have called it; that is...">MOC_Barrier</a>(<a class="code" href="../../d1/dd1/group__comm__mgt.html#g3d2b8a9af65bff5f79d02bda13616767" title="Communicator-Handle.">MOC_Comm</a> comm)
|
|
<a name="l00012"></a>00012 {
|
|
<a name="l00013"></a>00013 <a class="code" href="../../df/dd4/structmoc__message__envelope__struct.html" title="Message-envelope structure.">moc_message_envelope_t</a> tempQueue[<a class="code" href="../../dd/df8/group__internal__core.html#geed5a271d50368d3cf9a858c4f57c895" title="Information each node knowns about himself and the world.">node_handle</a>.<a class="code" href="../../d8/d93/structmoc__node__handle__ppu__struct.html#ee1aa72cd99190cf97523a955cfa6141" title="Size of a message-queue.">queue_size</a>] <a class="code" href="../../d3/dd3/group__internal__p2p__bmalloc.html#gad8750c7ba3d6da9c137c2c462d2c531" title="void bmalloc_print_nodes() { if (!bmalloc_first_node) printf(&quot;No nodes in list\n&quot;);...">__attribute__</a>((__aligned__(16)));
|
|
<a name="l00014"></a>00014 <a class="code" href="../../df/dd4/structmoc__message__envelope__struct.html" title="Message-envelope structure.">moc_message_envelope_t</a> *sourceQueueEntry;
|
|
<a name="l00015"></a>00015 <a class="code" href="../../dd/d7a/structMOC__Status__struct.html" title="Structure holding information about a received message.">MOC_Status</a> status;
|
|
<a name="l00016"></a>00016 <span class="keywordtype">int</span> err, qindex;
|
|
<a name="l00017"></a>00017 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> dmastatus;
|
|
<a name="l00018"></a>00018
|
|
<a name="l00019"></a>00019 <span class="comment">//if (comm == MOC_COMM_SELF && node_handle.rank == node_handle.comm_size - 1)</span>
|
|
<a name="l00020"></a>00020 <span class="keywordflow">if</span> (comm == <a class="code" href="../../d1/dd1/group__comm__mgt.html#gf8c5dfb6bb79027948fe63f4cf6504eb" title="Specifies a constant that contains only the calling process.">MOC_COMM_SELF</a>)
|
|
<a name="l00021"></a>00021 <span class="keywordflow">return</span> 0;
|
|
<a name="l00022"></a>00022 <span class="keywordflow">else</span>
|
|
<a name="l00023"></a>00023 <span class="keywordflow">if</span> (comm != <a class="code" href="../../d1/dd1/group__comm__mgt.html#g14e1cb53b99b5e239d4cc6a8d370ad94" title="Specifies a constant that contains all of the processes.">MOC_COMM_WORLD</a>)
|
|
<a name="l00024"></a>00024 <span class="keywordflow">return</span> <a class="code" href="../../d8/da1/group__environment__error.html#gc1e776c0e7cb8c97391dd6ac476295a1" title="Invalid communicator.">MOC_ERR_COMM</a>;
|
|
<a name="l00025"></a>00025
|
|
<a name="l00026"></a>00026 <span class="comment">/* Get queue from remote-node, choose fastest method depending on transfer-size */</span>
|
|
<a name="l00027"></a>00027 <span class="keywordflow">if</span> (<a class="code" href="../../dd/df8/group__internal__core.html#geed5a271d50368d3cf9a858c4f57c895" title="Information each node knowns about himself and the world.">node_handle</a>.<a class="code" href="../../d8/d93/structmoc__node__handle__ppu__struct.html#ee1aa72cd99190cf97523a955cfa6141" title="Size of a message-queue.">queue_size</a> * <span class="keyword">sizeof</span>(<a class="code" href="../../df/dd4/structmoc__message__envelope__struct.html" title="Message-envelope structure.">moc_message_envelope_t</a>)
|
|
<a name="l00028"></a>00028 > <a class="code" href="../../d8/d88/group__internal__p2p__main.html#ge9f5f9bdfa51d7683fbe312d4a667afd" title="Defines a treshold, when to use memcpy and when to use DMA in a get-operation on...">MEMCPY_GET_TRESHOLD</a>)
|
|
<a name="l00029"></a>00029 {
|
|
<a name="l00030"></a>00030 err = spe_mfcio_put(<a class="code" href="../../dc/df1/group__internal__spu__thread.html#ga5b74732b1e31ec1674ea0e5ae465c4e" title="array of SPU-Threads.">moc_spu_thread_list</a>[<a class="code" href="../../dd/df8/group__internal__core.html#geed5a271d50368d3cf9a858c4f57c895" title="Information each node knowns about himself and the world.">node_handle</a>.<a class="code" href="../../d8/d93/structmoc__node__handle__ppu__struct.html#3779cc1bda02c45a880389b109173778" title="number of overall processes">comm_size</a> - 1
|
|
<a name="l00031"></a>00031 - <a class="code" href="../../dc/df1/group__internal__spu__thread.html#gf4270da4dbf663fde50a876067ed0d52" title="actual number of PPU-Threads.">moc_ppu_thread_count</a>].<a class="code" href="../../d1/d8b/structmoc__spu__thread__struct.html#61d6807e3bab9b37ef07b0543e33574e" title="SPE-Context.">speid</a>, <a class="code" href="../../df/ddf/group__internal__am.html#g48013d236aaa37226bbba460eaf3aca5" title="LS-Address of own remote queue at node &#39;rank&#39;.">IMOC_LS_REMOTE_QUEUE</a>(
|
|
<a name="l00032"></a>00032 <a class="code" href="../../dd/df8/group__internal__core.html#geed5a271d50368d3cf9a858c4f57c895" title="Information each node knowns about himself and the world.">node_handle</a>.<a class="code" href="../../d8/d93/structmoc__node__handle__ppu__struct.html#3779cc1bda02c45a880389b109173778" title="number of overall processes">comm_size</a> - 1), tempQueue, <a class="code" href="../../dd/df8/group__internal__core.html#geed5a271d50368d3cf9a858c4f57c895" title="Information each node knowns about himself and the world.">node_handle</a>.<a class="code" href="../../d8/d93/structmoc__node__handle__ppu__struct.html#ee1aa72cd99190cf97523a955cfa6141" title="Size of a message-queue.">queue_size</a>
|
|
<a name="l00033"></a>00033 * <span class="keyword">sizeof</span>(<a class="code" href="../../df/dd4/structmoc__message__envelope__struct.html" title="Message-envelope structure.">moc_message_envelope_t</a>), 15, 0, 0);
|
|
<a name="l00034"></a>00034 <span class="keywordflow">if</span> (err)
|
|
<a name="l00035"></a>00035 <span class="keywordflow">return</span> <a class="code" href="../../d8/da1/group__environment__error.html#g05b3a70831c823a59014c4853a76ca7e" title="Internal MOC (implementation) error.">MOC_ERR_INTERN</a>;
|
|
<a name="l00036"></a>00036 err = spe_mfcio_tag_status_read(
|
|
<a name="l00037"></a>00037 <a class="code" href="../../dc/df1/group__internal__spu__thread.html#ga5b74732b1e31ec1674ea0e5ae465c4e" title="array of SPU-Threads.">moc_spu_thread_list</a>[<a class="code" href="../../dd/df8/group__internal__core.html#geed5a271d50368d3cf9a858c4f57c895" title="Information each node knowns about himself and the world.">node_handle</a>.<a class="code" href="../../d8/d93/structmoc__node__handle__ppu__struct.html#3779cc1bda02c45a880389b109173778" title="number of overall processes">comm_size</a> - 1
|
|
<a name="l00038"></a>00038 - <a class="code" href="../../dc/df1/group__internal__spu__thread.html#gf4270da4dbf663fde50a876067ed0d52" title="actual number of PPU-Threads.">moc_ppu_thread_count</a>].<a class="code" href="../../d1/d8b/structmoc__spu__thread__struct.html#61d6807e3bab9b37ef07b0543e33574e" title="SPE-Context.">speid</a>, 0, SPE_TAG_ALL,
|
|
<a name="l00039"></a>00039 &dmastatus);
|
|
<a name="l00040"></a>00040 <span class="keywordflow">if</span> (err)
|
|
<a name="l00041"></a>00041 <span class="keywordflow">return</span> <a class="code" href="../../d8/da1/group__environment__error.html#g05b3a70831c823a59014c4853a76ca7e" title="Internal MOC (implementation) error.">MOC_ERR_INTERN</a>;
|
|
<a name="l00042"></a>00042 }
|
|
<a name="l00043"></a>00043 <span class="keywordflow">else</span>
|
|
<a name="l00044"></a>00044 {
|
|
<a name="l00045"></a>00045 memcpy(tempQueue, (<span class="keywordtype">void</span>*) <a class="code" href="../../df/ddf/group__internal__am.html#gf02c3d971a2b5e72d22c9c16b1748c04" title="Effective base-address of own remote queue at node &#39;rank&#39;.">IMOC_EA_REMOTE_QUEUE</a>(<a class="code" href="../../dd/df8/group__internal__core.html#geed5a271d50368d3cf9a858c4f57c895" title="Information each node knowns about himself and the world.">node_handle</a>.<a class="code" href="../../d8/d93/structmoc__node__handle__ppu__struct.html#3779cc1bda02c45a880389b109173778" title="number of overall processes">comm_size</a>
|
|
<a name="l00046"></a>00046 - 1), <a class="code" href="../../dd/df8/group__internal__core.html#geed5a271d50368d3cf9a858c4f57c895" title="Information each node knowns about himself and the world.">node_handle</a>.<a class="code" href="../../d8/d93/structmoc__node__handle__ppu__struct.html#ee1aa72cd99190cf97523a955cfa6141" title="Size of a message-queue.">queue_size</a> * <span class="keyword">sizeof</span>(<a class="code" href="../../df/dd4/structmoc__message__envelope__struct.html" title="Message-envelope structure.">moc_message_envelope_t</a>));
|
|
<a name="l00047"></a>00047 }
|
|
<a name="l00048"></a>00048
|
|
<a name="l00049"></a>00049 <span class="comment">/* search free entry in message-queue */</span>
|
|
<a name="l00050"></a>00050 err = <a class="code" href="../../d8/d88/group__internal__p2p__main.html#g2a948cdecce651ae6cc1b0c0ddb1b750" title="Get next free entry in message-queue (a local copy of the message-queue has to be...">IMOC_getFreeEntry</a>(tempQueue, <a class="code" href="../../d1/d72/moc__barrier__ppu_8c.html#8a4118b9364b4bb700441e9e9dd9c3ab">IMOC_BARRIER_TAG</a>, comm, 1, &qindex);
|
|
<a name="l00051"></a>00051 <span class="keywordflow">if</span> (err)
|
|
<a name="l00052"></a>00052 <span class="keywordflow">return</span> err;
|
|
<a name="l00053"></a>00053
|
|
<a name="l00054"></a>00054 tempQueue[qindex].communicator = comm;
|
|
<a name="l00055"></a>00055 tempQueue[qindex].flags.bits.special = 1;
|
|
<a name="l00056"></a>00056 tempQueue[qindex].flags.bits.valid = 1;
|
|
<a name="l00057"></a>00057 tempQueue[qindex].tag = <a class="code" href="../../d1/d72/moc__barrier__ppu_8c.html#8a4118b9364b4bb700441e9e9dd9c3ab">IMOC_BARRIER_TAG</a>;
|
|
<a name="l00058"></a>00058
|
|
<a name="l00059"></a>00059 <span class="comment">/* write message-envelope into queue, because transfer-size is always 16-byte,</span>
|
|
<a name="l00060"></a>00060 <span class="comment"> * memcpy is fastest method */</span>
|
|
<a name="l00061"></a>00061 memcpy((<span class="keywordtype">void</span>*) <a class="code" href="../../df/ddf/group__internal__am.html#gf9ad028ccbfa406c49a0ebd943486698" title="Effective base-address of own remote queue-entry at node &#39;rank&#39;.">IMOC_EA_REMOTE_QUEUE_ENTRY</a>(<a class="code" href="../../dd/df8/group__internal__core.html#geed5a271d50368d3cf9a858c4f57c895" title="Information each node knowns about himself and the world.">node_handle</a>.<a class="code" href="../../d8/d93/structmoc__node__handle__ppu__struct.html#3779cc1bda02c45a880389b109173778" title="number of overall processes">comm_size</a> - 1,
|
|
<a name="l00062"></a>00062 qindex), &tempQueue[qindex], <span class="keyword">sizeof</span>(<a class="code" href="../../df/dd4/structmoc__message__envelope__struct.html" title="Message-envelope structure.">moc_message_envelope_t</a>));
|
|
<a name="l00063"></a>00063
|
|
<a name="l00064"></a>00064 <span class="comment">//look up if there is data here</span>
|
|
<a name="l00065"></a>00065 sourceQueueEntry = 0;
|
|
<a name="l00066"></a>00066 <span class="keywordflow">while</span> (sourceQueueEntry == 0)
|
|
<a name="l00067"></a>00067 {
|
|
<a name="l00068"></a>00068 sourceQueueEntry = <a class="code" href="../../d8/d88/group__internal__p2p__main.html#g8980da77fa506e9a6d503c8c6eba68e2" title="Get the next valid message-envelope from &quot;source&quot; with specified &quot;tag&quot;...">IMOC_get_entry</a>(<a class="code" href="../../dd/df8/group__internal__core.html#geed5a271d50368d3cf9a858c4f57c895" title="Information each node knowns about himself and the world.">node_handle</a>.<a class="code" href="../../d8/d93/structmoc__node__handle__ppu__struct.html#3779cc1bda02c45a880389b109173778" title="number of overall processes">comm_size</a> - 1,
|
|
<a name="l00069"></a>00069 <a class="code" href="../../d1/d72/moc__barrier__ppu_8c.html#8a4118b9364b4bb700441e9e9dd9c3ab">IMOC_BARRIER_TAG</a>, comm, 1, &status);
|
|
<a name="l00070"></a>00070 }
|
|
<a name="l00071"></a>00071 sourceQueueEntry-><a class="code" href="../../df/dd4/structmoc__message__envelope__struct.html#38288113f9b7adee1e444850112ff807" title="flag-union">flags</a>.<a class="code" href="../../df/dd4/structmoc__message__envelope__struct.html#e51379150ad496c8844a4b9b0096120b" title="union-value">value</a> = 0;
|
|
<a name="l00072"></a>00072
|
|
<a name="l00073"></a>00073 <span class="keywordflow">return</span> 0;
|
|
<a name="l00074"></a>00074 }
|
|
<a name="l00075"></a>00075
|
|
</pre></div></div>
|
|
<hr size="1"><address style="text-align: right;"><small>Generated on Thu Feb 12 13:49:47 2009 for MPI On Cell (Documentation) by
|
|
<a href="http://www.doxygen.org/index.html">
|
|
<img src="../../doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
|
|
</body>
|
|
</html>
|