MPI_Allreduce_init(3)
β¨ MPI_Allreduce_init β¨
okay bestie so this is a page from the MPI manual β the C one, MPI_Allreduce_init(3) β and it's literally about creating a persistent request for allreduce. π
πΈ NAME πΈ
MPI_Allreduce_init β Create a persistent request for allreduce π«Ά
π SYNOPSIS π
int MPI_Allreduce_init(const void *sendbuf, void *recvbuf, int count,
MPI_Datatype datatype, MPI_Op op, MPI_Comm comm,
MPI_Info info, MPI_Request *request)
int MPI_Allreduce_init_c(const void *sendbuf, void *recvbuf, MPI_Count count,
MPI_Datatype datatype, MPI_Op op, MPI_Comm comm,
MPI_Info info, MPI_Request *request)
π INPUT PARAMETERS π
okay so these are the things you hand in, no take-backs:
sendbufβ starting address of send buffer (choice) π€countβ number of elements in send buffer (non-negative integer, so likeβ¦ zero or more, no negativity allowed) π’datatypeβ data type of elements of send buffer (handle)opβ operation (handle)commβ communicator (handle)infoβ info argument (handle)
π¦ OUTPUT PARAMETERS π¦
and these are the ones that come back out to you, lil gift π:
recvbufβ starting address of receive buffer (choice)requestβ communication request (handle)
π THREAD AND INTERRUPT SAFETY π
so this routine is thread-safe, periodt. that means it's literally fine to have multiple threads using it at the same time, and nobody needs to bring their own thread locks β the routine handles that. πͺ
BUT β and this is the important part bestie β it is not interrupt safe. π¨ typically that's because of memory allocation routines like malloc, or other non-MPICH runtime routines, which are themselves not interrupt-safe. so likeβ¦ not it. π
π NOTES FOR FORTRAN π
- Every single MPI routine in Fortran (except for
MPI_WTIMEandMPI_WTICK) gets an extra argument calledierrslapped onto the end of the argument list.ierris an integer and it means the same thing as the return value of the routine in C. iykyk. β¨ - In Fortran, MPI routines are subroutines, and you invoke them with the
callstatement. classic. - All MPI objects (e.g.,
MPI_Datatype,MPI_Comm) are of typeINTEGERin Fortran. yes really. π§
π ERRORS π
okay so story time: all MPI routines (except MPI_Wtime and MPI_Wtick) return an error value β C routines give it as the value of the function, and Fortran routines put it in that last argument. and before the value even comes back to you, the current MPI error handler gets called. π
by default, that error handler aborts the MPI job. no second chances. π
you can change the error handler with:
MPI_Comm_set_errhandlerβ for communicatorsMPI_File_set_errhandlerβ for filesMPI_Win_set_errhandlerβ for RMA windows
the MPI-1 routine MPI_Errhandler_set may be used, but its use is deprecated β so like, don't, unless you must. π«
there's also a predefined error handler called MPI_ERRORS_RETURN that you can use to make error values get 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β¦ maybe it works, maybe it doesn't. vibe check inconclusive. π«
here's the full error roster, no skips:
MPI_SUCCESSβ No error; MPI routine completed successfully. π₯³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_INFOβ Invalid InfoMPI_ERR_OPβ Invalid operation. MPI operations (objects of typeMPI_Op) must either be one of the predefined operations (e.g.,MPI_SUM) or created withMPI_Op_create.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.
and that's the whole page, you ate that fr fr π β¨
so basically β this page is from the MPI manual, dated 4/10/2026, and it's the page for MPI_Allreduce_init(3). go forth and reduce, 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