[petsc-users] Two applications with PETSc

Danyang Su danyang.su at gmail.com
Wed Oct 31 13:54:06 CDT 2018


Hi Guido,

You can try to use preprocessor flags in you code to separate sequential 
code and parallel code. I am not sure if PETSc has a better way to do 
this. Just a suggestion.

Regards,

Danyang

On 2018-10-31 10:24 a.m., Guido Giuntoli via petsc-users wrote:
> Hi, I have two codes that use PETSc. The first one is parallel and 
> uses MPI and the other doesn't uses MPI (uses sequencial Mats and Vecs 
> because the problem is smaller). I need now to couple both codes and 
> my question is how do I deal with the PetscInitialize in the 
> sequential code ? I know that PetscInitialize calls MPI_Init so I 
> think if the first code just called MPI_Init before I will get an 
> error or not ? Every process in the parallel code needs to use the 
> functions of the sequential code, so every process will call 
> PetscInitialize of the sequential code.
>
> constrain : I would like to use the same compiled library of petsc to 
> link both codes.
>
> Thank you, Guido.


More information about the petsc-users mailing list