Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] Prototypes for Fortran MPI_ commands using 64-bit indexing
From: George Bosilca (bosilca_at_[hidden])
Date: 2013-11-13 18:23:09


On Nov 13, 2013, at 22:41 , George Bosilca <bosilca_at_[hidden]> wrote:

>
> On Nov 13, 2013, at 21:05 , Jeff Squyres (jsquyres) <jsquyres_at_[hidden]> wrote:
>
>> On Nov 12, 2013, at 4:25 PM, George Bosilca <bosilca_at_[hidden]> wrote:
>>
>>>> However, the key here is that MPI_STATUS_SIZE is set to be the size of a ***C*** MPI_Status (but expressed in units of Fortran INTEGER size -- so in the sizeof(int)==sizeof(INTEGER)==4 case, MPI_STATUS_SIZE is 6. But in the sizeof(int)==4, sizeof(INTEGER)==8 case, MPI_STATUS_SIZE is 3.
>>>>
>>>> That being said, we *could* change this so that MPI_STATUS_SIZE is always 6, and have the C<—>Fortran status routines just do the Right Thing depending on the size/type of ompi_fortran_integer_t.
>>>
>>> Indeed. We can have an Fortran MPI_Status (only in the Fortran interface) that will be 3 ompi_fortran_integer_t, and alter the translation macros to do the right thing (translate from C int to the chosen Fortran int).
>>
>>
>> I'm not sure I understand what you're proposing: what you say sounds like what we do today:
>>
>> - in the sizeof(int)==sizeof(INTEGER)==4 case, everything is the same size, and nothing special needs to be done
>
> Yes for this part.
>
>> - in the sizeof(int)==4, sizeof(INTEGER)==8 case, the Fortran status size is 3, but the C<->Fortran stuff still basically does a memcpy from the C MPI_Status to the Fortran array (meaning: the C int’s are not upsized to be fortran INTEGERs).
>
> No. The Fortran status must __always__ be 6, because we need enough room to correctly convert the 3 useful variables to Fortran, plus copy the rest of the hidden things.These 6 type will be INTEGER (which will then be different than the C int). The C<->F stuff will do not a memcpy but copy all elements while casting to the correct Fortran type (ompi_fortran_integer_t).
>
> The fact that we are talking about 3 integers in the Fortran status might explain the segfault. This number should never be 3 it should be ALWAYS 6 or the function MPI_Status_c2f will clearly overwrite the memory.

I did manage to try this idea on an -i8 enabled Open MPI version. The test application provided on one of the early email successfully complete without the segfault and with a correct output.

 node= 0 and size= 2 : Hello
 node= 1 and size= 2 : Hello
 Iam = 1 and my temp value is = 1
 Iam = 0 and my temp value is = 1

So the fix is trivial, make MPI_STATUS_SIZE always equal to sizeof(MPI_Status)/sizeof(int). Everything else is already taken care of by the current Fortran <-> C infrastructure.

George.

 

>
> George.
>
>
>>
>> --
>> Jeff Squyres
>> jsquyres_at_[hidden]
>> For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/
>>
>> _______________________________________________
>> users mailing list
>> users_at_[hidden]
>> http://www.open-mpi.org/mailman/listinfo.cgi/users
>