---
name: "MPI_Waitall"
section: "3"
platform: "linux"
package: "openmpi"
version: "5.0.11-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/MPI_Waitall"
---

# MPI\_Waitall(3)

*MPI\_Waitall* — Waits for all given communications to complete.

## SYNTAX

### C Syntax

```
#include <mpi.h>
int MPI_Waitall(int count, MPI_Request array_of_requests[],
     MPI_Status *array_of_statuses)
```

### Fortran Syntax

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

### Fortran 2008 Syntax

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

## INPUT PARAMETERS

- •

  **count**: Lists length (integer).

- •

  **array\_of\_requests**: Array of requests (array of handles).

## OUTPUT PARAMETERS

- •

  **array\_of\_statuses**: Array of status objects (array of status).

- •

  **ierror**: Fortran only: Error status (integer).

## DESCRIPTION

Blocks until all communication operations associated with active handles in the list complete, and returns the status of all these operations (this includes the case where no handle in the list is active). Both arrays have the same number of valid entries. The ith entry in array\_of\_statuses is set to the return status of the ith operation. Requests that were created by nonblocking communication operations are deallocated, and the corresponding handles in the array are set to MPI\_REQUEST\_NULL. The list may contain null or inactive handles. The call sets to empty the status of each such entry.

The error-free execution of MPI\_Waitall(count, array\_of\_requests, array\_of\_statuses) has the same effect as the execution of MPI\_Wait(&array\_of\_request\[i\], &array\_of\_statuses\[i\]), for i=0,…,count-1, in some arbitrary order. *MPI\_Waitall* with an array of length 1 is equivalent to *MPI\_Wait*.

When one or more of the communications completed by a call to *MPI\_Waitall* fail, it is desirable to return specific information on each communication. The function *MPI\_Waitall* will return in such case the error code MPI\_ERR\_IN\_STATUS and will set the error field of each status to a specific error code. This code will be MPI\_SUCCESS if the specific communication completed; it will be another specific error code if it failed; or it can be MPI\_ERR\_PENDING if it has neither failed nor completed. The function *MPI\_Waitall* will return MPI\_SUCCESS if no request had an error, or will return another error code if it failed for other reasons (such as invalid arguments). In such cases, it will not update the error fields of the statuses.

If your application does not need to examine the *array\_of\_statuses* field, you can save resources by using the predefined constant MPI\_STATUSES\_IGNORE can be used as a special value for the *array\_of\_statuses* argument.

## 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.

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.

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

- •

  **MPI\_ERRORS\_ARE\_FATAL** Causes the program to abort all connected MPI processes.

- •

  **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, 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, aborts only the local process.

- •

  **MPI\_ERRORS\_RETURN** Returns an error code to the application.

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.

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\_Waitall*, 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). However, *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).

If the invoked error handler allows *MPI\_Waitall* 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\_Testall*

- •

  *MPI\_Testany*

- •

  *MPI\_Testsome*

- •

  *MPI\_Wait*

- •

  *MPI\_Waitany*

- •

  *MPI\_Waitsome*

- •

  *MPI\_Win\_set\_errhandler*

## COPYRIGHT

2003-2026, The Open MPI Community
