MPI_Comm_create_from_group(3)
π MPI_Comm_create_from_group(3) π
okay so bestie, welcome to the MPI manual page for MPI_Comm_create_from_group β yes it's a C function, yes it's section 3, yes we're doing this. grab a lil snack π because this one is actually kinda iconic: it creates a communicator from a group. that's the whole vibe. let's get into it β¨
β¨ NAME β¨
MPI_Comm_create_from_group β create communicator from a group π«Ά
πΈ SYNOPSIS πΈ
int MPI_Comm_create_from_group(MPI_Group group, const char *stringtag,
MPI_Info info, MPI_Errhandler errhandler,
MPI_Comm *newcomm)
like. look at her. five arguments. main character energy fr fr π
π INPUT PARAMETERS π
groupβ the group, she's a handle πstringtagβ a unique identifier for this operation, and it's a string, so yes it's giving "name your child" energy, pick something distinct no capinfoβ an info object, handle, we love hererrhandlerβ the error handler that gets attached to the new intra-communicator (handle). not a regular communicator, an intra-communicator. precision bestie π
π OUTPUT PARAMETERS π
newcommβ the new communicator (handle). there she is!! the moment we've all been waiting for ππ
β THREAD AND INTERRUPT SAFETY β
okay this part is important so pay attention bestie:
this routine is thread-safe. what that means: multiple threads can safely use it, and nobody needs to bring their own user-provided thread locks. no gatekeeping, no extra work, slay π§
however β and this is the plot twist π β the routine is not interrupt safe. typically that's because it uses memory allocation routines like malloc, or other non-MPICH runtime routines, and those are themselves not interrupt-safe. so like, it's giving "safe with friends, not safe when interrupted". noted. periodt.
π NOTES FOR FORTRAN π
for my Fortran besties, here's the tea π«:
- All MPI routines in Fortran have an additional argument
ierrat the end of the argument list β with two exceptions:MPI_WTIMEandMPI_WTICK. those two are just built different, iykyk. ierris an integer and means exactly the same thing as the return value of the routine in C.- In Fortran, MPI routines are subroutines, and you invoke them with the
callstatement. - All MPI objects (e.g.
MPI_Datatype,MPI_Comm) are of typeINTEGERin Fortran. yes literally all of them. that's just the rule π
π ERRORS π
okay so every MPI routine returns an error value β with the exception of MPI_Wtime and MPI_Wtick (again!! those two mfs π). in C, the error value is the value of the function; in Fortran, it's in the last argument.
before that value comes back, the current MPI error handler gets called. and by default? this error handler aborts the MPI job. like, full stop, done, goodbye π so maybe keep that in mind.
the error handler can be changed with:
MPI_Comm_set_errhandlerβ for communicatorsMPI_File_set_errhandlerβ for filesMPI_Win_set_errhandlerβ for RMA windows
and the MPI-1 routine MPI_Errhandler_set may still be used, but its use is deprecated β so like, technically yes, but girl don't π«. the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned instead.
β οΈ important caveat bestie: MPI does not guarantee that an MPI program can continue past an error. that said, MPI implementations will attempt to continue whenever possible. so it's giving "we try our best, no promises" π«Ά
here are the error codes, in all their glory:
MPI_SUCCESSβ no error, the MPI routine completed successfully. the dream. the fantasy. we love to see it β¨MPI_ERR_ARGβ invalid argument. some argument is invalid and it's not identified by a specific error class (e.g.MPI_ERR_RANK). like, one of your args is sus and nobody's saying which πMPI_ERR_GROUPβ null or invalid group passed to the function. check ur group bestie.MPI_ERR_INFOβ invalid Info. the info object said no π«MPI_ERR_OTHERβ other error; useMPI_Error_stringto get more information about this error code. the mysterious one. the enigma. go askMPI_Error_stringfor the lore π
and that's the whole page, babe π huge slay, you read a whole manpage, I'm so proud π
π this has been MPI_Comm_create_from_group(3) from the MPI manual, dated 4/10/2026. love u, go build a communicator, bye bestieee ππ¦π
π¦ 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