Lawrence Mitchell <[email protected]> writes:

> 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.

It's supposed to work, but I think not tested.  Can you test the above
(have the conditional check the key instead of changing "match"; there
is no implicit conversion from bool to PetscBool) and submit as a patch?

Attachment: signature.asc
Description: PGP signature

Reply via email to