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

Barry Smith bsmith at mcs.anl.gov
Tue Aug 31 17:05:01 CDT 2010


On Aug 31, 2010, at 6:06 PM, Jed Brown wrote:

> On Tue, 31 Aug 2010 15:58:30 -0600, nan zhao <zhaonanavril at gmail.com> 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.
> 
> No, you can only call it once.

   This is no longer true, though it was true for 15 years.

  Barry

> 
>> 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?
> 
> You can, but it's usually not necessary since PetscInitialize will call
> it for you otherwise (and then PetscFinalize will call MPI_Finalize).
> 
> Jed



More information about the petsc-users mailing list