MPI_Ibcast(3)
π MPI_Ibcast(3) β the MPI manual, bestie edition π
okay so, real talk: this page lives in the MPI manual, section 3, and it's all about MPI_Ibcast. Pull up a chair, grab a boba π§, and let's get into it.
β¨ NAME β¨
MPI_Ibcast β broadcasts a message from the process with rank "root" to all other processes of the communicator, but in a nonblocking way. yes bestie, nonblocking. it does NOT sit there waiting. it's giving "I'll text you back later" energy. π
π¦ SYNOPSIS π¦
int MPI_Ibcast(void *buffer, int count, MPI_Datatype datatype, int root,
MPI_Comm comm, MPI_Request *request)
int MPI_Ibcast_c(void *buffer, MPI_Count count, MPI_Datatype datatype, int root,
MPI_Comm comm, MPI_Request *request)
two flavors, same vibe: the regular one and the _c one that takes an MPI_Count instead. π
πΈ INPUT PARAMETERS πΈ
countβ number of entries inbuffer(non-negative integer, and yes that means zero is on the table).datatypeβ data type ofbuffer(a handle).rootβ rank of the broadcast root (integer). this is the main character of the group chat, the one everybody else is copying from. π£commβ communicator (a handle).
π INPUT/OUTPUT PARAMETERS π
bufferβ starting address ofbuffer(choice). it's both an input and an output, so it's pulling double duty, iconic behavior honestly.
β OUTPUT PARAMETERS β
requestβ communication request (a handle). this is your little receipt π§Ύ, your "we'll deal with this later" token.
π₯ THREAD AND INTERRUPT SAFETY π₯
This routine is thread-safe. Translation: multiple threads can use it at the same time and you do not need to bring your own thread locks. No cap. π«Ά
BUT. and this is the important but β the routine is not interrupt safe. Typically this is because it uses memory allocation routines like malloc, or other non-MPICH runtime routines, and those things are themselves not interrupt-safe. so like, thread-safe yes, interrupt-safe no, don't get it twisted. π
π NOTES FOR FORTRAN π
All MPI routines in Fortran (except for MPI_WTIME and MPI_WTICK) have an additional argument ierr at the end of the argument list. ierr is an integer and has the same meaning as the return value of the routine in C. In Fortran, MPI routines are subroutines, and they're invoked with the call statement.
All MPI objects (e.g., MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. periodt. π
π ERRORS π
All MPI routines (except MPI_Wtime and MPI_Wtick) return an error value; C routines as the value of the function, and Fortran routines in the last argument. Before that value is returned, the current MPI error handler is called. By default, this error handler aborts the MPI job. π³ so yeah, the default is not a gentle little "oopsie".
The error handler may be changed with:
MPI_Comm_set_errhandler(for communicators)MPI_File_set_errhandler(for files)MPI_Win_set_errhandler(for RMA windows)
The MPI-1 routine MPI_Errhandler_set may be used, but its use is deprecated. π« (we don't do that anymore, bestie.)
The predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned instead.
Note that MPI does not guarantee that an MPI program can continue past an error; however, MPI implementations will attempt to continue whenever possible. so like, they'll try, but no promises. π
Here's the error code lineup:
MPI_SUCCESSβ No error; MPI routine completed successfully. π the dream.MPI_ERR_ARGβ Invalid argument. Some argument is invalid and is not identified by a specific error class (e.g.,MPI_ERR_RANK).MPI_ERR_BUFFERβ Invalid buffer pointer. Usually a null buffer where one is not valid.MPI_ERR_COMMβ Invalid communicator. A common error is to use a null communicator in a call (not even allowed inMPI_Comm_rank).MPI_ERR_COUNTβ Invalid count argument. Count arguments must be non-negative; a count of zero is often valid.MPI_ERR_TYPEβ Invalid datatype argument. Additionally, this error can occur if an uncommittedMPI_Datatype(seeMPI_Type_commit) is used in a communication call.MPI_ERR_OTHERβ Other error; useMPI_Error_stringto get more information about this error code.
π quick vibe check: the one thing to remember is thatMPI_Ibcasthands you back arequestand then dips β you're responsible for dealing with that request later. ikyk. π
okay that's the whole page, you ate it, go forth and broadcast π¦π
this was the MPI manual, page for MPI_Ibcast(3), dated 4/10/2026. mwah, bye bestie! πβ¨
π¦ 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