communicatorrequest.cc 1.3 KB
Newer Older
1
2
3
4
5
6
7
8
/*
 * @file:   communicatorrequest.cc
 * @author: Jordan P. Lefebvre, lefebvrejp@ornl.gov
 *
 * Created on July 3, 2013, 12:14 PM
 */

#include "communicatorrequest.hh"
9
10
namespace radix {
namespace Private {
11
12
#ifdef USE_MPI

13
14
15
16
MPICommRequest::MPICommRequest()
    : d_request(NULL)
    , d_source(0)
    , d_tag(0) {}
17

18
MPICommRequest::MPICommRequest(MPI_Request *request, int nsource, int ntag,
19
                               MPI_Datatype ntype)
20
21
22
23
    : d_request(request)
    , d_source(nsource)
    , d_tag(ntag)
    , d_type(ntype) {}
24

25
26
27
28
29
MPICommRequest::~MPICommRequest() {
  if (d_request != NULL) {
    MPI_Request_free(d_request);
  }
}  // destructor
30

31
32
33
34
35
CommunicatorStatus MPICommRequest::wait() {
  MPI_Status status;
  int error = MPI_Wait(d_request, &status);
  CommunicatorStatus xstatus(
      MPICommStatus(status, d_source, d_tag, error, d_type));
36

37
38
  return xstatus;
}  // wait
39

40
41
void MPICommRequest::cancel() { MPI_Cancel(d_request); }  // cancel
#endif                                                    /** ifdef USE_MPI **/
42

43
SerialCommRequest::SerialCommRequest() {}
44

45
SerialCommRequest::~SerialCommRequest() {}  // destructor
46

47
48
CommunicatorStatus SerialCommRequest::wait() {
  CommunicatorStatus cstatus;
49

50
51
  return cstatus;
}  // wait
52

53
void SerialCommRequest::cancel() {}  // cancel
54

55
56
}  // namespace Private
}  // namespace radix