Files
2017-10-26 19:57:24 +02:00

65 lines
6.6 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/communication/moc_bcast.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/communication/moc_bcast.c</h1><a href="../../d6/db1/moc__bcast_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;<a class="code" href="../../d0/d3a/spu_2moc_8h.html">moc.h</a>&gt;</span>
<a name="l00002"></a>00002
<a name="l00003"></a>00003 <span class="preprocessor">#ifdef __SPU__</span>
<a name="l00004"></a>00004 <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="l00005"></a>00005 <span class="preprocessor">#else</span>
<a name="l00006"></a>00006 <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="l00007"></a>00007 <span class="preprocessor">#endif</span>
<a name="l00008"></a>00008 <span class="preprocessor"></span>
<a name="l00009"></a><a class="code" href="../../db/dc2/group__broadcast.html#gfd25e9a19a1ad4032fdf3703531167d6">00009</a> <span class="keywordtype">int</span> <a class="code" href="../../db/dc2/group__broadcast.html#gfd25e9a19a1ad4032fdf3703531167d6" title="Broadcasts a message from the process with rank &amp;quot;root&amp;quot; to all other processes...">MOC_Bcast</a>(<span class="keywordtype">void</span>* buffer, <span class="keywordtype">int</span> count, <a class="code" href="../../dc/d6e/group__p2p__datatype.html#gb4e45f15c08578bd3fc97c0cca2a509a" title="Typedef defining MOC_Datatype.">MOC_Datatype</a> datatype, <span class="keywordtype">int</span> root,
<a name="l00010"></a>00010 <a class="code" href="../../d1/dd1/group__comm__mgt.html#g3d2b8a9af65bff5f79d02bda13616767" title="Communicator-Handle.">MOC_Comm</a> comm)
<a name="l00011"></a>00011 {
<a name="l00012"></a>00012 <a class="code" href="../../dd/d7a/structMOC__Status__struct.html" title="Structure holding information about a received message.">MOC_Status</a> status;
<a name="l00013"></a>00013
<a name="l00014"></a>00014 <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="l00015"></a>00015 <span class="keywordflow">return</span> 0;<span class="comment"></span>
<a name="l00016"></a>00016 <span class="comment"> /** Sending branch **/</span>
<a name="l00017"></a>00017 <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#9005ee3d6d0ee8b2f15628dcca724710" title="rank of node">rank</a> == root)
<a name="l00018"></a>00018 {
<a name="l00019"></a>00019 <span class="keywordtype">int</span> t, err;
<a name="l00020"></a>00020 <span class="keyword">struct </span><a class="code" href="../../db/d17/structmoc__request__struct.html" title="Communication-Request (Handle).">moc_request_struct</a> requests[node_handle.comm_size];
<a name="l00021"></a>00021
<a name="l00022"></a>00022 <span class="keywordflow">for</span> (t = 0; t &lt; node_handle.comm_size; t++)
<a name="l00023"></a>00023 {
<a name="l00024"></a>00024 <span class="keywordflow">if</span> ((err = <a class="code" href="../../d7/d62/group__p2p__imm.html#gd88773e68570adfad9f99159c69502af" title="Performs a non-blocking standard mode send operation.">MOC_ISend</a>(buffer, count, datatype, t, <a class="code" href="../../d1/d82/moc_8h.html#e6a1c4a011b34474cc1b4b3e67367f5f" title="Reserved Tag for Broadcast-Messages (MOC_Bcast).">MOC_BCAST_TAG</a>,
<a name="l00025"></a>00025 comm, &amp;requests[t])) != 0)
<a name="l00026"></a>00026 <span class="keywordflow">return</span> err;
<a name="l00027"></a>00027 }
<a name="l00028"></a>00028 <span class="keywordflow">for</span> (t = 0; t &lt; node_handle.comm_size; t++)
<a name="l00029"></a>00029 {
<a name="l00030"></a>00030 <span class="keywordflow">if</span> ((err = <a class="code" href="../../d7/d62/group__p2p__imm.html#g68043e4a0893fdc25c67f87bae1015a6" title="Wait till a non-blocking communication has been completed.">MOC_Wait</a>(&amp;requests[t], &amp;status)) != 0)
<a name="l00031"></a>00031 <span class="keywordflow">return</span> err;
<a name="l00032"></a>00032 }
<a name="l00033"></a>00033 <span class="keywordflow">return</span> 0;
<a name="l00034"></a>00034 }<span class="comment"></span>
<a name="l00035"></a>00035 <span class="comment"> /** Receiving Branch **/</span>
<a name="l00036"></a>00036 <span class="keywordflow">else</span>
<a name="l00037"></a>00037 {
<a name="l00038"></a>00038 <span class="keywordflow">return</span> <a class="code" href="../../d0/d64/group__p2p__main.html#g30c532510cffd36acd1b9b0b3edb3832" title="Performs a blocking standard mode receive operation.">MOC_Recv</a>(buffer, count, datatype, root, <a class="code" href="../../d1/d82/moc_8h.html#e6a1c4a011b34474cc1b4b3e67367f5f" title="Reserved Tag for Broadcast-Messages (MOC_Bcast).">MOC_BCAST_TAG</a>, comm,
<a name="l00039"></a>00039 &amp;status);
<a name="l00040"></a>00040 }
<a name="l00041"></a>00041 }
<a name="l00042"></a>00042
</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>