Gheghen
Gheghen

Reputation: 381

Internalize creation of MPI processes

Is there a way to internalize the creation of MPI processes? Instead of specifying the number of processes in the commandline "mpiexec -np 2 ./[PROG]"; I would like the number of processes be specified internally. Cheers

Upvotes: 1

Views: 95

Answers (1)

Jonathan Dursi
Jonathan Dursi

Reputation: 50927

Yes. You're looking for MPI_Spawn() from MPI-2, which launches a (possibly different) program with a number of processes that can be specified at runtime, and creates a new communicatator which you can use in place of MPI_COMM_WORLD to communicate amongst both the original and the new processes.

Upvotes: 2

Related Questions