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>