[petsc-users] Multiple in-flight communications with PetscSFs
Jed Brown
jed at jedbrown.org
Fri Feb 6 12:09:38 CST 2015
Lawrence Mitchell <lawrence.mitchell at imperial.ac.uk> 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?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150206/2c5cb657/attachment.pgp>
More information about the petsc-users
mailing list