MPIX_Grequest_class_create(3)
๐ MPIX_Grequest_class_create(3) ๐
okay bestie, welcome to the MPI manual, section 3, and today's main character is MPIX_Grequest_class_create. yes it's a whole mouthful, no i will not be pronouncing it, we're just gonna vibe with it ๐ซถ
โจ NAME โจ
MPIX_Grequest_class_create โ [short description]
๐ธ SYNOPSIS ๐ธ
int MPIX_Grequest_class_create(MPI_Grequest_query_function *query_fn,
MPI_Grequest_free_function *free_fn,
MPI_Grequest_cancel_function *cancel_fn,
MPIX_Grequest_poll_function *poll_fn,
MPIX_Grequest_wait_function *wait_fn,
MPIX_Grequest_class *greq_class)
๐ INPUT PARAMETERS ๐
so you're handing it a little squad of callback functions, each one a function. here's the lineup:
query_fnโ the callback that gets invoked when the request status is queried (function) ๐free_fnโ the callback that gets invoked when the request is freed (function) ๐๏ธcancel_fnโ the callback that gets invoked when the request is cancelled (function) ๐poll_fnโ the callback that gets invoked when request completion is tested (function) โณwait_fnโ the callback that gets invoked when the request is waited on (function) ๐ง
๐ OUTPUT PARAMETERS ๐
greq_classโ generalized request class (None) โจ there it is, the thing you came for
๐ฅ THREAD AND INTERRUPT SAFETY ๐ฅ
good news: this routine is thread-safe. that means you can literally let multiple threads use it at the same time, and you do not need to bring your own thread locks. no gatekeeping, no drama, it just works ๐
but โ and this is the part where i hold your hand โ it is not interrupt safe. typically that's because it uses memory allocation routines like malloc, or other non-MPICH runtime routines, that are themselves not interrupt-safe. so like, thread safe: yes. interrupt safe: absolutely not, bestie ๐ญ
๐ NOTES FOR FORTRAN ๐
- every MPI routine in Fortran (except for
MPI_WTIMEandMPI_WTICK) has an extra argumentierrtacked on the end of the argument list.ierris an integer and means the exact same thing as the return value of the routine in C. also, in Fortran, MPI routines are subroutines and you invoke them with thecallstatement ๐ - all MPI objects (e.g.,
MPI_Datatype,MPI_Comm) are of typeINTEGERin Fortran ๐งฎ
๐ ERRORS ๐
okay so every MPI routine (except MPI_Wtime and MPI_Wtick) returns an error value โ C routines give it back as the value of the function, and Fortran routines put it in that last argument. before that value comes back, the current MPI error handler gets called. and by default? that error handler aborts the MPI job. like, whole thing, gone, bye ๐ญ
you can swap the error handler out:
MPI_Comm_set_errhandlerโ for communicatorsMPI_File_set_errhandlerโ for filesMPI_Win_set_errhandlerโ for RMA windows
and yeah, the MPI-1 routine MPI_Errhandler_set may be used, but heads up: its use is deprecated. old news, don't do it ๐ซ
you can also use the predefined error handler MPI_ERRORS_RETURN to make error values actually get returned to you instead. and note this: MPI does not guarantee that an MPI program can continue past an error. however, MPI implementations will attempt to continue whenever possible ๐ซถ
here's the error codes, no cap:
MPI_SUCCESSโ no error; the 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_OTHERโ other error; useMPI_Error_stringto get more information about this error code ๐ง
ngl bestie, if you got MPI_ERR_ARG it's not giving "mystery", it's giving "check your arguments" ๐
and that's the whole page, you ate it, periodt ๐
this was the MPI manual, section 3 โ MPIX_Grequest_class_create(3) โ dated 4/10/2026. take care of your generalized requests and they'll take care of you ๐โจ๐๐ฆ๐ธ
๐ฆ 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