<span id="the-mpi-module"></span><h1>the mpi module<a class="headerlink" href="#module-pNbody.mpi" title="Permalink to this headline">¶</a></h1>
<dl class="function">
<dt id="pNbody.mpi.mpi_AllgatherAndConcatArray">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_AllgatherAndConcatArray</tt><big>(</big><em>vec</em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_AllgatherAndConcatArray" title="Permalink to this definition">¶</a></dt>
<dd><p>AllGather array vec and concatenate it in a unique array
(concatenation order is reversed).</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_ExchangeFromTable">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_ExchangeFromTable</tt><big>(</big><em>T</em>, <em>procs</em>, <em>ids</em>, <em>vec</em>, <em>num</em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_ExchangeFromTable" title="Permalink to this definition">¶</a></dt>
<dd><p>Exchange an array according to a transfer array T</p>
<p>T : exchange table</p>
<p>procs : list of processor (from Tree.GetExchanges())
ids : list of id (from Tree.GetExchanges())</p>
<p>vec : vector to exchange
num : id correspondings to particles</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_GatherAndWriteArray">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_GatherAndWriteArray</tt><big>(</big><em>f</em>, <em>data</em>, <em>byteorder='little'</em>, <em>npart=None</em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_GatherAndWriteArray" title="Permalink to this definition">¶</a></dt>
<dd><p>Gather and array and write it in a binary block.</p>
<p>data = array</p>
<p>shape = tuple</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_GetExchangeTable">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_GetExchangeTable</tt><big>(</big><em>n_i</em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_GetExchangeTable" title="Permalink to this definition">¶</a></dt>
<dd><p>This function returns the exchange table</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_OldGatherAndWriteArray">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_OldGatherAndWriteArray</tt><big>(</big><em>f</em>, <em>data</em>, <em>byteorder='little'</em>, <em>nlocal=None</em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_OldGatherAndWriteArray" title="Permalink to this definition">¶</a></dt>
<dd><p>Gather and array and write it in a binary block.</p>
<p>data = array</p>
<p>shape = tuple</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_OldReadAndSendArray">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_OldReadAndSendArray</tt><big>(</big><em>f</em>, <em>data_type</em>, <em>shape=None</em>, <em>skip=None</em>, <em>byteorder='little'</em>, <em>nlocal=None</em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_OldReadAndSendArray" title="Permalink to this definition">¶</a></dt>
<dd><p>Read and Brodcast a binary block assuming it contains an array.
The array is splitted acroding to the variable nlocal.</p>
<p>data_type = array type
shape = tuple</p>
<dl class="docutils">
<dt>nlocal <span class="classifier-delimiter">:</span> <span class="classifier">array NTask x Npart </span></dt>
<dd>array NTask</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_ReadAndSendArray">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_ReadAndSendArray</tt><big>(</big><em>f</em>, <em>data_type</em>, <em>shape=None</em>, <em>byteorder='little'</em>, <em>npart=None</em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_ReadAndSendArray" title="Permalink to this definition">¶</a></dt>
<dd><p>Read and Brodcast a binary block assuming it contains an array.</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_ReadAndSendBlock">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_ReadAndSendBlock</tt><big>(</big><em>f</em>, <em>data_type</em>, <em>shape=None</em>, <em>byteorder='little'</em>, <em>split=None</em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_ReadAndSendBlock" title="Permalink to this definition">¶</a></dt>
<dd><p>Read and brodcast a binary block.</p>
<p>data_type = int,float32,float
or
data_type = array</p>
<p>shape = tuple</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_allgather">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_allgather</tt><big>(</big><em>x</em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_allgather" title="Permalink to this definition">¶</a></dt>
<dd><p>Gather x from all to all.
Returns a list.</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_allreduce">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_allreduce</tt><big>(</big><em>x</em>, <em>op=<mpi4py.MPI.Op object at 0x374b960></em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_allreduce" title="Permalink to this definition">¶</a></dt>
<dd><p>Reduce x from all node for all nodes.
When there is only one is defined, the function return x.</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_arange">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_arange</tt><big>(</big><em>n</em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_arange" title="Permalink to this definition">¶</a></dt>
<dd><p>Create an integer array containing elements from 0 to n
spreaded over all nodes.</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_argmax">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_argmax</tt><big>(</big><em>x</em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_argmax" title="Permalink to this definition">¶</a></dt>
<dd><p>Find the arument of the amximum value in x.</p>
<p>idx = (p,i) : where i = index in proc p</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_argmin">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_argmin</tt><big>(</big><em>x</em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_argmin" title="Permalink to this definition">¶</a></dt>
<dd><p>Find the arument of the maximum value in x.
idx = (p,i) : where i = index in proc p</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_bcast">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_bcast</tt><big>(</big><em>x</em>, <em>root=0</em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_bcast" title="Permalink to this definition">¶</a></dt>
<dd><p>Broadcast from node root the variable x.
When there is only one is defined, it simplay returns x.</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_find_a_toTask">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_find_a_toTask</tt><big>(</big><em>begTask</em>, <em>fromTask</em>, <em>ex_table</em>, <em>delta_n</em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_find_a_toTask" title="Permalink to this definition">¶</a></dt>
<dd><p>This function is used to find recursively an exange table</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_gather">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_gather</tt><big>(</big><em>x</em>, <em>root=0</em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_gather" title="Permalink to this definition">¶</a></dt>
<dd><p>Gather x from all nodes to node dest.
Returns a list.</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_getval">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_getval</tt><big>(</big><em>x</em>, <em>idx</em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_getval" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the value of array x corresponding to the index idx.</p>
<p>idx = (p,i) : where i = index in proc p
equivalent to x[i] from proc p</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_histogram">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_histogram</tt><big>(</big><em>x</em>, <em>bins</em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_histogram" title="Permalink to this definition">¶</a></dt>
<dd><p>Return an histogram of vector x binned using binx.</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_iprint">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_iprint</tt><big>(</big><em>msg</em>, <em>mode=None</em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_iprint" title="Permalink to this definition">¶</a></dt>
<dd><p>Synchronized print, including info on node.</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_len">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_len</tt><big>(</big><em>x</em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_len" title="Permalink to this definition">¶</a></dt>
<dd><p>Lenght of array x.</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_max">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_max</tt><big>(</big><em>x</em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_max" title="Permalink to this definition">¶</a></dt>
<dd><p>Maximum element of array x.</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_mean">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_mean</tt><big>(</big><em>x</em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_mean" title="Permalink to this definition">¶</a></dt>
<dd><p>Mean of elements of array x.</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_min">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_min</tt><big>(</big><em>x</em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_min" title="Permalink to this definition">¶</a></dt>
<dd><p>Minimum element of array x.</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_pprint">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_pprint</tt><big>(</big><em>msg</em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_pprint" title="Permalink to this definition">¶</a></dt>
<dd><p>Synchronized print.</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_recv">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_recv</tt><big>(</big><em>source</em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_recv" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a variable sent by node ar{source}.
When there is only one is defined, it does nothing.</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_reduce">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_reduce</tt><big>(</big><em>x</em>, <em>root=0</em>, <em>op=<mpi4py.MPI.Op object at 0x374b960></em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_reduce" title="Permalink to this definition">¶</a></dt>
<dd><p>Reduce x from all node only for root.
When there is only one is defined, the function return x.</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_rprint">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_rprint</tt><big>(</big><em>msg</em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_rprint" title="Permalink to this definition">¶</a></dt>
<dd><p>Rooted print.</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_sarange">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_sarange</tt><big>(</big><em>npart_all</em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_sarange" title="Permalink to this definition">¶</a></dt>
<dd><p>Create an integer array containing elements from 0 to n,
spreaded over all nodes. The repartition of elements and
type of elements over nodes is given by the array npart_all</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_send">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_send</tt><big>(</big><em>x</em>, <em>dest</em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_send" title="Permalink to this definition">¶</a></dt>
<dd><p>Send x to node dest.
When there is only one is defined, it does nothing.</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_sendrecv">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_sendrecv</tt><big>(</big><em>x</em>, <em>dest</em>, <em>source</em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_sendrecv" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pNbody.mpi.mpi_sum">
<tt class="descclassname">pNbody.mpi.</tt><tt class="descname">mpi_sum</tt><big>(</big><em>x</em><big>)</big><a class="headerlink" href="#pNbody.mpi.mpi_sum" title="Permalink to this definition">¶</a></dt>