MPI_TESTALL(3)

πŸ’… MPI_TESTALL(3) β€” Open MPI, bestie edition ✨

okay so this is the MPI_TESTALL page from Open MPI, and honestly? it's giving "did all my little communication babies finish yet?" energy. let's get into it 🫢


🌸 SYNTAX 🌸

✨ C Syntax

#include <mpi.h>

int MPI_Testall(int count, MPI_Request array_of_requests[],
     int *flag, MPI_Status array_of_statuses[])

πŸ’– Fortran Syntax

USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_TESTALL(COUNT, ARRAY_OF_REQUESTS, FLAG, ARRAY_OF_STATUSES,
             IERROR)
     LOGICAL FLAG
     INTEGER COUNT, ARRAY_OF_REQUESTS(*)
     INTEGER ARRAY_OF_STATUSES(MPI_STATUS_SIZE,*), IERROR

πŸ¦‹ Fortran 2008 Syntax

USE mpi_f08
MPI_Testall(count, array_of_requests, flag, array_of_statuses, ierror)
     INTEGER, INTENT(IN) :: count
     TYPE(MPI_Request), INTENT(INOUT) :: array_of_requests(count)
     LOGICAL, INTENT(OUT) :: flag
     TYPE(MPI_Status) :: array_of_statuses(*)
     INTEGER, OPTIONAL, INTENT(OUT) :: ierror

πŸŽ€ INPUT PARAMETERS πŸŽ€

  • count β€” the length of the list, bestie. it's an integer. πŸ’…
  • array_of_requests β€” your array of requests, aka an array of handles. this is the lineup.

🌈 OUTPUT PARAMETERS 🌈

  • flag β€” true if the previously initiated communications are complete. logical, iconic, yes/no energy. ✨
  • array_of_statuses β€” an array of status objects (array of status). the receipts, basically. 🧾
  • ierror β€” Fortran only: the error status, an integer. πŸ™ˆ

πŸ’œ DESCRIPTION πŸ’œ

okay so the vibe: it returns flag = true if all the communications tied to the active handles in your array have completed β€” and yes, that includes the case where literally no handle in the list is active. like, zero active handles still counts as "all done," slay. πŸ’€

when that happens, each status entry that corresponds to an active handle request gets set to the status of the corresponding communication. and if the request was allocated by a nonblocking communication call, it gets deallocated and the handle is set to MPI_REQUEST_NULL. meanwhile, every status entry that corresponds to a null or inactive handle gets set to empty. clean. πŸŽ€

otherwise β€” meaning flag = false is returned β€” no request is modified and the values of the status entries are undefined. not "empty," not "zero," undefined. don't be out here reading them, i'm serious. 😭

this whole thing is a local operation, btw. no cap.

if your app does not need to examine the array_of_statuses field, you can save resources, because the predefined constant MPI_STATUSES_IGNORE can be used as a special value for the array_of_statuses argument. free real estate. 🫢

and errors that happened during the execution of MPI_Testall? those are handled in the same manner as errors in MPI_Waitall. same rules, same drama. πŸ’…


✨ NOTE ✨

flag is true only if all requests have completed. otherwise flag is false, and neither array_of_requests nor array_of_statuses is modified. like, hands off. don't touch. 🚫


πŸ’€ ERRORS πŸ’€

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

before the error value is returned, the current MPI error handler associated with the communication object (e.g., communicator, window, file) is called. if no communication object is associated with the MPI call, then the call is considered attached to MPI_COMM_SELF and will call the associated MPI error handler. when MPI_COMM_SELF is not initialized (i.e., before MPI_Init/MPI_Init_thread, after MPI_Finalize, or when using the Sessions Model exclusively), the error raises the initial error handler. 😳

the initial error handler can be changed by calling MPI_Comm_set_errhandler on MPI_COMM_SELF when using the World model, or the mpi_initial_errhandler CLI argument to mpiexec or 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. that's just how it is. πŸ’…

Open MPI includes three predefined error handlers that can be used:

  • MPI_ERRORS_ARE_FATAL β€” causes the program to abort ALL connected MPI processes. everyone. gone. πŸ’€
  • MPI_ERRORS_ABORT β€” an error handler that can be invoked on a communicator, window, file, or session. when called on a communicator, it acts as if MPI_Abort was called on that communicator. if 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. if called on a session, it aborts only the local process. rude but okay. 🫠
  • 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. like, it might just not. so don't build your whole personality on it surviving. 😭

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. πŸ“š

for each invocation of MPI_Testall, if one or more requests generate an MPI error, only the first MPI request that caused an error will be passed to its corresponding error handler. no other error handlers will be invoked (even if multiple requests generated errors). BUT β€” all requests that generate an error will have a relevant error code set in the corresponding status.MPI_ERROR field (unless MPI_STATUSES_IGNORE was used, ofc). so the info is still there, bestie. πŸŽ€

if the invoked error handler allows MPI_Testall to return to the caller, the value MPI_ERR_IN_STATUS will be returned in the C and Fortran bindings. πŸ’…

πŸ‘€ SEE ALSO:

  • MPI_Comm_set_errhandler
  • MPI_File_set_errhandler
  • MPI_Test
  • MPI_Testany
  • MPI_Testsome
  • MPI_Wait
  • MPI_Waitall
  • MPI_Waitany
  • MPI_Waitsome
  • MPI_Win_set_errhandler

2003-2026, The Open MPI Community


and that's the whole page, bestie πŸ’– this was MPI_TESTALL(3) from the Open MPI manual, dated Sep 11, 2026 β€” go forth and test your requests, periodt. πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from