Files
MPIonCell/documentation/developer/html/de/dbb/imoc__get__entry_8c-source.html
2017-10-26 19:57:24 +02:00

114 lines
19 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/noarch/internal/communication/imoc_get_entry.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&nbsp;Page</span></a></li>
<li><a href="../../modules.html"><span>Modules</span></a></li>
<li><a href="../../annotated.html"><span>Data&nbsp;Structures</span></a></li>
<li class="current"><a href="../../files.html"><span>Files</span></a></li>
</ul>
</div>
<h1>src/noarch/internal/communication/imoc_get_entry.c</h1><a href="../../db/d33/imoc__get__entry_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 &lt;stdio.h&gt;</span>
<a name="l00002"></a>00002
<a name="l00003"></a>00003 <span class="preprocessor">#include &lt;<a class="code" href="../../d0/d3a/spu_2moc_8h.html">moc.h</a>&gt;</span>
<a name="l00004"></a>00004 <span class="preprocessor">#include &lt;<a class="code" href="../../d9/db3/imoc_8h.html">internal/imoc.h</a>&gt;</span>
<a name="l00005"></a>00005 <span class="preprocessor">#include &lt;<a class="code" href="../../d2/d42/imoc__macros_8h.html">internal/imoc_macros.h</a>&gt;</span>
<a name="l00006"></a>00006 <span class="preprocessor">#ifdef __SPU__</span>
<a name="l00007"></a>00007 <span class="preprocessor"></span><span class="preprocessor">#include &lt;<a class="code" href="../../d9/d00/imoc__core__spu_8h.html">internal/spu/imoc_core_spu.h</a>&gt;</span>
<a name="l00008"></a>00008 <span class="preprocessor">#else</span>
<a name="l00009"></a>00009 <span class="preprocessor"></span><span class="preprocessor">#include &lt;<a class="code" href="../../d6/d09/imoc__core__ppu_8h.html">internal/ppu/imoc_core_ppu.h</a>&gt;</span>
<a name="l00010"></a>00010 <span class="preprocessor">#endif </span>
<a name="l00011"></a>00011 <span class="preprocessor"></span>
<a name="l00012"></a>00012 <span class="comment">/*method looks for valid entries in the message queue*/</span>
<a name="l00013"></a><a class="code" href="../../d8/d88/group__internal__p2p__main.html#g8980da77fa506e9a6d503c8c6eba68e2">00013</a> <a class="code" href="../../df/dd4/structmoc__message__envelope__struct.html" title="Message-envelope structure.">moc_message_envelope_t</a>* <a class="code" href="../../d8/d88/group__internal__p2p__main.html#g8980da77fa506e9a6d503c8c6eba68e2" title="Get the next valid message-envelope from &amp;quot;source&amp;quot; with specified &amp;quot;tag&amp;quot;...">IMOC_get_entry</a>(<span class="keywordtype">int</span> source, <span class="keywordtype">int</span> tag, <a class="code" href="../../d1/dd1/group__comm__mgt.html#g3d2b8a9af65bff5f79d02bda13616767" title="Communicator-Handle.">MOC_Comm</a> comm,
<a name="l00014"></a>00014 <span class="keywordtype">int</span> isSpecial, <a class="code" href="../../dd/d7a/structMOC__Status__struct.html" title="Structure holding information about a received message.">MOC_Status</a> *status)
<a name="l00015"></a>00015 {
<a name="l00016"></a>00016 <a class="code" href="../../df/dd4/structmoc__message__envelope__struct.html" title="Message-envelope structure.">moc_message_envelope_t</a> *startQueue;
<a name="l00017"></a>00017 <span class="keywordtype">int</span> count;
<a name="l00018"></a>00018
<a name="l00019"></a>00019 <span class="comment">/*check if source is ANY_SOURCE*/</span>
<a name="l00020"></a>00020 <span class="keywordflow">if</span> (source == <a class="code" href="../../d1/d82/moc_8h.html#deff0c57411502be14ddf5fef3aa6e99" title="Indicates, in a receive, to accept a message from any source.">MOC_ANY_SOURCE</a>)
<a name="l00021"></a>00021 {
<a name="l00022"></a>00022 <span class="comment">/*set start to base adress of the message queue*/</span>
<a name="l00023"></a>00023 startQueue =( <a class="code" href="../../df/dd4/structmoc__message__envelope__struct.html" title="Message-envelope structure.">moc_message_envelope_t</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#58ca7dd0e2874d0317038dbb0c279b82" title="base-address of own message-queues">message_queue_base</a>;
<a name="l00024"></a>00024 <span class="comment">/*check if tag is ANY_TAG*/</span>
<a name="l00025"></a>00025 <span class="keywordflow">if</span>(tag == <a class="code" href="../../d1/d82/moc_8h.html#a6d9dac1d01f8d03aa144056921e04dd" title="Indicates, in a receive, to accept a message with any tag value.">MOC_ANY_TAG</a>)
<a name="l00026"></a>00026 {
<a name="l00027"></a>00027 <span class="keywordflow">for</span>(count=0;count&lt;(<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="../../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));count++)
<a name="l00028"></a>00028 {
<a name="l00029"></a>00029 <span class="comment">/*search for a valid entry*/</span>
<a name="l00030"></a>00030 <span class="keywordflow">if</span>(startQueue[count].flags.<a class="code" href="../../df/dd4/structmoc__message__envelope__struct.html#5538e79854840d3caf08b90b5409e16b" title="flag-struct">bits</a>.valid &amp;&amp; startQueue[count].<a class="code" href="../../df/dd4/structmoc__message__envelope__struct.html#84160292a4e38f9f72a2937e8a0205ad" title="Communicator of message.">communicator</a> == comm
<a name="l00031"></a>00031 &amp;&amp; startQueue[count].<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#5538e79854840d3caf08b90b5409e16b" title="flag-struct">bits</a>.special == isSpecial)
<a name="l00032"></a>00032 {
<a name="l00033"></a>00033 <span class="comment">/*calculate source*/</span>
<a name="l00034"></a>00034 <span class="keywordflow">if</span>(count/(<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>) &gt;= <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#9005ee3d6d0ee8b2f15628dcca724710" title="rank of node">rank</a>)
<a name="l00035"></a>00035 status-&gt;<a class="code" href="../../dd/d7a/structMOC__Status__struct.html#1a3fde58aca11d3b901c890916371661" title="message-source">MOC_SOURCE</a> = count/(<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>)+1;
<a name="l00036"></a>00036 <span class="keywordflow">else</span>
<a name="l00037"></a>00037 status-&gt;<a class="code" href="../../dd/d7a/structMOC__Status__struct.html#1a3fde58aca11d3b901c890916371661" title="message-source">MOC_SOURCE</a> = count/(<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="l00038"></a>00038 <span class="keywordflow">return</span> &amp;startQueue[count];
<a name="l00039"></a>00039 }
<a name="l00040"></a>00040 }
<a name="l00041"></a>00041 }
<a name="l00042"></a>00042 <span class="keywordflow">else</span>
<a name="l00043"></a>00043 {
<a name="l00044"></a>00044 <span class="keywordflow">for</span>(count=0;count&lt;(<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="../../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));count++)
<a name="l00045"></a>00045 {
<a name="l00046"></a>00046 <span class="comment">/*search for a valid entry with right tag*/</span>
<a name="l00047"></a>00047 <span class="keywordflow">if</span>(startQueue[count].flags.<a class="code" href="../../df/dd4/structmoc__message__envelope__struct.html#5538e79854840d3caf08b90b5409e16b" title="flag-struct">bits</a>.valid &amp;&amp; startQueue[count].<a class="code" href="../../df/dd4/structmoc__message__envelope__struct.html#75502fafc90d03a3b101e5c43c8c1727" title="Message-tag.">tag</a> == tag
<a name="l00048"></a>00048 &amp;&amp; startQueue[count].<a class="code" href="../../df/dd4/structmoc__message__envelope__struct.html#84160292a4e38f9f72a2937e8a0205ad" title="Communicator of message.">communicator</a> == comm
<a name="l00049"></a>00049 &amp;&amp; startQueue[count].<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#5538e79854840d3caf08b90b5409e16b" title="flag-struct">bits</a>.special == isSpecial)
<a name="l00050"></a>00050 {
<a name="l00051"></a>00051 <span class="comment">/*calculate source*/</span>
<a name="l00052"></a>00052 <span class="keywordflow">if</span>(count/(<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>) &gt;= <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#9005ee3d6d0ee8b2f15628dcca724710" title="rank of node">rank</a>)
<a name="l00053"></a>00053 status-&gt;<a class="code" href="../../dd/d7a/structMOC__Status__struct.html#1a3fde58aca11d3b901c890916371661" title="message-source">MOC_SOURCE</a> = count/(<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>)+1;
<a name="l00054"></a>00054 <span class="keywordflow">else</span>
<a name="l00055"></a>00055 status-&gt;<a class="code" href="../../dd/d7a/structMOC__Status__struct.html#1a3fde58aca11d3b901c890916371661" title="message-source">MOC_SOURCE</a> = count/(<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="l00056"></a>00056
<a name="l00057"></a>00057 <span class="keywordflow">return</span> &amp;startQueue[count];
<a name="l00058"></a>00058 }
<a name="l00059"></a>00059 }
<a name="l00060"></a>00060 }
<a name="l00061"></a>00061 }
<a name="l00062"></a>00062 <span class="keywordflow">else</span>
<a name="l00063"></a>00063 {
<a name="l00064"></a>00064 <span class="comment">/*set start to the base adress of the message queue of source process*/</span>
<a name="l00065"></a>00065 startQueue = (<a class="code" href="../../df/dd4/structmoc__message__envelope__struct.html" title="Message-envelope structure.">moc_message_envelope_t</a>*) <a class="code" href="../../df/ddf/group__internal__am.html#gf7dce8bc9c6659f94b3431225de2e595" title="Effective Base-Address of local queue responsible for node &amp;#39;rank&amp;#39;.">IMOC_LOCAL_QUEUE</a>(source);
<a name="l00066"></a>00066 <span class="comment">/*check if tag is ANY_TAG*/</span>
<a name="l00067"></a>00067 <span class="keywordflow">if</span>(tag == <a class="code" href="../../d1/d82/moc_8h.html#a6d9dac1d01f8d03aa144056921e04dd" title="Indicates, in a receive, to accept a message with any tag value.">MOC_ANY_TAG</a>)
<a name="l00068"></a>00068 {
<a name="l00069"></a>00069 <span class="keywordflow">for</span>(count=0;count&lt;<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>;count++)
<a name="l00070"></a>00070 {
<a name="l00071"></a>00071 <span class="comment">/*search for a valid entry from source*/</span>
<a name="l00072"></a>00072 <span class="keywordflow">if</span>(startQueue[count].flags.<a class="code" href="../../df/dd4/structmoc__message__envelope__struct.html#5538e79854840d3caf08b90b5409e16b" title="flag-struct">bits</a>.valid &amp;&amp; startQueue[count].<a class="code" href="../../df/dd4/structmoc__message__envelope__struct.html#84160292a4e38f9f72a2937e8a0205ad" title="Communicator of message.">communicator</a> == comm
<a name="l00073"></a>00073 &amp;&amp; startQueue[count].<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#5538e79854840d3caf08b90b5409e16b" title="flag-struct">bits</a>.special == isSpecial)
<a name="l00074"></a>00074 <span class="keywordflow">return</span> &amp;startQueue[count];
<a name="l00075"></a>00075 }
<a name="l00076"></a>00076 }
<a name="l00077"></a>00077 <span class="keywordflow">else</span>
<a name="l00078"></a>00078 {
<a name="l00079"></a>00079 <span class="keywordflow">for</span>(count=0;count&lt;<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>;count++)
<a name="l00080"></a>00080 {
<a name="l00081"></a>00081 <span class="comment">/*search for a valid entry from source with right tag*/</span>
<a name="l00082"></a>00082 <span class="keywordflow">if</span>(startQueue[count].flags.<a class="code" href="../../df/dd4/structmoc__message__envelope__struct.html#5538e79854840d3caf08b90b5409e16b" title="flag-struct">bits</a>.valid &amp;&amp; startQueue[count].<a class="code" href="../../df/dd4/structmoc__message__envelope__struct.html#75502fafc90d03a3b101e5c43c8c1727" title="Message-tag.">tag</a> == tag
<a name="l00083"></a>00083 &amp;&amp; startQueue[count].<a class="code" href="../../df/dd4/structmoc__message__envelope__struct.html#84160292a4e38f9f72a2937e8a0205ad" title="Communicator of message.">communicator</a> == comm
<a name="l00084"></a>00084 &amp;&amp; startQueue[count].<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#5538e79854840d3caf08b90b5409e16b" title="flag-struct">bits</a>.special == isSpecial)
<a name="l00085"></a>00085 <span class="keywordflow">return</span> &amp;startQueue[count];
<a name="l00086"></a>00086 }
<a name="l00087"></a>00087 }
<a name="l00088"></a>00088 }
<a name="l00089"></a>00089
<a name="l00090"></a>00090 <span class="keywordflow">return</span> NULL;
<a name="l00091"></a>00091 }
</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&nbsp;
<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>