(keeping the user's list in the CC)
> On Mar 24, 2017, at 4:05 AM, gzzh...@buaa.edu.cn wrote: > > hi jeff: > I tried to call MPI_Comm_spawn("./child", MPI_ARGV_NULL, 1, > MPI_INFO_NULL, root, MPI_COMM_WORLD, &newcomm, &errs) > in order every MPI process in MPI_COMM_WORLD can spawn one child process. The MPI_COMM_SPAWN call is collective, meaning that all processes in the source communicator have to invoke the call with the same parameters. Meaning: in your example, this will launch exactly one additional process. Hence, if after MPI_INIT MPI_COMM_WORLD has N processes, if you immediately make this call to MPI_COMM_SPAWN, you will have a total of (N+1) processes. > Then all of these children processes are expected > to form their own MPI_COMM_WORLD even they are located on multiple nodes. In your example, there will only be 1 child process launched. > I found if the parameter "root" was a same value in every MPI process, for > example root =1, there is just one MPI process "rank=1" > can really spawn its child process, although other MPI processes call this > function but didn't create their child process. That is correct. That is the nature of a collective MPI call. > When I changed the value of root to every MPI process itself's rank, like > this: > MPI_Comm_spawn("./child", MPI_ARGV_NULL, 1, MPI_INFO_NULL, rank, > MPI_COMM_WORLD, &newcomm, &errs) > some wrong occured. I don't quite understand. That is also correct behavior. MPI-3.1 section 2.4, p11:42-45 initially defines the term "collective": ----- collective A procedure is collective if all processes in a process group need to invoke the procedure. A collective call may or may not be synchronizing. Collective calls over the same communicator must be executed in the same order by all members of the process group. ----- MPI_COMM_SPAWN is a collective operation in that all processes in the communicator come together to perform one action (i.e., spawn one or more children). Put differently: you cannot invoke MPI_COMM_SPAWN in one process in a communicator without also invoking it (with the same parameters) in all others processes in the same communicator. -- Jeff Squyres jsquy...@cisco.com _______________________________________________ users mailing list users@lists.open-mpi.org https://rfd.newmexicoconsortium.org/mailman/listinfo/users