GNU/Linux |
RedHat 6.2(Zoot) |
|
![]() |
MPI_Comm_spawn_multiple(2) |
![]() |
MPI_Spawn − Spawn MPI processes under LAM.
#include <mpi.h>
int MPI_Comm_spawn(char *command, char *argv[], int maxprocs, MPI_Info info, int root, MPI_Comm comm, MPI_Comm *intercomm, int array_of_errcodes[]) | |
int MPI_Comm_spawn_multiple(int count, char *array_of_commands[], char **array_of_argv[], int array_of_maxprocs[], MPI_Info array_of_info[], int root, MPI_Comm comm, MPI_Comm *intercomm, int array_of_errcodes[]) |
integer maxprocs, info, root, comm, intercomm, errcodes(*), ierr
A group of processes can create another group of processes with MPI_Comm_spawn() or MPI_Comm_spawn_multiple(). These two functions are collective operations over the parent processes. The child group starts up like any MPI application. The processes must begin by calling MPI_Init(), after which the pre-defined communicator, MPI_COMM_WORLD, may be used. This world communicator contains only the child processes. It is distinct from the MPI_COMM_WORLD of the parent processes.
Communication
With Spawned Processes
The natural communication mechanism between two groups is
the intercommunicator. The second communicator argument to
both functions returns an intercommunicator whose local
group contains the parent processes (same as the first
communicator argument) and whose remote group contains child
processes. The child processes can access the same
intercommunicator by using the MPI_Comm_get_parent()
call. The remote group size of the parent communicator is
zero if the process was created by mpirun(1) instead
of one of the spawn functions. Both groups can decide to
merge the intercommunicator into an intracommunicator (with
the MPI_Comm_merge() function) and take advantage of
other MPI collective operations. They can then use the
merged intracommunicator to create new communicators and
reach other processes in the MPI application.
Resource
Allocation
LAM tends not to offer MPI features that are not portable in
production applications. The info argument to the
spawn functions is where non-portable resource specification
may be made. LAM does not interpret this parameter. The
portable value MPI_INFO_NULL should be given.
LAM schedules the given number of processes onto LAM nodes by starting with node 0 (or the lowest numbered node), and continuing through higher node numbers, placing one process on each node. If the process count is greater than the node count, the procedure repeats.
Process
Count
The maxprocs parameter to MPI_Comm_spawn(),
and maxprocs array argument to
MPI_Comm_spawn_multiple() specify the exact number of
processes to be started. If it is not possible to start the
desired number of processes, the span routines will return
an error code.
Frequently, an application wishes to chooses a process count so as to fill all processors available to a job. MPI indicates the maximum number of processes recommended for a job in the pre-defined attribute, MPI_UNIVERSE_SIZE, which is cached on MPI_COMM_WORLD. The typical usage is to subtract the value of MPI_UNIVERSE_SIZE from the number of processes currently in the job and spawn the difference. LAM sets MPI_UNIVERSE_SIZE to the number of nodes in the user’s LAM session.
Locating an
Executable Program
The executable program file must be located on the node(s)
where the process(es) will run. On any node, the directories
specified by the user’s PATH environment variable are
searched to find the program.
All MPI runtime options selected by mpirun(1) in the initial application launch remain in effect for all child processes created by the spawn functions.
Command-line
Arguments
The argv parameter to MPI_Comm_spawn() should
not contain the program name, since it is given in the first
parameter. The same is true for the array_of_argv
parameter to MPI_Comm_spawn_multiple. The command
line that is passed to the newly launched program will be
the program name followed by the strings in argv or
array_of_argv.
mpirun(1)
![]() |
MPI_Comm_spawn_multiple(2) | ![]() |