Class SweepSendWindow

Class Documentation

class SweepSendWindow

Per-rank limit on posted sweep sends that have not completed.

A rendezvous send holds a slot in the network transmit queue until the receiver matches it. When a rank posts more sends than that queue holds, MPI can block inside the send call, and two ranks blocked that way toward each other deadlock. A sender asks the window for slots before it posts a unit of sends and returns them when the sends complete. The rank has no more sends posted than the limit, except that a unit larger than the limit is posted alone when no other send is outstanding.

The angle sets of one groupset share a window. Groupsets sweep one at a time and every sweep completes its sends before it returns, so the window bounds all posted sweep sends of the rank.

Public Functions

inline explicit SweepSendWindow(int max_outstanding_sends)

Window that admits at most max_outstanding_sends posted sends, or one larger unit alone.

Parameters:

max_outstanding_sends – Maximum number of posted sends that have not completed. Zero means no limit.

Throws:

std::invalid_argument – If max_outstanding_sends is negative.

inline bool TryAcquire(int count)

Reserve slots for one unit of sends.

A unit is admitted when no sends are outstanding, even if it is larger than the limit, so every unit is eventually posted.

Parameters:

count – Number of sends in the unit.

Throws:

std::invalid_argument – If count is not positive.

Returns:

True if the slots were reserved and the unit may be posted.

inline void Release(int count)

Return the slots of completed sends.

Parameters:

count – Number of sends that completed.

Throws:

std::logic_error – If count is negative or exceeds the outstanding sends.

inline int GetNumOutstanding() const

Return the number of sends that are posted and not completed.