Changeset 1355 for XIOS/dev/branch_openmp/extern
- Timestamp:
- 12/05/17 16:24:42 (6 years ago)
- Location:
- XIOS/dev/branch_openmp/extern
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_openmp/extern/remap/src/mapper.hpp
r1328 r1355 18 18 { 19 19 public: 20 Mapper(ep_lib::MPI_Comm comm) : communicator(comm), verbose(SILENT), neighbourElements(NULL), sstree(comm) {} 20 //Mapper(ep_lib::MPI_Comm comm) : communicator(comm), verbose(SILENT), neighbourElements(NULL), sstree(comm) {} 21 Mapper(ep_lib::MPI_Comm comm) : verbose(SILENT), neighbourElements(NULL), sstree(comm) 22 { 23 ep_lib::MPI_Comm_dup(comm, &communicator); 24 } 25 21 26 ~Mapper(); 22 27 void setVerbosity(verbosity v) {verbose=v ;} -
XIOS/dev/branch_openmp/extern/remap/src/mpi_cascade.hpp
r1328 r1355 12 12 { 13 13 public: 14 CCascadeLevel(ep_lib::MPI_Comm comm) : comm(comm)14 CCascadeLevel(ep_lib::MPI_Comm in_comm) : comm(in_comm) 15 15 { 16 ep_lib::MPI_Comm_dup(in_comm, &comm); 16 17 ep_lib::MPI_Comm_size(comm, &size); 17 18 ep_lib::MPI_Comm_rank(comm, &rank); -
XIOS/dev/branch_openmp/extern/remap/src/parallel_tree.cpp
r1335 r1355 121 121 } 122 122 123 //CParallelTree::CParallelTree(MPI_Comm comm) : communicator(comm), cascade(MIN_NODE_SZ*MIN_NODE_SZ, comm) 124 CParallelTree::CParallelTree(MPI_Comm comm) : communicator(comm), cascade(MAX_NODE_SZ*MAX_NODE_SZ*2, comm) 125 { 126 treeCascade.reserve(cascade.num_levels); 127 for (int lev = 0; lev < cascade.num_levels; lev++) 128 treeCascade.push_back(CSampleTree(cascade.level[lev].group_size, assignLevel)); 123 //CParallelTree::CParallelTree(MPI_Comm comm) : communicator(comm), cascade(MIN_NODE_SZ*MIN_NODE_SZ*2, comm) 124 CParallelTree::CParallelTree(MPI_Comm comm) : cascade(MAX_NODE_SZ*MAX_NODE_SZ*2, comm) 125 { 126 MPI_Comm_dup(comm, &communicator); 127 treeCascade.reserve(cascade.num_levels); 128 for (int lev = 0; lev < cascade.num_levels; lev++) 129 treeCascade.push_back(CSampleTree(cascade.level[lev].group_size, assignLevel)); 129 130 } 130 131 -
XIOS/dev/branch_openmp/extern/src_ep_dev/ep_create.cpp
r1354 r1355 179 179 180 180 181 int MPI_Comm_create_endpoints( void* base_comm_ptr, int num_ep, MPI_Info info, MPI_Comm *& out_comm_hdls)181 int MPI_Comm_create_endpoints(int* base_comm_ptr, int num_ep, MPI_Info info, MPI_Comm *& out_comm_hdls) 182 182 { 183 183 … … 199 199 out_comm_hdls[idx].is_ep = true; 200 200 out_comm_hdls[idx].is_intercomm = false; 201 out_comm_hdls[idx].ep_comm_ptr = new ep_communicator; 202 out_comm_hdls[idx].mpi_comm =base_comm_ptr;201 out_comm_hdls[idx].ep_comm_ptr = new ep_communicator; 202 *(out_comm_hdls[idx].mpi_comm) = *base_comm_ptr; 203 203 out_comm_hdls[idx].ep_comm_ptr->comm_list = out_comm_hdls; 204 204 out_comm_hdls[idx].ep_comm_ptr->comm_label = 0; -
XIOS/dev/branch_openmp/extern/src_ep_dev/ep_fortran.cpp
r1354 r1355 18 18 Debug("MPI_Comm_c2f"); 19 19 int fint; 20 #ifdef _intelmpi20 //#ifdef _intelmpi 21 21 fint = (::MPI_Fint)(to_mpi_comm(comm.mpi_comm)); 22 #elif _openmpi23 fint = ::MPI_Comm_c2f(to_mpi_comm(comm.mpi_comm));24 #endif22 //#elif _openmpi 23 //fint = ::MPI_Comm_c2f(to_mpi_comm(comm.mpi_comm)); 24 //#endif 25 25 26 26 std::map<std::pair<int, int>, MPI_Comm > ::iterator it; … … 60 60 61 61 62 #ifdef _openmpi63 ::MPI_Comm base_comm = ::MPI_Comm_f2c(comm);64 #elif _intelmpi62 //#ifdef _openmpi 63 //::MPI_Comm base_comm = ::MPI_Comm_f2c(comm); 64 //#elif _intelmpi 65 65 ::MPI_Comm *base_comm = new ::MPI_Comm; 66 66 *base_comm = (::MPI_Comm)(comm); 67 #endif67 //#endif 68 68 69 if( base_comm != static_cast< ::MPI_Comm* >(MPI_COMM_NULL.mpi_comm))69 if(*base_comm != to_mpi_comm(MPI_COMM_NULL.mpi_comm)) 70 70 { 71 71 if(omp_get_thread_num() == 0) -
XIOS/dev/branch_openmp/extern/src_ep_dev/ep_intercomm_world.cpp
r1354 r1355 538 538 539 539 // #elif _intelmpi 540 int MPI_Intercomm_create_from_world(MPI_Comm local_comm, int local_leader, void* peer_comm_ptr, int mpi_remote_leader, int tag, MPI_Comm *newintercomm)540 int MPI_Intercomm_create_from_world(MPI_Comm local_comm, int local_leader, int* peer_comm_ptr, int mpi_remote_leader, int tag, MPI_Comm *newintercomm) 541 541 { 542 542 int ep_rank, ep_rank_loc, mpi_rank; -
XIOS/dev/branch_openmp/extern/src_ep_dev/ep_lib.cpp
r1354 r1355 246 246 } 247 247 248 MPI_Comm to_mpi_comm( void* comm)248 MPI_Comm to_mpi_comm(int* comm) 249 249 { 250 return *(static_cast< MPI_Comm* >(comm));250 return static_cast< MPI_Comm >(*comm); 251 251 } 252 252 -
XIOS/dev/branch_openmp/extern/src_ep_dev/ep_lib.hpp
r1354 r1355 11 11 namespace ep_lib 12 12 { 13 #ifdef _intelmpi13 //#ifdef _intelmpi 14 14 typedef int MPI_Datatype; 15 15 typedef int MPI_Op; 16 #define EP_ANY_SOURCE -217 #define EP_ANY_TAG -118 #elif _openmpi19 typedef void* MPI_Datatype;20 typedef void* MPI_Op;21 #define EP_ANY_SOURCE -122 #define EP_ANY_TAG -123 #endif16 // #define EP_ANY_SOURCE -2 17 // #define EP_ANY_TAG -1 18 //#elif _openmpi 19 // typedef void* MPI_Datatype; 20 // typedef void* MPI_Op; 21 // #define EP_ANY_SOURCE -1 22 // #define EP_ANY_TAG -1 23 //#endif 24 24 25 25 int MPI_Init_thread(int* argc, char*** argv, int required, int*provided); … … 49 49 // #endif 50 50 51 int MPI_Comm_create_endpoints( void* base_comm_ptr, int num_ep, MPI_Info info, MPI_Comm *& out_comm_hdls); // from EP to create endpoints51 int MPI_Comm_create_endpoints(int* base_comm_ptr, int num_ep, MPI_Info info, MPI_Comm *& out_comm_hdls); // from EP to create endpoints 52 52 53 53 int MPI_Send(void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm); -
XIOS/dev/branch_openmp/extern/src_ep_dev/ep_lib_intercomm.hpp
r1354 r1355 41 41 // #endif 42 42 43 int MPI_Intercomm_create_from_world(MPI_Comm local_comm, int local_leader, void* peer_comm_ptr, int mpi_remote_leader, int tag, MPI_Comm *newintercomm);43 int MPI_Intercomm_create_from_world(MPI_Comm local_comm, int local_leader, int* peer_comm_ptr, int mpi_remote_leader, int tag, MPI_Comm *newintercomm); 44 44 45 45 int MPI_Intercomm_create_unique_leader(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm *newintercomm); -
XIOS/dev/branch_openmp/extern/src_ep_dev/ep_message.cpp
r1347 r1355 38 38 39 39 40 #ifdef _openmpi40 //#ifdef _openmpi 41 41 #pragma omp critical (_mpi_call) 42 42 { … … 51 51 } 52 52 } 53 #elif _intelmpi 54 #pragma omp critical (_mpi_call) 55 { 56 ::MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, to_mpi_comm(comm.mpi_comm), &flag, &status); 57 if(flag) 58 { 59 Debug("find message in mpi comm \n"); 60 mpi_source = status.MPI_SOURCE; 61 int tag = status.MPI_TAG; 62 ::MPI_Mprobe(mpi_source, tag, to_mpi_comm(comm.mpi_comm), &message, &status); 63 64 } 65 } 66 //::MPI_Improbe(MPI_ANY_SOURCE, MPI_ANY_TAG, to_mpi_comm(comm.mpi_comm), &flag, &message, &status); 67 #endif 53 //#elif _intelmpi 54 //#pragma omp critical (_mpi_call) 55 //{ 56 // ::MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, to_mpi_comm(comm.mpi_comm), &flag, &status); 57 // if(flag) 58 // { 59 // Debug("find message in mpi comm \n"); 60 // mpi_source = status.MPI_SOURCE; 61 // int tag = status.MPI_TAG; 62 // ::MPI_Mprobe(mpi_source, tag, to_mpi_comm(comm.mpi_comm), &message, &status); 63 // } 64 //} 65 //#endif 68 66 69 67 if(flag) … … 118 116 Debug("Message probing for intracomm\n"); 119 117 120 #ifdef _openmpi118 //#ifdef _openmpi 121 119 #pragma omp critical (_mpi_call) 122 120 { … … 131 129 } 132 130 } 133 #elif _intelmpi 134 #pragma omp critical (_mpi_call) 135 { 136 ::MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, to_mpi_comm(comm.ep_comm_ptr->intercomm->mpi_inter_comm), &flag, &status); 137 if(flag) 138 { 139 Debug("find message in mpi comm \n"); 140 mpi_source = status.MPI_SOURCE; 141 int tag = status.MPI_TAG; 142 ::MPI_Mprobe(mpi_source, tag, to_mpi_comm(comm.ep_comm_ptr->intercomm->mpi_inter_comm), &message, &status); 143 144 } 145 } 146 //::MPI_Improbe(MPI_ANY_SOURCE, MPI_ANY_TAG, to_mpi_comm(comm.ep_comm_ptr->intercomm->mpi_inter_comm), &flag, &message, &status); 147 #endif 131 148 132 149 133 if(flag) … … 185 169 Debug("Message probing for intracomm\n"); 186 170 187 #ifdef _openmpi171 //#ifdef _openmpi 188 172 #pragma omp critical (_mpi_call) 189 173 { … … 198 182 } 199 183 } 200 #elif _intelmpi 201 #pragma omp critical (_mpi_call) 202 { 203 ::MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, to_mpi_comm(comm.mpi_comm), &flag, &status); 204 if(flag) 205 { 206 Debug("find message in mpi comm \n"); 207 mpi_source = status.MPI_SOURCE; 208 int tag = status.MPI_TAG; 209 ::MPI_Mprobe(mpi_source, tag, to_mpi_comm(comm.mpi_comm), &message, &status); 210 211 } 212 } 213 //::MPI_Improbe(MPI_ANY_SOURCE, MPI_ANY_TAG, to_mpi_comm(comm.mpi_comm), &flag, &message, &status); 214 #endif 184 215 185 216 186 if(flag) -
XIOS/dev/branch_openmp/extern/src_ep_dev/ep_mpi.hpp
r1354 r1355 6 6 MPI_Datatype to_mpi_type(ep_lib::MPI_Datatype type); 7 7 MPI_Op to_mpi_op(ep_lib::MPI_Op op); 8 MPI_Comm to_mpi_comm( void* comm);8 MPI_Comm to_mpi_comm(int* comm); 9 9 10 10 #endif // EP_MPI_HPP_INCLUDED -
XIOS/dev/branch_openmp/extern/src_ep_dev/ep_type.hpp
r1354 r1355 57 57 public: 58 58 59 #ifdef _intelmpi60 59 int ep_datatype; 61 #elif _openmpi62 void * ep_datatype;63 #endif64 65 60 int ep_src; 66 61 int ep_tag; 67 68 69 62 void* mpi_status; 70 63 }; … … 74 67 public: 75 68 76 #ifdef _intelmpi77 69 int mpi_message; 78 #elif _openmpi79 void * mpi_message;80 #endif81 82 70 int ep_src; 83 71 int ep_tag; 84 85 72 void* mpi_status; 86 73 87 74 MPI_Message() {} 88 89 #ifdef _intelmpi90 75 MPI_Message(int message): mpi_message(message) {} 91 #elif _openmpi92 MPI_Message(void* message): mpi_message(message) {}93 #endif94 76 }; 95 77 … … 152 134 public: 153 135 154 155 // #ifdef _intelmpi 156 // int mpi_inter_comm; 157 // #elif _openmpi 158 // void * mpi_inter_comm; 159 // #endif 160 161 void * mpi_inter_comm; 136 int *mpi_inter_comm; 162 137 163 138 RANK_MAP *intercomm_rank_map; … … 172 147 int intercomm_tag; 173 148 174 ep_intercomm() 175 { 176 intercomm_rank_map = NULL; 177 local_rank_map = NULL; 178 remote_rank_map = NULL; 179 } 180 181 182 bool operator == (ep_intercomm right) 183 { 184 bool a = intercomm_rank_map == right.intercomm_rank_map; 185 bool b = local_rank_map == right.local_rank_map; 186 bool c = remote_rank_map == right.remote_rank_map; 187 bool d = mpi_inter_comm == right.mpi_inter_comm; 188 bool e = size_rank_info == right.size_rank_info; 189 bool f = intercomm_tag == right.intercomm_tag; 190 return a&&b&&c&&d&&e&&f; 191 } 192 193 bool operator != (ep_intercomm right) 194 { 195 bool a = intercomm_rank_map != right.intercomm_rank_map; 196 bool b = local_rank_map != right.local_rank_map; 197 bool c = remote_rank_map != right.remote_rank_map; 198 bool d = mpi_inter_comm != right.mpi_inter_comm; 199 bool e = size_rank_info != right.size_rank_info; 200 bool f = intercomm_tag != right.intercomm_tag; 201 return a||b||c||d||e||f; 202 } 149 ep_intercomm(); 150 bool operator == (ep_intercomm right); 151 bool operator != (ep_intercomm right); 152 203 153 204 154 … … 224 174 ep_intercomm *intercomm; 225 175 226 ep_communicator() 227 { 228 comm_list = NULL; 229 message_queue = NULL; 230 intercomm = NULL; 231 } 232 233 bool operator == (ep_communicator right) 234 { 235 bool a = size_rank_info == right.size_rank_info; 236 bool b = comm_label == right.comm_label; 237 bool c = intercomm == right.intercomm; 238 return a&&b&&c; 239 } 240 241 bool operator != (ep_communicator right) 242 { 243 bool a = size_rank_info != right.size_rank_info; 244 bool b = comm_label != right.comm_label; 245 bool c = intercomm != right.intercomm; 246 return a||b||c; 247 } 248 176 ep_communicator(); 177 bool operator == (ep_communicator right); 178 bool operator != (ep_communicator right); 179 249 180 }; 250 181 … … 259 190 { 260 191 public: 261 262 // #ifdef _intelmpi263 // int mpi_comm;264 // #elif _openmpi265 // void * mpi_comm;266 // #endif267 268 void * mpi_comm;269 192 270 193 bool is_ep; … … 274 197 OMPbarrier *ep_barrier; 275 198 RANK_MAP *rank_map; 276 199 int* mpi_comm; 277 200 EP_Comm ep_comm_ptr; 278 279 201 MPI_Comm *mem_bridge; 280 281 282 // #ifdef _intelmpi 283 // int mpi_bridge; 284 // #elif _openmpi 285 // void * mpi_bridge; 286 // #endif 287 288 void * mpi_bridge; 289 290 MPI_Comm() 291 { 292 is_ep = true; 293 is_intercomm = false; 294 my_buffer = NULL; 295 ep_barrier = NULL; 296 rank_map = NULL; 297 ep_comm_ptr = NULL; 298 mem_bridge = NULL; 299 mpi_bridge = NULL; 300 } 301 302 // #ifdef _intelmpi 303 // MPI_Comm(int comm) 304 // { 305 // is_ep = false; 306 // is_intercomm = false; 307 // my_buffer = NULL; 308 // ep_barrier = NULL; 309 // rank_map = NULL; 310 // ep_comm_ptr = NULL; 311 // mem_bridge = NULL; 312 // mpi_bridge = NULL; 313 // mpi_comm = comm; 314 // } 315 316 // #elif _openmpi 317 318 // MPI_Comm(void* comm) 319 // { 320 // is_ep = false; 321 // is_intercomm = false; 322 // my_buffer = NULL; 323 // ep_barrier = NULL; 324 // rank_map = NULL; 325 // ep_comm_ptr = NULL; 326 // mem_bridge = NULL; 327 // mpi_bridge = NULL; 328 // mpi_comm = comm; 329 // } 330 // #endif 331 332 MPI_Comm(void* comm) 333 { 334 is_ep = false; 335 is_intercomm = false; 336 my_buffer = NULL; 337 ep_barrier = NULL; 338 rank_map = NULL; 339 ep_comm_ptr = NULL; 340 mem_bridge = NULL; 341 mpi_bridge = NULL; 342 mpi_comm = comm; 343 } 344 345 bool operator == (MPI_Comm right) 346 { 347 bool a = is_ep == right.is_ep; 348 bool b = is_intercomm == right.is_intercomm; 349 bool c = mpi_comm == right.mpi_comm; 350 bool d = is_ep ? ep_comm_ptr == right.ep_comm_ptr : true; 351 return a&&b&&c&&d; 352 } 353 354 bool operator != (MPI_Comm right) 355 { 356 bool a = is_ep != right.is_ep; 357 bool b = is_intercomm != right.is_intercomm; 358 bool c = mpi_comm != right.mpi_comm; 359 bool d = is_ep ? ep_comm_ptr != right.ep_comm_ptr : true; 360 361 return a||b||c||d; 362 } 363 202 int* mpi_bridge; 203 204 MPI_Comm(); 205 //MPI_Comm(const MPI_Comm &comm); 206 MPI_Comm(int* comm); 207 208 209 bool operator == (MPI_Comm right); 210 bool operator != (MPI_Comm right); 364 211 bool is_null(); 365 212 … … 371 218 public: 372 219 373 #ifdef _intelmpi374 220 int mpi_info; 375 #elif _openmpi376 void * mpi_info;377 #endif378 221 379 222 MPI_Info(){ } 380 381 #ifdef _intelmpi382 223 MPI_Info(int info): mpi_info(info) {} 383 #elif _openmpi384 MPI_Info(void* info): mpi_info(info) {}385 #endif386 224 }; 387 225 … … 391 229 public: 392 230 393 #ifdef _intelmpi394 231 int mpi_request; 395 #elif _openmpi396 void * mpi_request;397 #endif398 232 399 233 int type; //! type of the non-blocking communication. 1: Isend; 2:Irecv; 3:Imrecv; 4:Issend … … 402 236 int ep_src; 403 237 int ep_tag; 404 #ifdef _intelmpi405 238 int ep_datatype; 406 #elif _openmpi407 void * ep_datatype;408 #endif409 239 410 240 MPI_Comm comm; //! EP communicator related to the communication 411 241 412 242 MPI_Request() {} 413 414 #ifdef _intelmpi415 243 MPI_Request(int request): mpi_request(request) {} 416 #elif _openmpi 417 MPI_Request(void* request): mpi_request(request) {} 418 #endif 419 420 421 bool operator == (MPI_Request right) 422 { 423 //bool a = mpi_request == right.mpi_request; 424 bool b = type == right.type; 425 bool c = buf == right.buf; 426 bool d = ep_src == right.ep_src; 427 bool e = ep_tag == right.ep_tag; 428 bool f = ep_datatype == right.ep_datatype; 429 return b&&c&&d&&e&&f; 430 } 244 bool operator == (MPI_Request right); 245 431 246 }; 432 247
Note: See TracChangeset
for help on using the changeset viewer.