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. 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? 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. (and yes, the values in the indices[] array should be between 0 and (incount-1)) On Mar 21, 2014, at 12:01 PM, Ross Boylan <r...@biostat.ucsf.edu> 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 <r...@biostat.ucsf.edu> 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 >>> us...@open-mpi.org >>> http://www.open-mpi.org/mailman/listinfo.cgi/users >> >> > > > _______________________________________________ > users mailing list > us...@open-mpi.org > http://www.open-mpi.org/mailman/listinfo.cgi/users -- Jeff Squyres jsquy...@cisco.com For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/