<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
The extent can be thought of as a stride, and only describes how successive copies of a datatype are laid out in memory.  In terms of what data is moved, in MPI, only the data elements are sent, so, roughly speaking, count*MPI_Type_size(datatype) is sent (however, an MPI implementation is permitted to use lossless compression, for example, and there have been examples that do that).  When the datatype is not contiguous, it tells the send how to gather the data to send and the receive how to scatter the data.  So your understanding is correct.<div><br class="webkit-block-placeholder"></div><div>Bill</div><div><br><div><div>On Dec 11, 2007, at 12:52 AM, Ruini Xue wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">hello,<br><br>I am a little confused by the <b>extent</b> and <b>size</b> of derived datatypes. In my opinion, `<b>extent</b>' includes the additional `padding spaces' introduced by non-continuous displacements of blocks in the datatype, while <b>`size'</b> only counts the `useful' bytes which do not include the padding spaces. Generally, the `<b>extent</b>' of a datatype is not smaller then its `<b>size</b>'. As far as I know, some blocks in derived datatypes have negative displacements, thus their ` <b>extents</b>' might be smaller than their `<b>sizes</b>'.<br><br>So the questions are "<i><b>how many bytes does MPI_Send() really send out if the datatype has a bigger extent than its size?</b></i>" and " <i><b>how does the corresponding  MPI_Recv() place the received data?</b></i>" I goes through the MPICH2 code, and got a blur big picture. It seems that MPI_Send() sends the datetype in compacted format, in other word, only <b>MPI_Type_size(datatype) * count</b> bytes are sent, but not <b>MPI_Type_extent(datatype) * count. </b>Accordingly, MPI_Recv() only receives <b>MPI_Type_size(datatype) * count</b> bytes from the sender, and these bytes are unpacked to the receive buffer according to the definition of the datatype. In other words, padding spaces are inserted in the receive buffer if necessary while unpacking the received data. This optimization is reasonable: to reduce the amount of transfer data, while holding the semantics of derived types. <br><br>To conclude, only useful bytes are transfered, while both the send and receive buff should be big enough to hold the 'whole datatype'.<br><br>Is my understanding right? Please let me know any mistake I made. <br><br>Thanks in advance!<br><br>Best<br><br>Andrew<br></blockquote></div><br><div> <span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div>William Gropp</div><div>Paul and Cynthia Saylor Professor of Computer Science</div><div>University of Illinois Urbana-Champaign</div><br class="Apple-interchange-newline"></span></span></span></span> </div><br></div></body></html>