[petsc-users] Is it possible to start MPI with n processes from within the code so it takes only effect on the petsc code?

Jed Brown jed at jedbrown.org
Tue Dec 4 17:36:12 CST 2018


See MPI_Comm_spawn().

https://www.mpi-forum.org/docs/mpi-3.1/mpi31-report/node240.htm#Node240

Note that it may interact poorly (or not at all) with resource managers
and other HPC infrastructure (relative to using mpiexec or similar to
spawn the jobs, which does not give you the intercommunicator to
communicate between the parent and children).

"Smith, Barry F. via petsc-users" <petsc-users at mcs.anl.gov> writes:

>   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