1MPI_Comm_spawn_multiple(3)          LAM/MPI         MPI_Comm_spawn_multiple(3)
2
3
4

NAME

6       MPI_Comm_spawn_multiple  -   Spawn  a dynamic MPI process from multiple
7       executables
8

SYNOPSIS

10       #include <mpi.h>
11       int
12       MPI_Comm_spawn_multiple(int count, char **commands, char ***argvs,
13                             int *maxprocs, MPI_Info *infos, int root,
14                             MPI_Comm comm, MPI_Comm *intercomm,
15                             int *errcodes)
16

INPUT PARAMETERS

18       count  - number of commands (only significant at root)
19       commands
20              - commands to be executed (only significant at root)
21       argvs  - arguments for commands (only significant at root)
22       maxprocs
23              - max number of processes for each command (only significant  at
24              root)
25       infos  - startup hints for each command
26       root   - rank of process to perform the spawn
27       comm   - parent intracommunicator
28
29

OUTPUT PARAMETERS

31       intercomm
32              - child intercommunicator containing spawned processes
33       errcodes
34              - one code per process
35
36

DESCRIPTION

38       A  group  of  processes  can  create  another  group  of processes with
39       MPI_Comm_spawn_multiple .  This function is a collective operation over
40       the parent communicator.  The child group starts up like any MPI appli‐
41       cation.  The processes must begin by calling MPI_Init , after which the
42       pre-defined  communicator,  MPI_COMM_WORLD  ,  may be used.  This world
43       communicator contains only the child processes.  It  is  distinct  from
44       the MPI_COMM_WORLD of the parent processes.
45
46       MPI_Comm_spawn_multiple  is used to manually specify a group of differ‐
47       ent executables and arguments to  spawn.   MPI_Comm_spawn  is  used  to
48       specify  one  executable  and set of arguments (although a LAM/MPI app‐
49       schema(5) can be provided to MPI_Comm_spawn via the "file" info key).
50
51       Communication With Spawned Processes
52
53       The natural communication mechanism between two groups is the intercom‐
54       municator.  The second communicator argument to MPI_Comm_spawn_multiple
55       returns an intercommunicator whose local group contains the parent pro‐
56       cesses (same as the first communicator argument) and whose remote group
57       contains child processes. The  child  processes  can  access  the  same
58       intercommunicator  by  using  the MPI_Comm_get_parent call.  The remote
59       group size of the parent communicator is zero if the process  was  cre‐
60       ated  by mpirun (1) instead of one of the spawn functions.  Both groups
61       can decide to merge the  intercommunicator  into  an  intracommunicator
62       (with  the MPI_Intercomm_merge () function) and take advantage of other
63       MPI collective operations.  They can then use the merged  intracommuni‐
64       cator  to create new communicators and reach other processes in the MPI
65       application.
66
67       Resource Allocation
68
69       Note that no MPI_Info keys are recognized  by  this  implementation  of
70       MPI_Comm_spawn_multiple  .   To  use  the "file" info key to specify an
71       appschema(5), use LAM's MPI_Comm_spawn .  This  may  be  preferable  to
72       MPI_Comm_spawn_multiple  because  it allows the arbitrary specification
73       of what nodes and/or CPUs should be used to launch jobs (either SPMD or
74       MPMD).  See MPI_Comm_spawn(3) for more details.
75
76       The value of MPI_INFO_NULL should be given for each value in infos (the
77       infos array is not currently examined by LAM/MPI,  so  specifying  non-
78       NULL  values  for  the array values is not harmful).  LAM schedules the
79       given number of processes onto LAM nodes by starting with CPU 0 (or the
80       lowest  numbered CPU), and continuing through higher CPU numbers, plac‐
81       ing one process on each CPU.  If the process count is greater than  the
82       CPU count, the procedure repeats.
83
84       Process Terminiation
85
86       Note    that   the   process[es]   spawned   by   MPI_COMM_SPAWN   (and
87       MPI_COMM_SPAWN_MULTIPLE ) effectively become  orphans.   That  is,  the
88       spawnning  MPI application does not wait for the spawned application to
89       finish.  Hence, there is no guarantee the spawned application has  fin‐
90       ished  when  the  spawning  completes.  Similarly, killing the spawning
91       application will also have no effect on the spawned application.
92
93       User applications can effect this kind  of  behavior  with  MPI_BARRIER
94       between the spawning and spawned processed before MPI_FINALIZE .
95
96
97       Note that lamclean will kill *all* MPI processes.
98
99       Process Count
100
101       The  maxprocs  array parameter to MPI_Comm_spawn_multiple specifies the
102       exact number of processes to be started.  If  it  is  not  possible  to
103       start  the  desired  number  of processes, MPI_Comm_spawn_multiple will
104       return an error code.  Note that even though maxprocs is only  relevant
105       on  the root, all ranks must have an errcodes array long enough to han‐
106       dle an integer error code for every process that tries  to  launch,  or
107       give MPI constant MPI_ERRCODES_IGNORE for the errcodes argument.  While
108       this appears to be a contradiction, it is per the MPI-2 standard.  :-\
109
110       Frequently, an application wishes to chooses a process count so  as  to
111       fill all processors available to a job.  MPI indicates the maximum num‐
112       ber of processes recommended for a job in  the  pre-defined  attribute,
113       MPI_UNIVERSE_SIZE , which is cached on MPI_COMM_WORLD .
114
115       The  typical  usage  is to subtract the value of MPI_UNIVERSE_SIZE from
116       the number of processes currently in the job and spawn the  difference.
117       LAM sets MPI_UNIVERSE_SIZE to the number of CPUs in the user's LAM ses‐
118       sion (as defined in the boot schema [bhost(5)] via lamboot (1)).
119
120       See MPI_Init(3) for other pre-defined attributes that are helpful  when
121       spawning.
122
123       Locating an Executable Program
124
125       The  executable  program  file must be located on the node(s) where the
126       process(es) will run.  On any node, the directories  specified  by  the
127       user's PATH environment variable are searched to find the program.
128
129       All  MPI runtime options selected by mpirun (1) in the initial applica‐
130       tion launch remain in effect for all child  processes  created  by  the
131       spawn functions.
132
133       Command-line Arguments
134
135       The argvs array parameter to MPI_Comm_spawn_multiple should not contain
136       the program name since it is given in the first parameter.  The command
137       line  that  is passed to the newly launched program will be the program
138       name followed by the strings in corresponding entry in the argvs array.
139
140

