<div dir="ltr"><div>p626 of MPI-3.0 gives such an example</div><div> </div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">REAL s(100), r(100)<br>CALL MPI_Isend(s(1:100:5), 3, MPI_REAL, ..., rq, ierror)<p class="">
All nonblocking MPI functions behave as if the user-specified elements of choice buffers are copied to a contiguous scratch buffer in the MPI runtime environment. All datatype descriptions (in the example above, “3, MPI_REAL”) read and store data from and to this virtual contiguous scratch buffer ...</p>
</blockquote><p class="">Here,  data type of s(100) match with MPI_REAL, so everything is fine.  But I want to know if MPI permits mismatched types, for example, can s(100) be an integer array?  If the answer is no, then compilers can not detect this error ; if yes, then it is hard to implement that. To avoid memory copying to a scratch buffer, I want to use MPI datatypes. But if I have two types, one is given by the choice buffer itself, the other is given by the MPI_Datatype argument,  how could I do that?</p>
<p class="">Any thoughts?</p><p class="">Thanks</p><p class="">--Junchao Zhang</p>
</div>