58.html
来自「国外MPI教材」· HTML 代码 · 共 43 行
HTML
43 行
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <style type="text/css"> body { font-family: Verdana, Arial, Helvetica, sans-serif;} a.at-term { font-style: italic; } </style> <title>Global Reduction</title> <meta name="Generator" content="ATutor"> <meta name="Keywords" content=""></head><body> <p>In addition to broadcasting data from one process to many, there are additional routines that allow you to scatter, or distribute, parts of an array to individual processors. Corresponding routines exist that allow you to collect, or gather, data from all of the processes into an array on the root process. The reduction operations are an extension to the gather routines. They allow you to gather the data and perform some
operation on it before it is stored on the root process.</p>
<p>Several examples of the reduction operations that are available are:</p>
<ul>
<li>Global sum or product</li>
<li>Global maximum or minimum</li>
<li>Global user-defined operation</li>
</ul>
<h3>General Form</h3>
<p class="codelang">C:</p>
<pre><code>int MPI_Reduce(void* sendbuf, void* recvbuf,int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm)</code></pre>
<p class="codelang">Fortran:</p>
<pre><code>CALL MPI_REDUCE(SENDBUF, RECVBUF, COUNT,DATATYPE, OP, ROOT, COMM, ERROR)
<type> SENDBUF(*), RECVBUF(*)</code></pre>
<ul>
<li><em>COUNT</em>: is the number of "ops" done on consecutive elements of sendbuf (it is also size of recvbuf)</li>
<li><em>OP</em>: is an associative operator that takes two operands of type datatype and returns a result of the same type</li>
</ul>
<img SRC="reduce1.gif" height="419" width="420"></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?