[petsc-users] Multiple in-flight communications with PetscSFs

Lawrence Mitchell lawrence.mitchell at imperial.ac.uk
Fri Feb 6 11:52:02 CST 2015


Hi all,

is it possible to have multiple rounds of communication in flight simultaneously on a single SF?

I'd like to be able to do something like:

PetscSFBcastBegin(sf, dtype, dataA, dataA_out);
PetscSFBcastBegin(sf, dtype2, dataB, dataB_out);

...

PetscSFBcastEnd(sf, dtype2, dataB, dataB_out);
PetscSFBcastEnd(sf, dtype, dataA, dataA_out);

This seems to work unless dtype2 and dtype are identical (and the sf_type is basic), in which case dataA_out ends up with the data I expect in dataB_out.

Look at the sfbasic implementation, I wonder if it is as simple as checking the link key when looking for an in use pack:

diff --git a/src/vec/is/sf/impls/basic/sfbasic.c b/src/vec/is/sf/impls/basic/sfbasic.c
index 2ef9849..9020e9c 100644
--- a/src/vec/is/sf/impls/basic/sfbasic.c
+++ b/src/vec/is/sf/impls/basic/sfbasic.c
@@ -801,6 +801,7 @@ static PetscErrorCode PetscSFBasicGetPackInUse(PetscSF sf,MPI_Datatype unit,cons
   for (p=&bas->inuse; (link=*p); p=&link->next) {
     PetscBool match;
     ierr = MPIPetsc_Type_compare(unit,link->unit,&match);CHKERRQ(ierr);
+    match = match && (link->key == key);
     if (match) {
       switch (cmode) {
       case PETSC_OWN_POINTER: *p = link->next; break; /* Remove from inuse list */

Or is this not something that is supposed to work at all and I'm just lucky.

Cheers,

Lawrence
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150206/1b4452ff/attachment.pgp>


More information about the petsc-users mailing list