MPI_Status_get_source(3)
π MPI_Status_get_source(3) π
okay bestie, welcome to the MPI manual, section 3 β this is the one about MPI_Status_get_source, and no cap, it's a lil cutie. Let's get into it. π¦
β¨ NAME β¨
MPI_Status_get_source β get the MPI_SOURCE field out of the status π
πΈ SYNOPSIS πΈ
int MPI_Status_get_source(const MPI_Status *status, int *source)
π INPUT PARAMETERS π
statusβ the status you're pulling the source rank from, typeStatus. it's giving "tell me who sent this" energy π
π«Ά OUTPUT PARAMETERS π«Ά
sourceβ the rank that's sitting in theMPI_SOURCEfield, typeinteger. that's your answer, bestie β¨
π₯ THREAD AND INTERRUPT SAFETY π₯
This routine is thread-safe. that means multiple threads can use it at the same time, and you do NOT need to bring your own thread locks β it handles that itself, periodt π
BUT. and this is the important part β the routine is not interrupt safe. not interrupt safe!! π typically that's because it uses memory allocation routines like malloc or other non-MPICH runtime routines, and those lil guys are themselves not interrupt-safe. so like, be aware, iykyk π
π NOTES FOR FORTRAN π
okay so every MPI routine in Fortran (except for MPI_WTIME and MPI_WTICK) gets an extra argument ierr tacked on at the end of the argument list. ierr is an integer and it means the exact same thing as the return value of the routine in C. bestie, in Fortran, MPI routines are subroutines, and you invoke them with the call statement. that's just how it is β¨
Also: all MPI objects (like MPI_Datatype, MPI_Comm) are of type INTEGER in Fortran. yes, all of them. iconic behavior honestly π
π 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 that last argument. Before the value comes back to you, the current MPI error handler gets called. By default, this error handler aborts the MPI job. like, the whole thing. gone. π
The error handler can be changed 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 also be used, but its use is deprecated (we don't stan it anymore π). 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β¦ no promises, bestie π«Ά
Here are the error codes:
MPI_SUCCESSβ no error, the MPI routine completed successfully π slayMPI_ERR_OTHERβ some other error; useMPI_Error_stringto get more info about this error code π
and that's the whole page, bestie!! you ate that read π this was the MPI_Status_get_source man page from the MPI manual, dated 4/10/2026 β literally wrote it all down for you. now go get that source rank, main character π¦β¨π
π¦ 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