[petsc-users] Is it possible to start MPI with n processes from within the code so it takes only effect on the petsc code?
Smith, Barry F.
bsmith at mcs.anl.gov
Tue Dec 4 16:49:10 CST 2018
If you want to run PETSc on a subset of the processes the original program started with, this is easy. Simply use the MPI communicator routines to create a communicator that contains the processes you want PETSc run on. Then on that subset of processes set PETSC_COMM_WORLD to that communicator and call PetscInitialize() on that subset.
Doing anything else is tricky and may not be possible; like running PETSc on more processes than the original application starts MPI with.
Barry
> On Dec 4, 2018, at 4:22 PM, Klaus Burkart via petsc-users <petsc-users at mcs.anl.gov> wrote:
>
> Hello,
>
> I try to integrate petsc into an application and I think it would be much simpler if I could bypass the applications original MPI functionality by starting MPI with n processes when initializing Petsc and stopping it when PetscFinalize(); is called. The standard mpirun -np 4 application -parameters triggers a couple of events which are of no use to petsc and at the same time make the implementation very complicated as e.g. relevant data is lost.
>
> Is it possible to start MPI with n processes from within the code so it takes only effect on the petsc code?
>
> I see a simple way to provide the number of processes through the configuration file which will hold the solver settings.
>
> Klaus
More information about the petsc-users
mailing list