MPI_INTERCOMM_CREATE(3)
π MPI_INTERCOMM_CREATE(3) β the Open MPI glow-up
okay bestie, buckle up π this one's from the Open MPI manual, section 3, and it's literally about making two separate friend groups talk to each other. main character energy fr fr.
β¨ NAME β¨
MPI_Intercomm_create β creates an intercommunicator from two intracommunicators π«Ά
β¨ SYNTAX β¨
πΈ C Syntax
#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 *newintercomm)
πΈ Fortran Syntax
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_INTERCOMM_CREATE(LOCAL_COMM, LOCAL_LEADER, PEER_COMM,
REMOTE_LEADER, TAG, NEWINTERCOMM, IERROR)
INTEGER LOCAL_COMM, LOCAL_LEADER, PEER_COMM, REMOTE_LEADER
INTEGER TAG, NEWINTERCOMM, IERROR
πΈ Fortran 2008 Syntax
USE mpi_f08
MPI_Intercomm_create(local_comm, local_leader, peer_comm, remote_leader,
tag, newintercomm, ierror)
TYPE(MPI_Comm), INTENT(IN) :: local_comm, peer_comm
INTEGER, INTENT(IN) :: local_leader, remote_leader, tag
TYPE(MPI_Comm), INTENT(OUT) :: newintercomm
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
π INPUT PARAMETERS π
local_commβ the communicator that has the process starting the whole inter-communication thing off (it's a handle, not a vibe) πlocal_leaderβ rank of the local group's leader insidelocal_comm(integer)peer_commβ the "peer" communicator, and heads up: it only actually matters at thelocal_leader(handle). like, everyone else can just chill πremote_leaderβ rank of the remote group's leader inpeer_comm; again, significant only at thelocal_leader(integer)tagβ the message tag that ID's this brand-new intercommunicator (integer) π·οΈ
π OUTPUT PARAMETERS π
newintercommβ the freshly created intercommunicator (handle) β¨ slay, you made a baby communicatorierrorβ Fortran only: error status (integer)
π¦ DESCRIPTION π¦
so this call creates an intercommunicator. it's collective over the union of the local and remote groups β meaning everybody in both groups is in on it, no lurkers π
processes are supposed to pass identical local_comm and local_leader arguments within each group. and no, wildcards are not permitted for remote_leader, local_leader, and tag. none. zero. don't even try it π
this call uses point-to-point communication over the communicator peer_comm, and with the tag tag between the leaders. so lowkey be careful β there must be no pending communication on peer_comm that could interfere with this communication. like, don't leave messages on read while this is running π«Ά
if you're making multiple MPI_Intercomm_creates, they should each use different tags (more precisely β the local and remote leaders should be sure they're using different tags for each MPI_intercomm_create). one tag per intercomm, no sharing, periodt.
π NOTES π
we recommend using a dedicated peer communicator, like a duplicate of MPI_COMM_WORLD, to avoid trouble with peer communicators. give it its own space, it deserves it π
okay so here's the drama π the MPI 1.1 Standard contains two mutually exclusive comments on the input intracommunicators:
- one says their respective groups must be disjoint
- the other says the leaders can be the same process
after much discussion by the MPI Forum, the verdict is in: the groups must be disjoint. and ngl, the reason given for this in the standard is not the actual reason for this choice β the real tea is that the other operations on intercommunicators (like MPI_Intercomm_merge) just don't make sense if the groups aren't disjoint. iykyk π€·ββοΈ
π ERRORS π
almost all MPI routines return an error value β C routines hand it back as the return result of the function, and Fortran routines stick it in the last argument. iconic behavior fr.
before that error value comes back, the current MPI error handler associated with the communication object (e.g., communicator, window, file) gets called. if there's no communication object associated with the MPI call, then the call is considered attached to MPI_COMM_SELF and will call the associated MPI error handler. when MPI_COMM_SELF isn't initialized (i.e., before MPI_Init/MPI_Init_thread, after MPI_Finalize, or when using the Sessions Model exclusively) the error raises the initial error handler. and that initial error handler can be changed by:
- calling
MPI_Comm_set_errhandleronMPI_COMM_SELFwhen using the World model - the
mpi_initial_errhandlerCLI argument tompiexec - the info key to
MPI_Comm_spawn/MPI_Comm_spawn_multiple
if no other appropriate error handler has been set, then the MPI_ERRORS_RETURN error handler is called for MPI I/O functions, and the MPI_ERRORS_ABORT error handler is called for all other MPI functions. rules are rules π
Open MPI includes three predefined error handlers you can use:
MPI_ERRORS_ARE_FATALβ causes the program to abort all connected MPI processes. dramatic? yes. correct? also yes πMPI_ERRORS_ABORTβ an error handler that can be invoked on a communicator, window, file, or session. when called on a communicator, it acts as ifMPI_Abortwas called on that communicator. if called on a window or file, it acts as ifMPI_Abortwas called on a communicator containing the group of processes in the corresponding window or file. if called on a session, it aborts only the local process. context-aware king πMPI_ERRORS_RETURNβ returns an error code to the application π«Ά
MPI applications can also implement their own error handlers by calling:
MPI_Comm_create_errhandlerthenMPI_Comm_set_errhandlerMPI_File_create_errhandlerthenMPI_File_set_errhandlerMPI_Session_create_errhandlerthenMPI_Session_set_errhandleror atMPI_Session_initMPI_Win_create_errhandlerthenMPI_Win_set_errhandler
β οΈ note that MPI does not guarantee that an MPI program can continue past an error. no cap, that's just how it is π
see the MPI man page for a full list of MPI error codes, and see the Error Handling section of the MPI-3.1 standard for more information. go read it, bestie, it's giving homework but it's worth it π
π SEE ALSO
MPI_Intercomm_mergeMPI_Comm_freeMPI_Comm_remote_groupMPI_Comm_remote_size
π COPYRIGHT π
2003-2026, The Open MPI Community
and that's the whole page, bestie πβ¨ this was filed under Open MPI, dated Sep 11, 2026, and the copyright belongs to The Open MPI Community, 2003-2026. you're so welcome, go forth and intercommunicate ππ¦
π¦ where this page comes from
- arch rolling: openmpi 5.0.11-1 Β· BSD-3-Clause AND LicenseRef-MPICH
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms