29 #define TIMPI_LOG_SCOPE(f,c) 49 _request(null_request),
50 post_wait_work(nullptr)
55 post_wait_work(nullptr)
59 _request(other._request),
60 post_wait_work(other.post_wait_work)
123 TIMPI_LOG_SCOPE(
"wait()",
"Request");
132 #ifdef TIMPI_HAVE_MPI 155 #ifdef TIMPI_HAVE_MPI 159 (MPI_Test (&
_request, &val, MPI_STATUS_IGNORE));
164 timpi_assert_equal_to (val, 1);
173 #ifdef TIMPI_HAVE_MPI 179 (MPI_Test (&
_request, &val, &stat));
198 new_prior_req->_prior_request.reset(this->
_prior_request.release());
208 std::pair<std::vector <PostWaitWork * >,
unsigned int>
209 (std::vector <PostWaitWork * >(), 1);
213 void wait (std::vector<Request> & r)
219 std::size_t
waitany (std::vector<Request> & r)
221 timpi_assert(!r.empty());
223 int r_size = cast_int<int>(r.size());
224 std::vector<request> raw(r_size);
225 int non_null = r_size;
226 for (
int i=0; i != r_size; ++i)
233 raw[i] = *root->
get();
236 non_null = std::min(non_null,i);
239 if (non_null == r_size)
240 return std::size_t(-1);
242 int index = non_null;
244 #ifdef TIMPI_HAVE_MPI 245 bool only_priors_completed =
false;
251 (MPI_Waitany(r_size, raw.data(), &index, MPI_STATUS_IGNORE));
253 timpi_assert_not_equal_to(index, MPI_UNDEFINED);
255 timpi_assert_less(index, r_size);
257 Request * completed = &r[index];
264 only_priors_completed =
true;
286 raw[index] = *next->
get();
288 }
while(only_priors_completed);
void add_prior_request(const Request &req)
MPI_Request request
Request object for non-blocking I/O.
static const request null_request
std::unique_ptr< Request > _prior_request
An abstract base class that can be subclassed to allow other code to perform work after a MPI_Wait su...
void add_post_wait_work(PostWaitWork *work)
Encapsulates the MPI_Request.
std::size_t waitany(std::vector< Request > &r)
Wait for at least one non-blocking operation to finish.
Status wait(Request &r)
Wait for a non-blocking send or receive to finish.
Encapsulates the MPI_Status struct.
std::pair< std::vector< PostWaitWork *>, unsigned int > * post_wait_work
Request & operator=(const Request &other)