|
MPI_Comm_spawn_multiple - Spawn a dynamic MPI process from multiple executables
#include <mpi.h>
int MPI_Comm_spawn_multiple(int count, char **commands, char ***argvs,
int *maxprocs, MPI_Info *infos, int root,
MPI_Comm comm, MPI_Comm *intercomm,
int *errcodes)
count
- number of commands (only significant at root)
commands
- commands to be executed (only significant at root)
argvs
- arguments for commands (only significant at root)
maxprocs
- max number of processes for each command (only significant at root)
infos
- startup hints for each command
root
- rank of process to perform the spawn
comm
- parent intracommunicator
intercomm
- child intercommunicator containing spawned processes
errcodes
- one code per process
A group of processes can create another group of processes with MPI_Comm_spawn_multiple. This function is a collective operation over the parent communicator. 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.
MPI_Comm_spawn_multiple is used to manually specify a group of different executables and arguments to spawn. MPI_Comm_spawn is used to specify one executable and set of arguments.
Communication With Spawned Processes
The natural communication mechanism between two groups is the intercommunicator. The second communicator argument to MPI_Comm_spawn_multiple 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. Both groups can decide to merge the intercommunicator into an intracommunicator (with the MPI_Comm_merge () function).
Info keys
| Key: |
Description: |
| file |
The spawning can be based on the configuration of a
process group .pg file. Since a .pg file fully specifies
how many, which, and where processes should be spawned no
other info key is read if the file
key is present. The .pg file needs only to be present at the
root of the spawn.
|
| host |
The host name (Windows Computer Name) as specified in the
cluster configuration file of the machine to host the processes
to be spawned. You are required specify the host
key in every info argument if you specify
it in one.
|
| path |
Value is the directory where csWMPI should look for the executable(s).
You can specify multiple paths separated by semicolon in each info object.
|
In case the file key is used in any info object the corresponding command, argv, and maxproc are all ignored. Note that even though maxprocs
is ignored, errcodes must still be an array long enough to hold an integer error code for every process that tried to launch,
or be the MPI constant MPI_ERRCODES_IGNORE.
Also note that this "file" key is not portable to other MPI implementations.
Process Count
The maxprocs array parameter to MPI_Comm_spawn_multiple specifies the exact number of processes to be started. If it is not possible to start the desired number of processes,
MPI_Comm_spawn_multiple will return an error code. Note that even though maxprocs is only relevant on the root, all ranks must have an errcodes
array long enough to handle an integer error code for every process that tries to launch, or give MPI constant MPI_ERRCODES_IGNORE for the errcodes argument. While this appears to be a contradiction, it is per the MPI-2 standard.
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.
Command-line Arguments
The argvs array parameter to MPI_Comm_spawn_multiple should not contain the program name since it is given in the first parameter. The command line that is passed to the newly
launched program will be the program name followed by the strings in corresponding entry in the argvs array.
If an error occurs in an MPI function, the current MPI error handler is called to handle it. By default, this error handler
aborts the MPI job. The error handler may be changed with MPI_Errhandler_set; the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned (in C and Fortran; this error handler is less useful in with the C++ MPI
bindings. The predefined error handler MPI::ERRORS_THROW_EXCEPTIONS should be used in C++ if the error value needs to be
recovered). Note that MPI does not guarantee that an MPI program can continue past an error.
All MPI routines (except MPI_Wtime and MPI_Wtick) return an error value; C routines as the value of the function and Fortran routines in the last argument. The C++ bindings
for MPI do not return error values; instead, error values are communicated by throwing exceptions of type MPI::Exception
(but not by default). Exceptions are only thrown if the error value is not MPI::SUCCESS.
Note that if the MPI::ERRORS_RETURN handler is set in C++, while MPI functions will return upon an error, there will be
no way to recover what the actual error value was.
MPI_SUCCESS
- No error; MPI routine completed successfully.
MPI_ERR_COMM
- Invalid communicator. A common error is to use a null communicator in a call (not even allowed in MPI_Comm_rank).
MPI_ERR_SPAWN
- Spawn error; one or more of the applications attempting to be launched failed. Check the returned error code array.
MPI_ERR_ARG
- Invalid argument. Some argument is invalid and is not identified by a specific error class. This is typically a NULL
pointer or other such error.
MPI_ERR_ROOT
- Invalid root. The root must be specified as a rank in the communicator. Ranks must be between zero and the size of the
communicator minus one.
MPI_Comm_get_parent, MPI_Comm_merge, MPI_Comm_spawn, MPI_Info_create, MPI_Info_set, MPI_Info_delete, MPI_Info_free, MPI_Init
|