[petsc-users] using mpi

Jed Brown jedbrown at mcs.anl.gov
Tue Oct 1 23:08:46 CDT 2013


Gryllida <gryllida at fastmail.fm> writes:

> I have a parallel program which reads data and makes a call to a
> subroutine that uses petsc. It only needs to read data once. Is it
> possible to implement that using MPI and then initialise petsc in the
> subroutine? Or do I need to initialise petsc first (and use MPI calls
> with PETSC_COMM_WORLD)?

We recommend only calling PetscInitialize and PetscFinalize once, so you
may want to lift it to an initialization function.  You can call them
inside the function, but if the function is called multiple times, the
profiling and debugging functionality in PETSc will have to run each
time, producing more output than you probably want when you turn those
features on.

Regardless of where you initialize PETSc, you can use MPI_COMM_WORLD or
any other communicator.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20131001/47ef5838/attachment.pgp>


More information about the petsc-users mailing list