MPI_Intercomm_create_from_groups(3)
π MPI_Intercomm_create_from_groups(3) π
okay bestie, welcome to the MPI manual, this one is MPI_Intercomm_create_from_groups, and it's literally the function that builds you an intercommuncator (yes that's the page's own spelling, we respect the typo era π«Ά) out of a local group and a remote group. no cap.
β¨ SYNOPSIS β¨
int MPI_Intercomm_create_from_groups(MPI_Group local_group, int local_leader,
MPI_Group remote_group, int remote_leader,
const char *stringtag, MPI_Info info,
MPI_Errhandler errhandler,
MPI_Comm *newintercomm)
πΈ INPUT PARAMETERS πΈ
local_groupβ the local group, as a handle. your side of the story πlocal_leaderβ rank of the local group leader insidelocal_group(an integer).remote_groupβ the remote group, handle. and listen: this one is significant only atlocal_leader, so everybody else can just vibe, it's giving "only the leader's opinion matters" energy πremote_leaderβ rank of the remote group leader insideremote_group(integer). also significant only atlocal_leader. same deal, bestie.stringtagβ a unique identifier for this operation, and it's a string (not an int, we're fancy now β¨).infoβ info object (handle).errhandlerβ the error handler that's gonna be attached to the brand-new inter-communicator (handle).
π OUTPUT PARAMETERS π
newintercommβ the new inter-communicator (handle). the glow-up. the main character. π
π¦ THREAD AND INTERRUPT SAFETY π¦
good news first: this routine is thread-safe. that means you can absolutely use it from multiple threads at the same time, and you do not need to bring your own thread locks. slay.
bad news, or like, the fine print: it is not interrupt safe. usually that's because of memory allocation routines β stuff like malloc, or other non-MPICH runtime routines β which are themselves not interrupt-safe. so yeah. not interrupt safe, periodt.
π NOTES FOR FORTRAN π
every MPI routine in Fortran (except our two icons, MPI_WTIME and MPI_WTICK) gets an extra argument called ierr tacked on at the end of the argument list. ierr is an integer and it means exactly the same thing as the return value of the routine in C. also, in Fortran, MPI routines are subroutines and you invoke them with the call statement. iykyk.
and every MPI object (like MPI_Datatype, MPI_Comm) is type INTEGER in Fortran. that's the whole bit.
π ERRORS π
so, every MPI routine (again, except the duo MPI_Wtime and MPI_Wtick) returns an error value β C routines as the return value of the function, Fortran routines in that last argument. and before that value comes back, the current MPI error handler gets called. by default, that error handler aborts the MPI job. π so like, mind the vibes.
you can swap the error handler with:
MPI_Comm_set_errhandlerβ for communicatorsMPI_File_set_errhandlerβ for filesMPI_Win_set_errhandlerβ for RMA windows
there's also the MPI-1 routine MPI_Errhandler_set, which you may use, but its use is deprecated π (we don't do that anymore bestie). and if you want error values returned instead of the whole job going poof, there's the predefined error handler MPI_ERRORS_RETURN.
ngl, MPI does not guarantee that an MPI program can continue past an error. however, MPI implementations will attempt to continue whenever possible. so like, sometimes it works out. sometimes it does not.
the roster of error codes, in order:
MPI_SUCCESSβ no error, the routine completed successfully. we ate. πMPI_ERR_ARGβ invalid argument. some argument is invalid and it isn't identified by a specific error class (e.g.MPI_ERR_RANK). mysterious. unlabeled. annoying.MPI_ERR_GROUPβ a null or invalid group got passed to the function.MPI_ERR_INFOβ invalid Info.MPI_ERR_OTHERβ other error; useMPI_Error_stringto get more information about this error code. go read the receipts. π
and that's the whole page babe π«Ά this one came straight out of the MPI manual, MPI version of the page MPI_Intercomm_create_from_groups(3), dated 4/10/2026. go build some inter-communicators, you're doing amazing sweetie. β¨ππ¦πΈπ
π¦ where this page comes from
- nixos 26.05: mpich 5.0.1
- ubuntu stonking: mpich-doc 5.0.1-9 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms