MPI_Ibcast(3)

πŸ“¦
version 5.0.1 Β· 5 versions
, in nixos 26.05, ubuntu stonking

πŸ’– 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 in buffer (non-negative integer, and yes that means zero is on the table).
  • datatype β€” data type of buffer (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 of buffer (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 in MPI_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 uncommitted MPI_Datatype (see MPI_Type_commit) is used in a communication call.
  • MPI_ERR_OTHER β€” Other error; use MPI_Error_string to get more information about this error code.

🌟 quick vibe check: the one thing to remember is that MPI_Ibcast hands you back a request and 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