Initial commit.

This commit is contained in:
2017-10-26 19:57:24 +02:00
commit 9ce8b5485d
1090 changed files with 47036 additions and 0 deletions
@@ -0,0 +1,118 @@
<!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/internal/imoc_spe_thread_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&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/ppu/internal/imoc_spe_thread_ppu.c</h1><a href="../../df/dac/imoc__spe__thread__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 &lt;malloc_align.h&gt;</span>
<a name="l00002"></a>00002 <span class="preprocessor">#include &lt;free_align.h&gt;</span>
<a name="l00003"></a>00003 <span class="preprocessor">#include &lt;stdlib.h&gt;</span>
<a name="l00004"></a>00004 <span class="preprocessor">#include &lt;string.h&gt;</span>
<a name="l00005"></a>00005
<a name="l00006"></a>00006 <span class="preprocessor">#include &lt;<a class="code" href="../../db/dae/ppu_2moc_8h.html">moc.h</a>&gt;</span>
<a name="l00007"></a>00007 <span class="preprocessor">#include &lt;<a class="code" href="../../db/dae/ppu_2moc_8h.html">ppu/moc.h</a>&gt;</span>
<a name="l00008"></a>00008 <span class="preprocessor">#include &lt;<a class="code" href="../../d9/db3/imoc_8h.html">internal/imoc.h</a>&gt;</span>
<a name="l00009"></a>00009 <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="comment"></span>
<a name="l00011"></a>00011 <span class="comment">/**</span>
<a name="l00012"></a>00012 <span class="comment"> * \addtogroup internal_spu_thread</span>
<a name="l00013"></a>00013 <span class="comment"> **/</span><span class="comment"></span>
<a name="l00014"></a>00014 <span class="comment">//@{</span>
<a name="l00015"></a>00015 <span class="comment"></span><span class="comment"></span>
<a name="l00016"></a>00016 <span class="comment">/**</span>
<a name="l00017"></a>00017 <span class="comment"> * Holds the value of currently configured SPU-Threads.</span>
<a name="l00018"></a>00018 <span class="comment"> **/</span>
<a name="l00019"></a><a class="code" href="../../dc/df1/group__internal__spu__thread.html#g6cf68c0afe2da7b3a29ecaab8ed45961">00019</a> uint8_t <a class="code" href="../../dc/df1/group__internal__spu__thread.html#g6cf68c0afe2da7b3a29ecaab8ed45961" title="actual number of SPU-Threads.">moc_spu_thread_count</a> = 0;
<a name="l00020"></a>00020 <span class="comment"></span>
<a name="l00021"></a>00021 <span class="comment">/**</span>
<a name="l00022"></a>00022 <span class="comment"> * Holds the value of currently configured PPU-Threads.</span>
<a name="l00023"></a>00023 <span class="comment"> **/</span>
<a name="l00024"></a><a class="code" href="../../dc/df1/group__internal__spu__thread.html#gf4270da4dbf663fde50a876067ed0d52">00024</a> uint8_t <a class="code" href="../../dc/df1/group__internal__spu__thread.html#gf4270da4dbf663fde50a876067ed0d52" title="actual number of PPU-Threads.">moc_ppu_thread_count</a> = 0;
<a name="l00025"></a>00025 <span class="comment"></span>
<a name="l00026"></a>00026 <span class="comment">/**</span>
<a name="l00027"></a>00027 <span class="comment"> * Holds information about the SPU-Threads.</span>
<a name="l00028"></a>00028 <span class="comment"> *</span>
<a name="l00029"></a>00029 <span class="comment"> * order of indices is equal to order of ranks.</span>
<a name="l00030"></a>00030 <span class="comment"> **/</span>
<a name="l00031"></a><a class="code" href="../../dc/df1/group__internal__spu__thread.html#ga5b74732b1e31ec1674ea0e5ae465c4e">00031</a> <a class="code" href="../../d1/d8b/structmoc__spu__thread__struct.html" title="SPU-Thread structure.">moc_spu_thread_t</a> <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="../../db/dae/ppu_2moc_8h.html#a6aacc64a745d563ed72610e08ceb3ef" title="Maximum number of possible SPU-threads.">MOC_SPU_THREAD_MAX</a>];
<a name="l00032"></a>00032
<a name="l00033"></a><a class="code" href="../../dc/df1/group__internal__spu__thread.html#g8ad19e80234fb6b4d73684e47e007106">00033</a> uint32_t <a class="code" href="../../dc/df1/group__internal__spu__thread.html#g8ad19e80234fb6b4d73684e47e007106" title="init buffer size">moc_spu_buffer_size</a> = <a class="code" href="../../dd/df8/group__internal__core.html#g5a64c26720f2d3569ed03dd9d0547b5a" title="Default size of the buffers used for buffered communication.">MOC_BUFFER_SIZE</a>;
<a name="l00034"></a>00034
<a name="l00035"></a><a class="code" href="../../dc/df1/group__internal__spu__thread.html#g2af87be0fa5a8b93ac563c819047328a">00035</a> uint8_t <a class="code" href="../../dc/df1/group__internal__spu__thread.html#g2af87be0fa5a8b93ac563c819047328a" title="init message-queue size">moc_spu_queue_size</a> = <a class="code" href="../../dd/df8/group__internal__core.html#g081d07bc934f7112abc3c792b8941e0e" title="Default size of the message-queues.">MOC_QUEUE_SIZE</a>;
<a name="l00036"></a>00036
<a name="l00037"></a><a class="code" href="../../dc/df1/group__internal__spu__thread.html#g669046500ec44affc79468b12ddaaf92">00037</a> <span class="keywordtype">void</span>* <a class="code" href="../../dc/df1/group__internal__spu__thread.html#g669046500ec44affc79468b12ddaaf92" title="PThread-function for creating SPU-Threads.">moc_spe_pthread_func</a>(<span class="keywordtype">void</span> *arg)
<a name="l00038"></a>00038 {
<a name="l00039"></a>00039 <a class="code" href="../../d1/d8b/structmoc__spu__thread__struct.html" title="SPU-Thread structure.">moc_spu_thread_t</a>* handle = (<a class="code" href="../../d1/d8b/structmoc__spu__thread__struct.html" title="SPU-Thread structure.">moc_spu_thread_t</a>*) arg;
<a name="l00040"></a>00040 <span class="comment">/* run the SPE context */</span>
<a name="l00041"></a>00041 <span class="keywordflow">if</span> (spe_cpu_info_get(SPE_COUNT_USABLE_SPES, -1) != 0)
<a name="l00042"></a>00042 {
<a name="l00043"></a>00043 <span class="keywordflow">if</span> (spe_context_run(handle-&gt;<a class="code" href="../../d1/d8b/structmoc__spu__thread__struct.html#61d6807e3bab9b37ef07b0543e33574e" title="SPE-Context.">speid</a>, &amp;handle-&gt;<a class="code" href="../../d1/d8b/structmoc__spu__thread__struct.html#4d3f668b79c172907febb25dbe2813ea" title="Spe-entry-address.">spe_entry_adress</a>, 0,
<a name="l00044"></a>00044 handle-&gt;<a class="code" href="../../d1/d8b/structmoc__spu__thread__struct.html#a7f667cf56fc5e3cd906caa8aab765cc" title="effective address of user-defined information in main-memory">argp</a>, handle-&gt;<a class="code" href="../../d1/d8b/structmoc__spu__thread__struct.html#603a62c8b05bb561c467e34acbcff2b5" title="Pointer to environment information.">envp</a>, &amp;handle-&gt;<a class="code" href="../../d1/d8b/structmoc__spu__thread__struct.html#ef9a368d969bbfc92bee4076b1576b34" title="Error-Information.">stop_info</a>) &lt; 0)
<a name="l00045"></a>00045 {
<a name="l00046"></a>00046 fprintf(
<a name="l00047"></a>00047 stderr,
<a name="l00048"></a>00048 <span class="stringliteral">"FAILED Thread %u: spe_context_run(errno=%d strerror=%s)\n"</span>,
<a name="l00049"></a>00049 handle-&gt;<a class="code" href="../../d1/d8b/structmoc__spu__thread__struct.html#610f1390167566df9b451401c0bb8667" title="rank of SPU-thread">rank</a>, errno, strerror(errno));
<a name="l00050"></a>00050 pthread_exit(NULL);
<a name="l00051"></a>00051 }
<a name="l00052"></a>00052 }
<a name="l00053"></a>00053 <span class="keywordflow">else</span>
<a name="l00054"></a>00054 {
<a name="l00055"></a>00055 fprintf(stderr, <span class="stringliteral">"ERROR Thread %u: No usable SPE\n"</span>, handle-&gt;<a class="code" href="../../d1/d8b/structmoc__spu__thread__struct.html#610f1390167566df9b451401c0bb8667" title="rank of SPU-thread">rank</a>);
<a name="l00056"></a>00056 }
<a name="l00057"></a>00057 <span class="comment">/* destroy the SPE context */</span>
<a name="l00058"></a>00058 <span class="keywordflow">if</span> (spe_context_destroy(handle-&gt;<a class="code" href="../../d1/d8b/structmoc__spu__thread__struct.html#61d6807e3bab9b37ef07b0543e33574e" title="SPE-Context.">speid</a>) != 0)
<a name="l00059"></a>00059 {
<a name="l00060"></a>00060 fprintf(
<a name="l00061"></a>00061 stderr,
<a name="l00062"></a>00062 <span class="stringliteral">"FAILED Thread %u: spe_context_destroy(errno=%d strerror=%s)\n"</span>,
<a name="l00063"></a>00063 handle-&gt;<a class="code" href="../../d1/d8b/structmoc__spu__thread__struct.html#610f1390167566df9b451401c0bb8667" title="rank of SPU-thread">rank</a>, errno, strerror(errno));
<a name="l00064"></a>00064 pthread_exit(NULL);
<a name="l00065"></a>00065 }
<a name="l00066"></a>00066 <span class="comment">/* check the SPE status */</span>
<a name="l00067"></a>00067 <span class="keywordflow">if</span> (handle-&gt;<a class="code" href="../../d1/d8b/structmoc__spu__thread__struct.html#ef9a368d969bbfc92bee4076b1576b34" title="Error-Information.">stop_info</a>.stop_reason == SPE_EXIT)
<a name="l00068"></a>00068 {
<a name="l00069"></a>00069 <span class="keywordflow">if</span> (handle-&gt;<a class="code" href="../../d1/d8b/structmoc__spu__thread__struct.html#ef9a368d969bbfc92bee4076b1576b34" title="Error-Information.">stop_info</a>.result.spe_exit_code != 0)
<a name="l00070"></a>00070 {
<a name="l00071"></a>00071 fprintf(
<a name="l00072"></a>00072 stderr,
<a name="l00073"></a>00073 <span class="stringliteral">"FAILED Thread %u: SPE returned a non-zero exit status (%i)\n"</span>,
<a name="l00074"></a>00074 handle-&gt;<a class="code" href="../../d1/d8b/structmoc__spu__thread__struct.html#610f1390167566df9b451401c0bb8667" title="rank of SPU-thread">rank</a>, handle-&gt;<a class="code" href="../../d1/d8b/structmoc__spu__thread__struct.html#ef9a368d969bbfc92bee4076b1576b34" title="Error-Information.">stop_info</a>.result.spe_exit_code);
<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 <span class="keywordflow">if</span> (handle-&gt;<a class="code" href="../../d1/d8b/structmoc__spu__thread__struct.html#ef9a368d969bbfc92bee4076b1576b34" title="Error-Information.">stop_info</a>.stop_reason == SPE_STOP_AND_SIGNAL)
<a name="l00079"></a>00079 {
<a name="l00080"></a>00080 fprintf(
<a name="l00081"></a>00081 stderr,
<a name="l00082"></a>00082 <span class="stringliteral">" FAILED Thread %u: SPE Stop and Signal (Signalcode: %i)\n"</span>,
<a name="l00083"></a>00083 handle-&gt;<a class="code" href="../../d1/d8b/structmoc__spu__thread__struct.html#610f1390167566df9b451401c0bb8667" title="rank of SPU-thread">rank</a>, handle-&gt;<a class="code" href="../../d1/d8b/structmoc__spu__thread__struct.html#ef9a368d969bbfc92bee4076b1576b34" title="Error-Information.">stop_info</a>.result.spe_signal_code);
<a name="l00084"></a>00084 }
<a name="l00085"></a>00085 <span class="keywordflow">else</span>
<a name="l00086"></a>00086 {
<a name="l00087"></a>00087 fprintf(
<a name="l00088"></a>00088 stderr,
<a name="l00089"></a>00089 <span class="stringliteral">" FAILED Thread %u: SPE abnormally terminated (Reason: %i)\n"</span>,
<a name="l00090"></a>00090 handle-&gt;<a class="code" href="../../d1/d8b/structmoc__spu__thread__struct.html#610f1390167566df9b451401c0bb8667" title="rank of SPU-thread">rank</a>, handle-&gt;<a class="code" href="../../d1/d8b/structmoc__spu__thread__struct.html#ef9a368d969bbfc92bee4076b1576b34" title="Error-Information.">stop_info</a>.stop_reason);
<a name="l00091"></a>00091 }
<a name="l00092"></a>00092 pthread_exit(NULL);
<a name="l00093"></a>00093 }<span class="comment"></span>
<a name="l00094"></a>00094 <span class="comment">//@}</span>
<a name="l00095"></a>00095 <span class="comment"></span>
<a name="l00096"></a>00096
</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>