.. _mpi_startall:


MPI_Startall
============

.. include_body

:ref:`MPI_Startall` |mdash| Starts a collection of requests.


SYNTAX
------


C Syntax
^^^^^^^^

.. code-block:: c

   #include <mpi.h>

   int MPI_Startall(int count, MPI_Request array_of_requests[])


Fortran Syntax
^^^^^^^^^^^^^^

.. code-block:: fortran

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


Fortran 2008 Syntax
^^^^^^^^^^^^^^^^^^^

.. code-block:: fortran

   USE mpi_f08
   MPI_Startall(count, array_of_requests, ierror)
   	INTEGER, INTENT(IN) :: count
   	TYPE(MPI_Request), INTENT(INOUT) :: array_of_requests(count)
   	INTEGER, OPTIONAL, INTENT(OUT) :: ierror


INPUT PARAMETER
---------------
* ``count``: List length (integer).

INPUT/OUTPUT PARAMETER
----------------------
* ``array_of_requests``: Array of requests (array of handle).

OUTPUT PARAMETER
----------------
* ``ierror``: Fortran only: Error status (integer).

DESCRIPTION
-----------

Starts all communications associated with requests in array_of_requests.
A call to MPI_Startall(count, array_of_requests) has the same effect as
calls to :ref:`MPI_Start` (&array_of_requests[i]), executed for i=0 ,...,
count-1, in some arbitrary order.

A communication started with a call to :ref:`MPI_Start` or :ref:`MPI_Startall` is
completed by a call to :ref:`MPI_Wait`, :ref:`MPI_Test`, or one of the derived
functions :ref:`MPI_Waitany`, :ref:`MPI_Testany`, :ref:`MPI_Waitall`, :ref:`MPI_Testall`,
:ref:`MPI_Waitsome`, :ref:`MPI_Testsome` (these are described in Section 3.7.5 of the
`MPI Standard <https://www.mpi-forum.org/docs/>`_, "Multiple
Completions"). The request becomes inactive
after successful completion by such a call. The request is not
deallocated, and it can be activated anew by another :ref:`MPI_Start` or
:ref:`MPI_Startall` call.

A persistent request is deallocated by a call to
:ref:`MPI_Request_free` (see Section 3.7.3 of the `MPI Standard
<https://www.mpi-forum.org/docs/>`_, "Communication Completion").

| The call to :ref:`MPI_Request_free` can occur at any point in the program
  after the persistent request was created. However, the request will be
  deallocated only after it becomes inactive. Active receive requests
  should not be freed. Otherwise, it will not be possible to check that
  the receive has completed. It is preferable, in general, to free
  requests when they are inactive. If this rule is followed, then the
  persistent communication request functions will be invoked in a
  sequence of the form,

| Create (Start Complete)\* Free

where \* indicates zero or more repetitions. If the same communication
object is used in several concurrent threads, it is the user's
responsibility to coordinate calls so that the correct sequence is
obeyed.

A send operation initiated with :ref:`MPI_Start` can be matched with any
receive operation and, likewise, a receive operation initiated with
:ref:`MPI_Start` can receive messages generated by any send operation.


ERRORS
------

.. include:: ./ERRORS.rst

.. seealso::
   * :ref:`MPI_Bsend_init`
   * :ref:`MPI_Rsend_init`
   * :ref:`MPI_Send_init`
   * :ref:`MPI_Ssend_init`
   * :ref:`MPI_Recv_init`
   * :ref:`MPI_Start`
   * :ref:`MPI_Request_free`
