This is what I need ! Thank you Matt ! El El mié, 31 oct 2018 a las 19:53, Matthew Knepley <knep...@gmail.com> escribió:
> On Wed, Oct 31, 2018 at 1:34 PM Guido Giuntoli via petsc-users < > petsc-users@mcs.anl.gov> 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. >> > > You should only call PetscInitialize() once (just like MPIInit()). You can > check whether it has been called using PetscInitialized(). > > Thanks, > > Matt > > >> Thank you, Guido. >> > >> > > -- > 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/> >