source: XIOS/dev/branch_openmp/extern/src_ep_dev/ep_type.cpp @ 1359

Last change on this file since 1359 was 1359, checked in by yushan, 6 years ago

unify MPI_Comm type, add missing file

File size: 3.3 KB
Line 
1#include "ep_lib.hpp"
2#include <mpi.h>
3#include "ep_declaration.hpp"
4#include <iostream>
5#include <fstream>
6#include "ep_mpi.hpp"
7
8using namespace std;
9
10
11namespace ep_lib
12{ 
13 
14  ep_intercomm::ep_intercomm()
15  {
16    intercomm_rank_map = NULL;
17    local_rank_map = NULL;
18    remote_rank_map = NULL;
19    mpi_inter_comm = new ::MPI_Comm;
20  }
21
22  bool ep_intercomm::operator == (ep_intercomm right)
23  {
24    bool a = intercomm_rank_map == right.intercomm_rank_map;
25    bool b = local_rank_map == right.local_rank_map;
26    bool c = remote_rank_map == right.remote_rank_map;
27    bool d = *(static_cast< ::MPI_Comm*>(mpi_inter_comm)) == *(static_cast< ::MPI_Comm*>(right.mpi_inter_comm));
28    bool e = size_rank_info == right.size_rank_info;
29    bool f = intercomm_tag == right.intercomm_tag;
30    return a&&b&&c&&d&&e&&f;
31  }
32
33  bool ep_intercomm::operator != (ep_intercomm right)
34  {
35    bool a = intercomm_rank_map != right.intercomm_rank_map;
36    bool b = local_rank_map != right.local_rank_map;
37    bool c = remote_rank_map != right.remote_rank_map;
38    bool d = *(static_cast< ::MPI_Comm*>(mpi_inter_comm)) != *(static_cast< ::MPI_Comm*>(right.mpi_inter_comm));
39    bool e = size_rank_info != right.size_rank_info;
40    bool f = intercomm_tag != right.intercomm_tag;
41    return a||b||c||d||e||f;
42  }
43
44  ep_communicator::ep_communicator()
45  {
46    comm_list = NULL;
47    message_queue = NULL;
48    intercomm = NULL;
49  }
50
51
52  bool ep_communicator::operator == (ep_communicator right)
53  {
54    bool a = size_rank_info == right.size_rank_info;
55    bool b = comm_label == right.comm_label;
56    bool c = intercomm == right.intercomm;
57    return a&&b&&c;
58  }
59
60  bool ep_communicator::operator != (ep_communicator right)
61  {
62    bool a = size_rank_info != right.size_rank_info;
63    bool b = comm_label != right.comm_label;
64    bool c = intercomm != right.intercomm;
65    return a||b||c;
66  }
67
68  MPI_Comm::MPI_Comm()
69  {
70    is_ep = true;
71    is_intercomm = false;
72    my_buffer = NULL;
73    ep_barrier = NULL;
74    rank_map = NULL;
75    ep_comm_ptr = NULL;
76    mem_bridge = NULL;
77    mpi_bridge = NULL;
78    mpi_comm = new ::MPI_Comm;
79  }
80
81 
82
83  MPI_Comm::MPI_Comm(void* comm)
84  {
85    is_ep = false;
86    is_intercomm = false;
87    my_buffer = NULL;
88    ep_barrier = NULL;
89    rank_map = NULL;
90    ep_comm_ptr = NULL;
91    mem_bridge = NULL;
92    mpi_bridge = NULL;
93    mpi_comm = new ::MPI_Comm;
94    *(static_cast< ::MPI_Comm*>(mpi_comm)) = *(static_cast< ::MPI_Comm*>(comm));
95  }
96
97 
98
99  bool MPI_Comm::operator == (MPI_Comm right)
100  {
101    bool a = is_ep == right.is_ep;
102    bool b = is_intercomm == right.is_intercomm;
103    bool c = *(static_cast< ::MPI_Comm*>(mpi_comm)) == *(static_cast< ::MPI_Comm*>(right.mpi_comm));
104    bool d = is_ep ? ep_comm_ptr == right.ep_comm_ptr : true;
105    return a&&b&&c&&d;
106  }
107
108  bool MPI_Comm::operator != (MPI_Comm right)
109  {
110    bool a = is_ep != right.is_ep;
111    bool b = is_intercomm != right.is_intercomm;
112    bool c = *(static_cast< ::MPI_Comm*>(mpi_comm)) != *(static_cast< ::MPI_Comm*>(right.mpi_comm));
113    bool d = is_ep ? ep_comm_ptr != right.ep_comm_ptr : true;
114    return a||b||c||d;
115  }
116
117  bool MPI_Request::operator == (MPI_Request right)
118  {
119    bool b = type == right.type;
120    bool c = buf == right.buf;
121    bool d = ep_src == right.ep_src;
122    bool e = ep_tag == right.ep_tag;
123    bool f = ep_datatype == right.ep_datatype;
124    return b&&c&&d&&e&&f;
125  }
126
127
128}
129
130
131
132
133
134
135
136
137
Note: See TracBrowser for help on using the repository browser.