Branch data Line data Source code
1 : : //
2 : : // Class Request
3 : : // A communication request handle for non-blocking communication.
4 : : //
5 : : #include "Communicate/Request.h"
6 : :
7 : : namespace ippl {
8 : : namespace mpi {
9 : :
10 : 0 : Request::~Request() {
11 [ # # ]: 0 : if (request_m != MPI_REQUEST_NULL) {
12 : 0 : this->free();
13 : : }
14 : 0 : }
15 : :
16 : 0 : bool Request::completed() {
17 : 0 : int flag = 0;
18 : :
19 : 0 : Status status;
20 : :
21 : : // MPI_STATUS_IGNORE
22 [ # # ]: 0 : MPI_Request_get_status(request_m, &flag, status);
23 : :
24 [ # # ]: 0 : if (flag != 0) {
25 : : // valid Status instance
26 [ # # ]: 0 : MPI_Test(&request_m, &flag, status);
27 : : } else {
28 : : // Although we free the request, any ongoing communication
29 : : // associated with this request is allowed to complete.
30 [ # # ]: 0 : this->free();
31 : : }
32 : :
33 : 0 : return (flag != 0);
34 : : }
35 : : } // namespace mpi
36 : : } // namespace ippl
|