[petsc-users] PETSc init question

Pierre Jolivet pierre at joliv.et
Wed Jan 31 09:14:52 CST 2024



> On 31 Jan 2024, at 11:31 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) and what about MPI_Init_thread.

Then, MPI_Init() is not called, see the call to MPI_Initialized() in https://petsc.org/release/src/sys/objects/pinit.c.html#PetscInitialize.

> Wouldn't it be more convenient to have a Petsc init function taking a already initialized communicator as argument ?
> 
> 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, you can initialize MPI yourself and then set PETSC_COMM_WORLD to whatever you need before calling PetscInitialize().

Thanks,
Pierre

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240131/2540cbbd/attachment.html>


More information about the petsc-users mailing list