50 | | This mode of operation can be integrated into a hybrid task-based application by instantiating a task to open the epoch on the NAM window with `MPI_Win_fence`, followed by multiple concurrent tasks that write or read data to/from the NAM window, and finally, another task to close the access epoch. |
51 | | Notice that tasks can define the corresponding dependencies on the window to ensure this order of execution, as in the following example: |
| 50 | This mode of operation can be integrated into a hybrid task-based application by instantiating a task to open the epoch on the NAM window with an MPI fence, followed by multiple concurrent tasks that write or read data to/from the NAM window, and finally, another task closing the access epoch with another fence. |
| 51 | Notice that tasks can define the corresponding dependencies on the window to ensure this order of execution. |
| 52 | |
| 53 | In order to support this taskification, the fences should be managed by the TAMPI library to perform it efficiently and safely. |
| 54 | We have extended the !ParaStation MPI to provide a new non-blocking function called MPI_Win_ifence that performs that starts a fence operation on a specific window and generates an MPI request to check its completion later. |
| 55 | This MPI request can be then naturally handled by the TAMPI library using the `TAMPI_Iwait` function, as shown below. |
| 80 | |
| 81 | In this example, the first task opens an access epoch on the NAM window using the new `MPI_Win_ifence`. |
| 82 | This function starts a fence operation, generates an MPI request and returns immediately. |
| 83 | This request is then handled by the TAMPI library through the `TAMPI_Iwait`, which bind the completion of the task to the finalization of the fence operation. |
| 84 | The task can continue executing immediately without blocking and finalize its execution. |
| 85 | Once the fence operation finalizes, the task will complete automatically and its successor task will become ready. |
| 86 | The successors are the tasks that perform `MPI_Put` operations on the window in parallel. |
| 87 | Notice that the dependencies of these tasks allow them to execute all `MPI_Put` in parallel, always after the window epoch has been opened. |
| 88 | After all `MPI_Put` tasks have executed, the last task can run and close the window epoch. |