#include "mpi.h" int MPI_Intercomm_create ( MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm *comm_out )
|local_leader||Rank in local_comm of leader (often 0)
|remote_leader||Rank in peer_comm of remote leader (often 0)
|tag||Message tag to use in constructing intercommunicator; if multiple
MPI_Intercomm_creates are being made, they should use different tags (more
precisely, ensure that the local and remote leaders are using different
tags for each MPI_intercomm_create).
All MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran.
|1) Allocate a send context, an inter||coll context, and an intra-coll context
|2) Send "send_context" and lrank_to_grank list from local comm group||if I'm the local_leader.
|3) If I'm the local leader, then wait on the posted sends and receives||to complete. Post the receive for the remote group information and
wait for it to complete.
|4) Broadcast information received from the remote leader.||. 5) Create the inter_communicator from the information we now have.
|An inter||communicator ends up with three levels of communicators.
The inter-communicator returned to the user, a "collective"
inter-communicator that can be used for safe communications between
local & remote groups, and a collective intra-communicator that can
be used to allocate new contexts during the merge and dup operations.
For the resulting inter-communicator, comm_out
comm_out = inter-communicator comm_out->comm_coll = "collective" inter-communicator comm_out->comm_coll->comm_coll = safe collective intra-communicator
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. Before the value is returned, the current MPI error handler is called. 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. Note that MPI does not guarentee that an MPI program can continue past an error.