MPI_STATUS_SET_CANCELLED(3)

πŸ’… MPI_STATUS_SET_CANCELLED(3) β€” the Open MPI glow-up

okay bestie, welcome to the MPI_STATUS_SET_CANCELLED page ✨ this is an Open MPI manpage and honestly? it's a little niche but we're gonna get through it together 🫢


🌸 NAME 🌸

MPI_Status_set_cancelled β€” sets a status so it says "yeah, that request got canceled" πŸ’…


✨ SYNTAX ✨

πŸŽ€ C Syntax

#include <mpi.h>

int MPI_Status_set_cancelled(MPI_Status *status, int flag)

πŸŽ€ Fortran Syntax

USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_STATUS_SET_CANCELLED(STATUS, FLAG, IERROR)
     INTEGER STATUS(MPI_STATUS_SIZE), IERROR
     LOGICAL FLAG

πŸŽ€ Fortran 2008 Syntax

USE mpi_f08
MPI_Status_set_cancelled(status, flag, ierror)
     TYPE(MPI_Status), INTENT(INOUT) :: status
     LOGICAL, INTENT(OUT) :: flag
     INTEGER, OPTIONAL, INTENT(OUT) :: ierror

πŸ¦‹ INPUT/OUTPUT PARAMETER πŸ¦‹

  • status β€” the status where we're attaching this cancel flag, bestie (it's the status one, yeah). πŸ”₯

πŸ“ INPUT PARAMETER πŸ“

  • flag β€” if it's true, that means the request was canceled, periodt (it's a logical). πŸ’–

🌈 OUTPUT PARAMETER 🌈

  • ierror β€” Fortran only: the error status, as an integer. 🧚

πŸ‘‘ DESCRIPTION πŸ‘‘

so here's the tea: if flag is set to true, then a later call to MPI_Test_cancelled(status, flag*) will also hand you back flag = true. otherwise it's gonna return false. that's it, that's the whole vibe. ⭐


πŸ’€ NOTES πŸ’€

lowkey important, don't skip this one πŸ™ˆ

users are advised not to reuse the status fields for values other than the ones they were actually intended for. like, not me watching you repurpose a status field 😭 doing that may lead to unexpected results when you're using the status object. for example, calling MPI_Get_elements may cause an error if the value is out of range β€” or it may be straight up impossible to detect that kind of error πŸ’€

the extra_state argument that comes with a generalized request is the move if you need to return info that doesn't logically belong in status. and also?? modifying the values in a status that MPI set internally, like from MPI_Recv, may lead to unpredictable results and is strongly discouraged. like please don't, i'm begging 🫢


😭 ERRORS 😭

almost all MPI routines return an error value, bestie β€” C routines give it back as the return result of the function, and Fortran routines put it in the last argument. iykyk.

before that error value comes back, the current MPI error handler associated with the communication object (think: communicator, window, file) gets called. if there's no communication object associated with the MPI call, then the call counts as attached to MPI_COMM_SELF and it'll call the associated MPI error handler. when MPI_COMM_SELF isn't initialized (i.e., before MPI_Init/MPI_Init_thread, after MPI_Finalize, or when you're using the Sessions Model exclusively), the error raises the initial error handler. and you can change that initial error handler by calling MPI_Comm_set_errhandler on MPI_COMM_SELF when you're using the World model, or with the mpi_initial_errhandler CLI argument to mpiexec or the info key to MPI_Comm_spawn/MPI_Comm_spawn_multiple. if no other appropriate error handler has been set, then the MPI_ERRORS_RETURN error handler is called for MPI I/O functions and the MPI_ERRORS_ABORT error handler is called for all other MPI functions.

Open MPI includes three predefined error handlers you can use, and they are:

  • MPI_ERRORS_ARE_FATAL β€” causes the program to abort all connected MPI processes. yeah. all of them. πŸ’€
  • MPI_ERRORS_ABORT β€” an error handler that can be invoked on a communicator, window, file, or session. when it's called on a communicator, it acts as if MPI_Abort was called on that communicator. if it's called on a window or file, it acts as if MPI_Abort was called on a communicator containing the group of processes in the corresponding window or file. and if it's called on a session, it aborts only the local process. ✨
  • MPI_ERRORS_RETURN β€” returns an error code to the application. the chill one. 🫢

MPI applications can also implement their own error handlers by calling:

  • MPI_Comm_create_errhandler then MPI_Comm_set_errhandler
  • MPI_File_create_errhandler then MPI_File_set_errhandler
  • MPI_Session_create_errhandler then MPI_Session_set_errhandler or at MPI_Session_init
  • MPI_Win_create_errhandler then MPI_Win_set_errhandler

note that MPI does not guarantee that an MPI program can continue past an error. so like… don't count on it, bestie 😭

see the MPI man page for a full list of MPI error codes. πŸ“–

see the Error Handling section of the MPI-3.1 standard for more information. ⭐


2003-2026, The Open MPI Community β€” iconic of them, honestly πŸ‘‘


and that's the whole page!! okay so this was MPI_STATUS_SET_CANCELLED(3) from the Open MPI girlies, dated Sep 11, 2026, copyright 2003-2026, The Open MPI Community β€” go forth and set those cancelled flags correctly, bestie πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from