<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Received data has zeros... in Intel® MPI Library</title>
    <link>https://community.intel.com/t5/Intel-MPI-Library/Received-data-has-zeros/m-p/1075553#M4757</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I have a few mega bytes of data and fixed size buffer (4MB).&lt;/P&gt;

&lt;P&gt;So the sender thread iterates sending (MPI_Send) a fixed sized data at a time until it sends all the data.&lt;BR /&gt;
	The receiver knows how many bytes it will receive before beginning and iterates (MPI_Recv) using the same fixed sized buffer (4MB)&lt;/P&gt;

&lt;P&gt;Sometimes the receiver receives data with all zeros only when it receives the last remaining data (possibly smaller than 4MB)&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;&amp;nbsp;- I checked that the sender sends the correct data. ('CheckContents' on the below code)&lt;BR /&gt;
	&amp;nbsp;- I checked that the receiver received the correct amount of bytes.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Sender(int bytes_to_send) {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp;char* buffer = new char[4MB];&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp;while (;) {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; memcpy_from_some_other_buffer_into (buffer);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; CheckContents(buffer);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; MPI_Send(buffer, 4MB or remaining bytes);&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;CheckContents(buffer);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp;delete [] buffer;&lt;BR /&gt;
	&lt;SPAN style="font-size: 1em;"&gt;}&lt;BR /&gt;
	&lt;BR /&gt;
	Receiver has the exactly same loop form except for the fact that it uses 'MPI_Recv'.&lt;BR /&gt;
	&lt;BR /&gt;
	- 1. Is it possible that MPI_Send() still has the reference to the 'buffer' that I delete right after the last call?&lt;BR /&gt;
	- 2. Is there any method that I can use to debug this problem?&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;SPAN class="s1" style="font-size: 1em;"&gt;Can the following flags affect the program's correctness?&lt;/SPAN&gt;&lt;BR /&gt;
	&lt;SPAN class="s2" style="font-size: 1em;"&gt;I_MPI_FABRICS&lt;/SPAN&gt;&lt;BR /&gt;
	&lt;SPAN class="s2" style="font-size: 1em;"&gt;I_MPI_FALLBACK&lt;/SPAN&gt;&lt;BR /&gt;
	&lt;SPAN class="s2" style="font-size: 1em;"&gt;MPICH_ASYNC_PROGRESS&lt;/SPAN&gt;&lt;BR /&gt;
	&lt;SPAN class="s2" style="font-size: 1em;"&gt;I_MPI_PIN&lt;/SPAN&gt;&lt;BR /&gt;
	&lt;SPAN style="font-size: 1em;"&gt;I_MPI_DYNAMIC_CONNECTION&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 04 Nov 2016 15:46:20 GMT</pubDate>
    <dc:creator>seongyun_k_</dc:creator>
    <dc:date>2016-11-04T15:46:20Z</dc:date>
    <item>
      <title>Received data has zeros...</title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/Received-data-has-zeros/m-p/1075553#M4757</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I have a few mega bytes of data and fixed size buffer (4MB).&lt;/P&gt;

&lt;P&gt;So the sender thread iterates sending (MPI_Send) a fixed sized data at a time until it sends all the data.&lt;BR /&gt;
	The receiver knows how many bytes it will receive before beginning and iterates (MPI_Recv) using the same fixed sized buffer (4MB)&lt;/P&gt;

&lt;P&gt;Sometimes the receiver receives data with all zeros only when it receives the last remaining data (possibly smaller than 4MB)&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;&amp;nbsp;- I checked that the sender sends the correct data. ('CheckContents' on the below code)&lt;BR /&gt;
	&amp;nbsp;- I checked that the receiver received the correct amount of bytes.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Sender(int bytes_to_send) {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp;char* buffer = new char[4MB];&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp;while (;) {&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; memcpy_from_some_other_buffer_into (buffer);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; CheckContents(buffer);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp; &amp;nbsp; MPI_Send(buffer, 4MB or remaining bytes);&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;CheckContents(buffer);&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;
	&amp;nbsp; &amp;nbsp;delete [] buffer;&lt;BR /&gt;
	&lt;SPAN style="font-size: 1em;"&gt;}&lt;BR /&gt;
	&lt;BR /&gt;
	Receiver has the exactly same loop form except for the fact that it uses 'MPI_Recv'.&lt;BR /&gt;
	&lt;BR /&gt;
	- 1. Is it possible that MPI_Send() still has the reference to the 'buffer' that I delete right after the last call?&lt;BR /&gt;
	- 2. Is there any method that I can use to debug this problem?&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;SPAN class="s1" style="font-size: 1em;"&gt;Can the following flags affect the program's correctness?&lt;/SPAN&gt;&lt;BR /&gt;
	&lt;SPAN class="s2" style="font-size: 1em;"&gt;I_MPI_FABRICS&lt;/SPAN&gt;&lt;BR /&gt;
	&lt;SPAN class="s2" style="font-size: 1em;"&gt;I_MPI_FALLBACK&lt;/SPAN&gt;&lt;BR /&gt;
	&lt;SPAN class="s2" style="font-size: 1em;"&gt;MPICH_ASYNC_PROGRESS&lt;/SPAN&gt;&lt;BR /&gt;
	&lt;SPAN class="s2" style="font-size: 1em;"&gt;I_MPI_PIN&lt;/SPAN&gt;&lt;BR /&gt;
	&lt;SPAN style="font-size: 1em;"&gt;I_MPI_DYNAMIC_CONNECTION&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2016 15:46:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/Received-data-has-zeros/m-p/1075553#M4757</guid>
      <dc:creator>seongyun_k_</dc:creator>
      <dc:date>2016-11-04T15:46:20Z</dc:date>
    </item>
    <item>
      <title>Hello,</title>
      <link>https://community.intel.com/t5/Intel-MPI-Library/Received-data-has-zeros/m-p/1075554#M4758</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;1. Is it possible that MPI_Send() still has the reference to the 'buffer' that I delete right after the last call?&lt;/P&gt;

&lt;P&gt;No, the blocking send operation MPI_Send() might be treated in a similar way like non-blocking MPI_ISend() - but in this particular case (the so called Eager protocol), the MPI library will create a copy of the send buffer before returning control back to the user.&lt;/P&gt;

&lt;P&gt;2. Is there any method that I can use to debug this problem?&lt;/P&gt;

&lt;P&gt;Yes, in cases where your code violates the MPI standard or where the data transmission gets corrupted, the Intel® Trace Analyzer and Collector provides some correctness checking functionality. Please see the related reference manual for further information: &lt;A href="https://software.intel.com/en-us/node/561293" target="_blank"&gt;https://software.intel.com/en-us/node/561293&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Can the following flags affect the program's correctness?&lt;/P&gt;

&lt;P&gt;No.&lt;/P&gt;

&lt;P&gt;Best regards,&lt;/P&gt;

&lt;P&gt;Michael&lt;/P&gt;</description>
      <pubDate>Thu, 10 Nov 2016 14:11:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-MPI-Library/Received-data-has-zeros/m-p/1075554#M4758</guid>
      <dc:creator>Michael_Intel</dc:creator>
      <dc:date>2016-11-10T14:11:20Z</dc:date>
    </item>
  </channel>
</rss>

