[petsc-users] PetscObjectGetComm

Matthew Knepley knepley at gmail.com
Wed Apr 22 08:27:02 CDT 2020


On Wed, Apr 22, 2020 at 3:07 AM Marius Buerkle <mbuerkle at web.de> wrote:

> I see, but I am still puzzeled, why are the communicators different on
> different notes eventhough it is the same object.
>

This is the output of MPI_Comm_dup() on line 126 of tagm.c. Therefore, dup
comms are not guaranteed to have the same id
across multiple processes.

  Thanks,

     Matt


>
>
> PETSc creates a duplicate of the communicator during object creation.
>
> https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscCommDuplicate.html
>
> Jose
>
>
> > El 22 abr 2020, a las 8:40, Marius Buerkle <mbuerkle at web.de> escribió:
> >
> > Hi Dave,
> >
> > I want to use it in Fortran if possible. But I tried both C and Fortran
> just to see if it works in general. I am using MPICH 3.3.2. I attached the
> MWE for C and Fortran with the output I get.
> >
> > Marius
> >
> >
> >
> >
> >
> > Hi,
> >
> > What is PetscObjectGetComm expected to return?
> >
> > As Patrick said, it returns the communicator associated with the petsc
> object.
> >
> > I thought it would give the MPI communicator the object lives on. So if
> I create A matrix on PETSC_COMM_WORLD a call of PetscObjectGetComm for A it
> would return PETSC_COMM_WORLD? But it seems to return something else, and
> while most of the nodes return a similar communicator some are giving a
> different one.
> >
> > How are you actually comparing the communicators (send code snippet)?
> Which MPI implementation are you using? And when are comparing comms is the
> comparison code written in C it FORTRAN?
> >
> >
> > That said, is there a way to get the MPI communicator a matrix lives on?
> >
> > You are using the correct function. There is a macro as well but it’s
> best to use the function.
> >
> > Thanks,
> > Dave
> >
> >
> >
> >
> > Best,
> > Marius
> > <test_comm.tar.gz>
>
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200422/2b2ebe07/attachment.html>


More information about the petsc-users mailing list