Open MPI logo

Open MPI User's Mailing List Archives

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

Subject: Re: [OMPI users] testsome returns negative indices [diagnosis]
From: Ross Boylan (ross_at_[hidden])
Date: 2014-03-21 16:13:57


On 3/21/2014 10:17 AM, Ross Boylan wrote:
> On 3/21/2014 10:02 AM, Jeff Squyres (jsquyres) wrote:
>> So just to be clear, the C interface for MPI_Testsome is:
>>
>> int MPI_Testsome(int incount, MPI_Request requests[],
>> int *outcount, int indices[],
>> MPI_Status statuses[]);
>>
>> And your R call is:
>>
>> mpi_errhandler(MPI_Testsome(countn, request,
>> &INTEGER(indices)[0],
>> &INTEGER(indices)[1], status));
>>
>> I'm assuming request is an MPI_Request object.
> It's a pointer to an array of such objects.
> static MPI_Request *request;
> request=(MPI_Request *)Calloc(REQUEST_MAXSIZE, MPI_Request);
>> And integer(indices)[0] is where you want the outcount to go, and
>> then integer(indices)[1] through [value_of_outcount] is where you
>> want the indices to go, right?
> Yes.
>>
>> If so, then yes, that looks proper.
>>
>> You'll probably need to look into what's happening in the R wrapper
>> as to why you're not getting the right answers, sorry.
There was a problem in the R code that cause MPI_Request objects to be
reused before the original request completed.
Things are working much better now, though some bugs remain (not
necessarily related to MPI_Isend or Testsome).

Just for the record, isend in Rmpi is unreliable because the objects
being sent are subject to garbage collection (by R) before the send
completes. I am working on modifications to Rmpi to fix that.
>>
>> (and yes, the values in the indices[] array should be between 0 and
>> (incount-1))
> I'm getting increasingly suspicious that this could be an integer size
> mismatch, maybe from different compilation options. I think R uses 32
> bits (even on 64 bit machines) and MPI uses 64, even though both have
> type int. R defines
> #define INTEGER(x) ((int *) DATAPTR(x))
>
> What should the integer size be for MPI on 64 bit architectures,
> specifically linux gcc (Debian 4.4.5-8) 4.4.5?
I think it's still 32 bits and the problems were elsewhere.
>
> Ross
>>
>>
>> On Mar 21, 2014, at 12:01 PM, Ross Boylan <ross_at_[hidden]> wrote:
>>
>>> On Fri, 2014-03-21 at 14:11 +0000, Jeff Squyres (jsquyres) wrote:
>>>> Is that C or R code?
>>> C.
>>>> If it's R, I think the next step would be to check the R wrapper
>>>> for MPI_Testsome and see what is actually being returned by OMPI in
>>>> C before it gets converted to R. I'm afraid I don't know R, so I
>>>> can't really comment on the syntax / correctness of your code snipit.
>>>>
>>>> If it's C -- which I don't think it is, but it *could* be...? -- I
>>>> would need to understand your syntax in calling MPI_Testsome
>>>> better; e.g., what's &INTEGER(foo)[x]?
>>> allocVector(INTSXP, countn+1) allocates an R vector of integers.
>>> INTEGER(indices) returns the data portion of that structure, where the
>>> actual integers go. The &...[0] get the address of the first location.
>>> PROTECT keeps things from being garbage-collected by R.
>>>
>>> The allocation of indices is a cheat: the first location is used for
>>> the
>>> outcount, and the following locations get the actual indices.
>>>
>>> status is a pointer to an array of MPI status objects,
>>>
>>> The indices should be small integers, shouldn't they? I'm also getting
>>> some large values back.
>>>
>>> Ross
>>>> On Mar 20, 2014, at 8:39 PM, Ross Boylan <ross_at_[hidden]>
>>>> wrote:
>>>>
>>>>> MPI_Testsome seems to have returned successfully, with a positive
>>>>> outcount, and yet given me a negative index, -4432. Can anyone
>>>>> help me understand what's going on?
>>>>>
>>>>> The call is from R, and so there might be a translation issue. My
>>>>> first thought was that it might be 32 vs 64 bit integers, but both
>>>>> OMPI and R seem to be using the C int type for the integers.
>>>>>
>>>>> Here's the inner call:
>>>>>
>>>>> SEXP mpi_testsome(SEXP sexp_count){
>>>>> int countn=INTEGER(sexp_count)[0];
>>>>> SEXP indices;
>>>>> PROTECT (indices = allocVector(INTSXP, countn+1));
>>>>> mpi_errhandler(MPI_Testsome(countn, request,
>>>>> &INTEGER(indices)[0],
>>>>> &INTEGER(indices)[1], status));
>>>>> UNPROTECT(1);
>>>>> return indices;
>>>>> }
>>>>>
>>>>> SEXP is an R structure.
>>>>>
>>>>> OMPI 1.7.4.
>>>>>
>>>>> Ross Boylan
>>>>>
>>>>> _______________________________________________
>>>>> users mailing list
>>>>> users_at_[hidden]
>>>>> http://www.open-mpi.org/mailman/listinfo.cgi/users
>>>>
>>>
>>> _______________________________________________
>>> users mailing list
>>> users_at_[hidden]
>>> http://www.open-mpi.org/mailman/listinfo.cgi/users
>>
>
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users