change ring communication API to no longer require a static variable pointing to 'this' of the caller
This commit is contained in:
@ -678,10 +678,12 @@ int Comm::binary(double value, int n, double *vec)
|
||||
using original inbuf, which may have been updated
|
||||
for non-NULL outbuf, final updated inbuf is copied to it
|
||||
ok to specify outbuf = inbuf
|
||||
the ptr argument is a pointer to the instance of calling class
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Comm::ring(int n, int nper, void *inbuf, int messtag,
|
||||
void (*callback)(int, char *), void *outbuf, int self)
|
||||
void (*callback)(int, char *, void *),
|
||||
void *outbuf, void *ptr, int self)
|
||||
{
|
||||
MPI_Request request;
|
||||
MPI_Status status;
|
||||
@ -712,7 +714,7 @@ void Comm::ring(int n, int nper, void *inbuf, int messtag,
|
||||
MPI_Get_count(&status,MPI_CHAR,&nbytes);
|
||||
memcpy(buf,bufcopy,nbytes);
|
||||
}
|
||||
if (self || loop < nprocs-1) callback(nbytes/nper,buf);
|
||||
if (self || loop < nprocs-1) callback(nbytes/nper,buf,ptr);
|
||||
}
|
||||
|
||||
if (outbuf) memcpy(outbuf,buf,nbytes);
|
||||
|
||||
Reference in New Issue
Block a user