[petsc-users] PETSc init question

Matthew Knepley knepley at gmail.com
Wed Jan 31 09:17:47 CST 2024


On Wed, Jan 31, 2024 at 10:10 AM Alain O' Miniussi <alain.miniussi at oca.eu>
wrote:

> Hi,
>
> It is indicated in:
> https://petsc.org/release/manualpages/Sys/PetscInitialize/
> that the init function will call MPI_Init.
>
> What if MPI_Init was already called (as it is the case in my application)


>From the page: " PetscInitialize() calls MPI_Init() if that has yet to be
called,". Also
"Note
If for some reason you must call MPI_Init() separately, call it before
PetscInitialize()."


> and what about MPI_Init_thread.
>

https://petsc.org/release/manualpages/Sys/PETSC_MPI_THREAD_REQUIRED/


> Wouldn't it be more convenient to have a Petsc init function taking a
> already initialized communicator as argument ?
>

Probably not.


> Also, that initialization seems to imply that it is not possible to have
> multiple instance of PETSc on different communicators. Is that the case ?
>

No, this is possible. We have examples for this. You call MPI_init()
yourself, set PETSC_COMM_WORLD to the communicator you want, and then call
PetscInitialize(). See

  https://petsc.org/release/manualpages/Sys/PETSC_COMM_WORLD/

  Thanks,

      Matt

  Thanks,

     Matt


> Thanks
>
> ----
> Alain Miniussi
> DSI, Pôles Calcul et Genie Log.
> Observatoire de la Côte d'Azur
> Tél. : +33609650665
>


-- 
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/20240131/be6b2148/attachment.html>


More information about the petsc-users mailing list