MPI_INTERCOMM_CREATE(3)
π MPI_INTERCOMM_CREATE π
okay bestie, welcome to the Open MPI man pages, section 3, and today's main character is MPI_Intercomm_create π«Ά
β¨ NAME β¨
MPI_Intercomm_create β makes an intercommunicator out of two intracommunicators. yes. that's the whole vibe. two groups, one bridge, no cap π
πΈ 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 holding the process that kicks off the inter-communication (a handle, bestie).local_leaderβ rank of the local group's leader insidelocal_comm(integer).peer_commβ the "peer" communicator. it only actually means anything at thelocal_leader(handle). the way that it's just ignored everywhere else?? iconic.remote_leaderβ rank of the remote group's leader, measured inpeer_comm. again, only significant at thelocal_leader(integer).tagβ the message tag that identifies this brand-new intercommunicator (integer). it's giving β¨identityβ¨
π¦ OUTPUT PARAMETERS π¦
newintercommβ the freshly created intercommunicator (handle). your baby π₯Ήierrorβ Fortran only: error status (integer).
π DESCRIPTION π
So this call creates an intercommunicator, and it's collective over the union of the local and remote groups β like, everybody's invited to this party. every process should hand in the same local_comm and local_leader arguments within its own group. and listen: wildcards are not permitted for remote_leader, local_leader, and tag. not a single one. periodt.
This call does point-to-point communication using the communicator peer_comm, and it uses tag between the leaders. which means β and this is the important part β you gotta be careful that there's no pending communication sitting on peer_comm that could interfere with this communication. π lowkey a hazard.
If you're making multiple MPI_Intercomm_create calls, they should all use different tags. more precisely: make sure the local and remote leaders are using different tags for each MPI_intercomm_create. don't be out here reusing tags, that's messy.
π NOTES π
We recommend using a dedicated peer communicator, like a duplicate of MPI_COMM_WORLD, so you don't get into trouble with peer communicators. highly suggest. do it for the plot.
Now here's some lore π«: the MPI 1.1 Standard contains two mutually exclusive comments about the input intracommunicators. one says their respective groups must be disjoint; the other says the leaders can be the same process. after the MPI Forum had some discussions, it was decided that the groups must be disjoint. and fun fact β the reason given for this in the standard is not the reason for this choice. the real reason is that the other operations on intercommunicators (like MPI_Intercomm_merge) do not make sense if the groups are not 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 put it in the last argument. classic.
Before that error value is returned, the current MPI error handler associated with the communication object (e.g., communicator, window, file) is called. If no communication object is 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 is not 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. The initial error handler can be changed by calling MPI_Comm_set_errhandler on MPI_COMM_SELF when using the World model, or the mpi_initial_errhandler CLI argument to mpiexec or 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.
Open MPI ships with three predefined error handlers you can use:
MPI_ERRORS_ARE_FATALβ causes the program to abort all connected MPI processes. yeah. everybody. π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.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. so likeβ¦ don't count on it. π«
See the MPI man page for a full list of MPI error codes.
See the Error Handling section of the MPI-3.1 standard for more information.
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, no crumbs left πΈ this was MPI_INTERCOMM_CREATE(3) from the Open MPI crew, dated Sep 10, 2026 β go forth and build your intercommunicators, you absolute legend π
β¨π¦
π¦ where this page comes from
- ubuntu stonking: openmpi-doc 5.0.10-6 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms