📄 53.html
字号:
<!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>Wildcarding</title> <meta name="Generator" content="ATutor"> <meta name="Keywords" content=""></head><body> <p>There are situations when the process from which a message comes is not of concern. An example would be an integration, where each process computes part of an integral.; The process that will collect and sum the individual parts knows that it will receive one value from each process, and neither the order in which they are received nor from which process is important to the calculation. Therefore, a wildcard feature is available for MPI_RECV that allows you to receive the next incoming
message, regardless of which process it came from or its tag value.</p>
<p>The receiver can wildcard on the source and tag fields:</p>
<ul>
<li>To receive from any source<br/>
<pre><code>MPI_Any_source</code></pre>
</li>
<li>
To receive with any tag<br />
<pre><code>MPI_Any_tag</pre></code>
</li>
</ul>
<p>The actual source and tag of the message received is returned in the receiver's status parameter.</p>
<h3>Received Message Count</h3>
<p>One subtle difference between the count argument in the send process and the count argument in the receive process is that the former is the actual number of elements to send. In the receive process, the count argument is the maximum number of elements that can be received. The receive buffer can be the same size or larger than the send buffer.</p>
<p>Once the message has been received, the number of elements actually received can be queried with a function call. MPI_GET_COUNT takes the status array and the MPI datatype of the received data as arguments and returns the number of elements that were actually received.</p>
<p class="codelang">C:</p>
<pre><code>int MPI_Get_count (MPI_Status *status, MPI_Datatype
datatype, int *count)</code></pre>
<p class="codelang">
Fortran:</p>
<pre><code> CALL MPI_GET_COUNT(STATUS, DATATYPE, COUNT, IERROR)
INTEGER STATUS(MPI_STATUS_SIZE), DATATYPE
INTEGER COUNT, IERROR</code></pre>
<p>If the source process is wildcarded, it can be retrieved from the variable STATUS(MPI_SOURCE) and the tag of the received message can be retrieved from STATUS(MPI_TAG).</p>
<p>Information from a wildcarded receive is returned from MPI_RECV in the STATUS handle. A summary of where message information can be obtained is given in the table below.</p>
<table class="info">
<tr>
<th>Information</th>
<th>C</th>
<th>Fortran</th>
</tr>
<tr>
<td>source</td>
<td>status.MPI_SOURCE</td>
<td>status(MPI_SOURCE)</td>
</tr>
<tr>
<td>tag</td>
<td>status.MPI_TAG</td>
<td>status(MPI_TAG)</td>
</tr>
<tr>
<td>count</td>
<td>MPI_Get_count;</td>
<td>MPI_GET_COUNT</td>
</tr>
</table>
<!--<img SRC="wildcard1.gif" height=190 width=698>--></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -