NAME
MMPPIICCoommmmssppaawwnnmmuullttiippllee - Spawns multiple binaries, or the same binary
with multiple sets of arguments. SSYYNNTTAAXX CC SSyynnttaaxx#include
int MPICommspawnmultiple(int count, char *arrayofcommands[], char **arrayofargv[], int arrayofmaxprocs[], MPIInfo arrayofinfo[], int root, MPIComm comm, MPIComm *intercomm, int arrayoferrcodes[]) FFoorrttrraann SSyynnttaaxx INCLUDE 'mpif.h' MPICOMMSPAWNMULTIPLE(COUNT, ARRAYOFCOMMANDS, ARRAYOFARGV, ARRAYOFMAXPROCS, ARRAYOFINFO, ROOT, COMM, INTERCOMM,ARRAYOFERRCODES, IERROR)
INTEGER COUNT, ARRAYOFINFO(*), ARRAYOFMAXPROCS(*), ROOT,COMM, INTERCOMM, ARRAYOFERRCODES(*), IERROR
CHARACTER*(*) ARRAYOFCOMMANDS(*), ARRAYOFARGV(COUNT, *) CC++++ SSyynnttaaxx#include
MPI::Intercomm MPI::Intracomm::Spawnmultiple(int count, const char* arrayofcommands[], const char** arrayofargv[], const int arrayofmaxprocs[], const MPI::Info arrayofinfo[], int root, int arrayoferrcodes[]) MPI::Intercomm MPI::Intracomm::Spawnmultiple(int count, const char* arrayofcommands[], const char** arrayofargv[], const int arrayofmaxprocs[], const MPI::Info arrayofinfo[], int root) IINNPPUUTT PPAARRAAMMEETTEERRSS count Number of commands (positive integer, significant to MPI onlyat root - see NOTES).
arrayofcommands Programs to be executed (array of strings, significant only at root). arrayofargvArguments for commands (array of array of strings, signifi-
cant only at root). arrayofmaxprocs Maximum number of processes to start for each command (array of integers, significant only at root). arrayofinfo Info objects telling the runtime system where and how to start processes (array of handles, significant only at root). root Rank of process in which previous arguments are examined (integer). comm Intracommunicator containing group of spawning processes (handle). OOUUTTPPUUTT PPAARRAAMMEETTEERRSS intercomm Intercommunicator between original group and the newly spawned group (handle). arrayoferrcodes One code per process (array of integers).IERROR Fortran only: Error status (integer).
DESCRIPTION
MPICommspawnmultiple is identical to MPICommspawn except that it can specify multiple executables. The first argument, count, indicates the number of executables. The next three arguments are arrays of the corresponding arguments in MPICommspawn. The next argument, arrayofinfo, is an array of info arguments; however, only the first argument in that array is used. Any subsequent arguments in the array are ignored because an info argument applies to the entire job that is spawned, and cannot be different for each executable in the job. See the INFO ARGUMENTS section for more information. For the Fortran version of arrayofargv, the element arrayofargv(i,j) is the jth argument to command number i. In any language, an application may use the constant MPIARGVSNULL (which is likely to be (char ***)0 in C) to specify that no argumentsshould be passed to any commands. The effect of setting individual ele-
ments of arrayofargv to MPIARGVNULL is not defined. To specifyarguments for some commands but not others, the commands without argu-
ments should have a corresponding argv whose first element is null ((char *)0 in C and empty string in Fortran). All of the spawned processes have the same MPICOMMWORLD. Their ranksin MPICOMMWORLD correspond directly to the order in which the com-
mands are specified in MPICommspawnmultiple. Assume that m1 pro-
cesses are generated by the first command, m2 by the second, etc. Theprocesses corresponding to the first command have ranks 0, 1,..., m1-1.
The processes in the second command have ranks m1, m1+1, ..., m1+m2-1.
The processes in the third have ranks m1+m2, m1+m2+1, ..., m1+m2+m3-1,
etc.The arrayoferrcodes argument is 1-dimensional array of size
count \ n , / i=1 iwhere i is the ith element of arrayofmaxprocs. Command number i cor-
responds to the i contiguous slots in this array from elementi-1 | i |
\ n , to | \ n | -1
/ j=1 i | / j=1 j | | | Error codes are treated as for MPICommspawn. IINNFFOO AARRGGUUMMEENNTTSS The following values for info are recognized in Open MPI 1.2. (Thereserved values mentioned in Section 5.3.4 of the MPI-2 standard are
not implemented.) Key value Type Description----- -- ------
host char * Host on which the process should be spawned. wdir char * Directory where the executable is located. Note that in Open MPI 1.2, the first array location in arrayofinfo is applied to all the commands in arrayofcommands. NNOOTTEESS The argument count is interpreted by MPI only at the root, as is arrayofargv. Since the leading dimension of arrayofargv is count, a nonpositive value of count at a nonroot node could theoretically cause a runtime bounds check error, even though arrayofargv should beignored by the subroutine. If this happens, you should explicitly sup-
ply a reasonable value of count on the nonroot nodes. Calling MPICommspawn many times would create many sets of children with different MPICOMMWORLDs, whereas MPICommspawnmultiple createschildren with a single MPICOMMWORLD, so the two methods are not com-
pletely equivalent. Also if you need to spawn multiple executables, you may get better performance by using MPICommspawnmultiple instead of calling MPICommspawn several times. EERRRROORRSS Almost all MPI routines return an error value; C routines as the valueof the function and Fortran routines in the last argument. C++ func-
tions do not return errors. If the default error handler is set toMPI::ERRORSTHROWEXCEPTIONS, then on error the C++ exception mechanism
will be used to throw an MPI:Exception object. Before the error value is returned, the current MPI error handler is called. By default, this error handler aborts the MPI job, except for I/O function errors. The error handler may be changed withMPICommseterrhandler; the predefined error handler MPIERRORSRETURN
may be used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error.SEE ALSO
MPICommspawn(3) MPICommgetparent(3) mpirun(1) Open MPI 1.2 September 2006MPICommspawnmultiple(3OpenMPI)