#include "autopack.h" int AP_send_begin(void)
Tells the library that the user code is about to begin a batch of sends. The library will then internally keep track of how many sends go to each destination. After doing the sends, call AP_recv_count() to initiate an asynchronous global reduction to determine how many incoming message to expect.
It is an error to call AP_send_begin() again before AP_recv_count() indicates the reduction is complete.
This routine will free space (via AP_check_sends()) from any previous sends that are complete.
Returns the number of reductions since the library was initialized. It can be used as a tag for the subsequent sends. When the maximum tag number has been reached, the count will wrap around to 0.
The general organization of user code should be as follows. Each processor calls AP_send_begin(), then does some sends, then calls AP_send_end(). Then it loops calling AP_recv(), blocking if desired (but using the AP_DROPOUT flag if blocking). AP_recv_count() will indicate when the loop should terminate. It is not necessary to synchronize the processors at any point during this process.