MPI_COMM_GET_PARENT(3)
π MPI_COMM_GET_PARENT π
okay bestie, so this is a page from the Open MPI manual, section 3 (that's the library-functions section, iykyk). The whole thing is literally just MPI_Comm_get_parent β it hands you back the parent intercommunicator of whatever process you're running in right now. That's it. That's the whole vibe. π¦
β¨ SYNTAX β¨
π C Syntax
#include <mpi.h>
int MPI_Comm_get_parent(MPI_Comm *parent)
π Fortran Syntax
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_COMM_GET_PARENT(PARENT, IERROR)
INTEGER PARENT, IERROR
π Fortran 2008 Syntax
USE mpi_f08
MPI_Comm_get_parent(parent, ierror)
TYPE(MPI_Comm), INTENT(OUT) :: parent
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
π OUTPUT PARAMETERS π
- parent β the parent communicator (handle). bestie this is the whole point of the function π
- ierror β Fortran only, it's the error status (integer).
πΈ DESCRIPTION πΈ
so like, if a process got started with MPI_Comm_spawn or MPI_Comm_spawn_multiple, then MPI_Comm_get_parent gives you back the "parent" intercommunicator of the current process. iconic. This parent intercommunicator gets created implicitly, deep inside MPI_Init β no cap, it just exists β and it's literally the same intercommunicator that the spawn call over in the parent returns. same one. twins. π«Ά
if the process wasn't spawned at all? then MPI_Comm_get_parent hands you MPI_COMM_NULL. nothing. void. π
and if the parent communicator has been freed or disconnected? yeah, MPI_Comm_get_parent returns MPI_COMM_NULL too. gone. ghosted. π»
β NOTES β
MPI_Comm_get_parent returns a handle to one single intercommunicator. calling it a second time? returns a handle to the same intercommunicator. no new one, no duplicates, same girl. β¨
but heads up bestie β if you free that handle withMPI_Comm_disconnectorMPI_Comm_free, all the other references to that intercommunicator go invalid. dangling. like, don't use them. π
also in case you were wondering: calling MPI_Comm_free on the parent communicator is not useful. so like, don't bother. π
π ERRORS π
almost all MPI routines return an error value, periodt. C routines give it back as the return result of the function, and Fortran routines put it in that last argument.
before the error value comes back, the current MPI error handler associated with the communication object (think communicator, window, file) gets called. and if there's no communication object attached to the MPI call? then the call counts as attached to MPI_COMM_SELF and it calls the associated MPI error handler. when MPI_COMM_SELF isn't initialized (which means: before MPI_Init/MPI_Init_thread, after MPI_Finalize, or when you're 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 you're on the World model, or via the mpi_initial_errhandler CLI argument to mpiexec, or the info key to MPI_Comm_spawn/MPI_Comm_spawn_multiple. and if no other appropriate error handler has been set: the MPI_ERRORS_RETURN error handler gets called for MPI I/O functions, and the MPI_ERRORS_ABORT error handler gets called for all other MPI functions. slay π
π Open MPI ships three predefined error handlers π
MPI_ERRORS_ARE_FATALβ causes the program to abort all connected MPI processes. everyone. gone. πMPI_ERRORS_ABORTβ an error handler you can invoke 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. (yes, only the local one. main character energy, lowkey.)MPI_ERRORS_RETURNβ returns an error code to the application. nice and chill. π
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
fr fr, note that MPI does not guarantee that an MPI program can continue past an error. like, that's it, that's the end of the road. π
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 info.
π¦ See also π¦
MPI_Comm_spawnMPI_Comm_spawn_multiple
π Copyright π
2003-2026, The Open MPI Community
okay and that's the whole page bestie, we ate and left no crumbs π β this was MPI_COMM_GET_PARENT(3) from the Open MPI manual, dated Sep 10, 2026, copyright 2003-2026, The Open MPI Community. go spawn something. πβ¨π«Ά
π¦ 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