[mpich2-dev] Fortran, MPI_SEND_INIT, and the Intel test suite

William Gropp wgropp at uiuc.edu
Mon Jun 9 13:59:56 CDT 2008


Hi David,

There's a discussion of this in the MPI-2 document.  Basically,  
Fortran doesn't recognize any sort of nonblocking operations; the  
persistent operations make this worse.  The recommended action, if I  
remember correctly, is to make a dummy call or reference to shortb to  
deal with this compiler optimization.  The Intel test should be  
changed to do this.  In this case, a call to a routine that does  
nothing but takes shortb as an argument is necessary after the shortb 
(1) assignment.  In later versions of Fortran, you might be able to  
use volatile.

Bill

On Jun 9, 2008, at 1:53 PM, David Gingold wrote:

> MPICH2 folks --
>
> I was chasing a problem in one of the Intel MPI tests, and stumbled  
> on the following issue.  I'm wondering whether it is something that  
> has come up before.
>
> The test in question (which is fortran/persist_request/functional/ 
> MPI_Send_init_overtake in the Intel test suite) does something like  
> this:
>
>       INTEGER NUMSHORT
>       PARAMETER (NUMSHORT=20)
>
>       INTEGER SHORTB(NUMSHORT)
> C
> C         Send a number of short messages
> C
>           CALL MPI_SEND_INIT(SHORTB(1), 1, MPI_INTEGER, 1, 1,
>      $         MPI_COMM_WORLD, REQUEST(2), IERR)
>
>           DO 200 I=1, NUMSHORT
>             CALL MPI_START(REQUEST(2), IERR)
>
>             CALL MPI_WAIT(REQUEST(2), STAT, IERR)
>
>             SHORTB(1) = SHORTB(1) + 1
>  200      CONTINUE
>
> With the optimizer turned on, our compiler optimizes away the  
> statement "SHORTB(1) = SHORTB(1) + 1".  That causes the test to fail.
>
> Our compiler team tells me that this is a legal optimization for a  
> Fortran compiler to make.  The code has no further references to  
> SHORTB in this branch, and because MPI_START and MPI_WAIT do not  
> reference SHORTB, the compiler is allowed to assume that the  
> statement would have no effect.
>
> If that's correct, then this is an invalid test.  But it also  
> suggests that the Fortran interface for persistent sends is ill- 
> defined in MPI.  The code above is the natural way to use  
> persistent sends, after all.  I think there could also be  
> corresponding trouble with persistent receives.
>
> -dg
>
> --
> David Gingold
> Principal Software Engineer
> SiCortex
> Three Clock Tower Place, Suite 210
> Maynard MA 01754
> (978) 897-0214 x224
>
>
>

William Gropp
Paul and Cynthia Saylor Professor of Computer Science
University of Illinois Urbana-Champaign



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.mcs.anl.gov/mailman/private/mpich2-dev/attachments/20080609/76485ed9/attachment.htm>


More information about the mpich2-dev mailing list