[petsc-users] Can I call PetscInitialize twice in a programm

Barry Smith bsmith at mcs.anl.gov
Tue Aug 31 17:04:21 CDT 2010


On Aug 31, 2010, at 5:58 PM, nan zhao wrote:

> Hi,
> 
> I am now using petsc to develop some application which need to solve two
> physical systems. I want to use Petsc as the linear solver. but I am not
> sure if I can all PetscInitialize twice. becasue the two system are
> solving at the same time period. And also I want to use MPI to do
> parallel computing. Can I call MPI:INIT() before I call PetscInitialize?

   Yes and you can call PetscInitialize()/ Finalize() multiple times but that is not the standard usage model. Usually you put PetscInitialize() right at the beginning of the code and PetscFinalize() right at the end.

  Barry

> 
> Thank you very much!
> 
> Nan
> 



More information about the petsc-users mailing list