USAGE WITH IMPI EXTENSIONS

142       The IMPI standard only supports MPI-1 functions.  Hence, this  function
143       is currently not designed to operate within an IMPI job.
144
145

ERRORS

147       If an error occurs in an MPI function, the current MPI error handler is
148       called to handle it.  By default, this error  handler  aborts  the  MPI
149       job.   The  error  handler may be changed with MPI_Errhandler_set ; the
150       predefined error handler MPI_ERRORS_RETURN may be used to  cause  error
151       values  to  be  returned  (in C and Fortran; this error handler is less
152       useful in with the C++ MPI  bindings.   The  predefined  error  handler
153       MPI::ERRORS_THROW_EXCEPTIONS  should  be used in C++ if the error value
154       needs to be recovered).  Note that MPI does not guarantee that  an  MPI
155       program can continue past an error.
156
157       All  MPI  routines  (except  MPI_Wtime  and MPI_Wtick ) return an error
158       value; C routines as the value of the function and Fortran routines  in
159       the  last  argument.  The C++ bindings for MPI do not return error val‐
160       ues; instead, error values are communicated by throwing  exceptions  of
161       type  MPI::Exception  (but not by default).  Exceptions are only thrown
162       if the error value is not MPI::SUCCESS .
163
164
165       Note that if the MPI::ERRORS_RETURN handler is set in  C++,  while  MPI
166       functions  will  return  upon an error, there will be no way to recover
167       what the actual error value was.
168       MPI_SUCCESS
169              - No error; MPI routine completed successfully.
170       MPI_ERR_COMM
171              - Invalid communicator.  A common error is to use a null  commu‐
172              nicator in a call (not even allowed in MPI_Comm_rank ).
173       MPI_ERR_SPAWN
174              -  Spawn error; one or more of the applications attempting to be
175              launched failed.  Check the returned error code array.
176       MPI_ERR_ARG
177              - Invalid argument.  Some argument is invalid and is not identi‐
178              fied  by  a  specific  error  class.   This  is typically a NULL
179              pointer or other such error.
180       MPI_ERR_ROOT
181              - Invalid root.  The root must be specified as  a  rank  in  the
182              communicator.   Ranks  must  be between zero and the size of the
183              communicator minus one.
184       MPI_ERR_OTHER
185              - Other error; use  MPI_Error_string  to  get  more  information
186              about this error code.
187       MPI_ERR_INTERN
188              -  An  internal error has been detected.  This is fatal.  Please
189              send a bug report to the LAM mailing list  (see  http://www.lam-
190              mpi.org/contact.php ).
191
192

SEE ALSO

194       appschema(5),  bhost(5), lamboot(1), MPI_Comm_get_parent(3), MPI_Inter‐
195       comm_merge(3),     MPI_Comm_spawn_multiple(3),      MPI_Info_create(3),
196       MPI_Info_set(3),   MPI_Info_delete(3),  MPI_Info_free(3),  MPI_Init(3),
197       mpirun(1)
198
199

MORE INFORMATION

201       For more information, please see the official MPI Forum web site, which
202       contains  the  text of both the MPI-1 and MPI-2 standards.  These docu‐
203       ments contain detailed information about each  MPI  function  (most  of
204       which is not duplicated in these man pages).
205
206       http://www.mpi-forum.org/
207
208
209

ACKNOWLEDGEMENTS

211       The  LAM Team would like the thank the MPICH Team for the handy program
212       to generate man pages  ("doctext"  from  ftp://ftp.mcs.anl.gov/pub/sow‐
213       ing/sowing.tar.gz  ), the initial formatting, and some initial text for
214       most of the MPI-1 man pages.
215

LOCATION

217       spawnmult.c
218
219
220
221LAM/MPI 7.1.2                      2/23/2006        MPI_Comm_spawn_multiple(3)
Impressum