MPI_COMM_SPAWN(3)MPI_COMM_SPAWN(3)NAMEMPI_Comm_spawn - Starts a number of MPI processes and establishes
communication with them, returning an intercommunicator
SYNOPSIS
C:
#include <mpi.h>
int MPI_Comm_spawn( command, argv, maxprocs, info, root,
comm, intercomm, array_of_errcodes )
int maxprocs, root, array_of_errcodes[];
char *command,*argv[];
MPI_Comm comm,*intercomm;
MPI_Info info;
Fortran:
INCLUDE "mpif.h" (or USE MPI)
INTEGER info, maxprocs, root, comm, intercomm,
array_of_errcodes(*), ierror
CHARACTER*(*) command, argv(*)
CALL MPI_COMM_SPAWN(command, argv, maxprocs, info, root,
comm, intercomm, array_of_errcodes, ierror)
DESCRIPTION
The MPI_Comm_spawn routine tries to start maxprocs identical copies of
the MPI program specified by command, establishing communication with
them and returning an intercommunicator. The spawned processes are
referred to as childern. The children have their own MPI_COMM_WORLD,
which is separate from the of the parents. This call is collective over
comm. This routine accepts the following parameters:
command Specifies the name of the MPI program to be spawned
(string, significant only at root).
argv Specifies arguments to be passed to command.
MPI_ARGV_NULL should be used if no arguments are to be
passed to the program (array of strings, significant only
at root).
maxprocs Specifies the maximum number of processes to start
(integer, significant only at root).
info A set of key-value pairs telling the runtime system where
and how to start the processes. Currently this value is
ignored. MPI_INFO_NULL should be used if no info argument
is supplied (handle, significant only at root).
Page 1
MPI_COMM_SPAWN(3)MPI_COMM_SPAWN(3)
root The rank of the process in which previous arguments are
examined (integer).
comm The intracommunicator containg the group of spawning
processes (handle).
intercomm Upon return, the intercommunicator between the original
group and the newly spawned group (handle).
array_of_errcodes
Upon return, reports the status of the spawned program,
one code per process. MPI_ERRCODES_IGNORE should be used
if no argument is provided (array of integers).
ierror Specifies the return code value for successful completion,
which is in MPI_SUCCESS. MPI_SUCCESS is defined in the
mpif.h file (integer).
NOTES
In this implementation, all of the spawned processes have access to
stdout and stderr. However, none of the spawned processes have access
to stdin.
The argv argument is an array of strings containing arguments that are
passed to the program. The first element of argv is the first argument
passed to command, not, as is conventional in some contexts, the command
itself. The argument list is terminated by NULL in C and an empty string
in FORTRAN.
Error codes are the values returned by MPI routines (in C) or in the
ierror argument (in Fortran). These can be converted to error classes by
using the MPI_Error_class(3) routine.
SEE ALSOMPI_Comm_spawn_multiple(3), MPI_Comm_get_parent(3),MPI_Finalize(3)mpi(1), mpirun(1)
Page 2