Changeset 1503
- Timestamp:
- 05/28/18 17:28:07 (7 years ago)
- Location:
- XIOS/dev/branch_openmp/extern/ep_dev
- Files:
-
- 36 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_openmp/extern/ep_dev/ep_accumulate.cpp
r1500 r1503 12 12 int target_rank, MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win) 13 13 { 14 int target_mpi_rank = win->comm-> rank_map->at(target_rank).second;15 int target_local_rank = win->comm-> rank_map->at(target_rank).first;14 int target_mpi_rank = win->comm->ep_rank_map->at(target_rank).second; 15 int target_local_rank = win->comm->ep_rank_map->at(target_rank).first; 16 16 int num_ep = win->comm->ep_comm_ptr->size_rank_info[1].second; 17 17 if(num_ep==1) … … 27 27 int target_rank, MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win, MPI_Request *request) 28 28 { 29 int target_mpi_rank = win->comm-> rank_map->at(target_rank).second;30 int target_local_rank = win->comm-> rank_map->at(target_rank).first;29 int target_mpi_rank = win->comm->ep_rank_map->at(target_rank).second; 30 int target_local_rank = win->comm->ep_rank_map->at(target_rank).first; 31 31 int num_ep = win->comm->ep_comm_ptr->size_rank_info[1].second; 32 32 ::MPI_Request mpi_request; … … 60 60 int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win) 61 61 { 62 int target_mpi_rank = win->comm-> rank_map->at(target_rank).second;63 int target_local_rank = win->comm-> rank_map->at(target_rank).first;62 int target_mpi_rank = win->comm->ep_rank_map->at(target_rank).second; 63 int target_local_rank = win->comm->ep_rank_map->at(target_rank).first; 64 64 int num_ep = win->comm->ep_comm_ptr->size_rank_info[1].second; 65 65 if(num_ep==1) … … 75 75 int target_count, MPI_Datatype target_datatype, MPI_Op op, MPI_Win win, MPI_Request *request) 76 76 { 77 int target_mpi_rank = win->comm-> rank_map->at(target_rank).second;78 int target_local_rank = win->comm-> rank_map->at(target_rank).first;77 int target_mpi_rank = win->comm->ep_rank_map->at(target_rank).second; 78 int target_local_rank = win->comm->ep_rank_map->at(target_rank).first; 79 79 int num_ep = win->comm->ep_comm_ptr->size_rank_info[1].second; 80 80 ::MPI_Request mpi_request; -
XIOS/dev/branch_openmp/extern/ep_dev/ep_allgather.cpp
r1500 r1503 86 86 for(int i=0; i<ep_size; i++) 87 87 { 88 offset = mpi_displs[comm-> rank_map->at(i).second] + comm->rank_map->at(i).first * sendcount;88 offset = mpi_displs[comm->ep_rank_map->at(i).second] + comm->ep_rank_map->at(i).first * sendcount; 89 89 memcpy(recvbuf + i*sendcount*datasize, tmp_recvbuf+offset*datasize, sendcount*datasize); 90 90 } -
XIOS/dev/branch_openmp/extern/ep_dev/ep_allgatherv.cpp
r1500 r1503 92 92 { 93 93 int extra = 0; 94 for(int j=0, k=0; j<ep_size, k<comm-> rank_map->at(i).first; j++)95 if(comm-> rank_map->at(i).second == comm->rank_map->at(j).second)94 for(int j=0, k=0; j<ep_size, k<comm->ep_rank_map->at(i).first; j++) 95 if(comm->ep_rank_map->at(i).second == comm->ep_rank_map->at(j).second) 96 96 { 97 97 extra += recvcounts[j]; … … 99 99 } 100 100 101 offset = mpi_displs[comm-> rank_map->at(i).second] + extra;101 offset = mpi_displs[comm->ep_rank_map->at(i).second] + extra; 102 102 103 103 memcpy(recvbuf+displs[i]*datasize, tmp_recvbuf+offset*datasize, recvcounts[i]*datasize); -
XIOS/dev/branch_openmp/extern/ep_dev/ep_bcast.cpp
r1500 r1503 57 57 int mpi_rank = comm->ep_comm_ptr->size_rank_info[2].first; 58 58 59 int root_mpi_rank = comm-> rank_map->at(root).second;60 int root_ep_rank_loc = comm-> rank_map->at(root).first;59 int root_mpi_rank = comm->ep_rank_map->at(root).second; 60 int root_ep_rank_loc = comm->ep_rank_map->at(root).first; 61 61 62 62 -
XIOS/dev/branch_openmp/extern/ep_dev/ep_comm.hpp
r1502 r1503 10 10 typedef std::vector< std::pair<int, int> > RANK_MAP; // at(ep_rank) = <ep_rank_local, mpi_rank> 11 11 typedef std::map<int, std::pair<int, int> > EP_RANK_MAP; // key(ep_rank) = <ep_rank_local, mpi_rank> 12 typedef std::vector<std::pair< std::pair<int, int>, std::pair<int, int> > > INTERCOMM_RANK_MAP;12 //typedef std::vector<std::pair< std::pair<int, int>, std::pair<int, int> > > INTERCOMM_RANK_MAP; 13 13 typedef std::list<ep_lib::MPI_Message > Message_list; 14 14 … … 52 52 BUFFER *my_buffer; 53 53 ep_barrier *ep_barrier; 54 RANK_MAP *rank_map; 54 //RANK_MAP *rank_map; 55 EP_RANK_MAP *ep_rank_map; 55 56 void* mpi_comm; 56 57 ep_communicator *ep_comm_ptr; -
XIOS/dev/branch_openmp/extern/ep_dev/ep_compare.cpp
r1500 r1503 11 11 int MPI_Compare_and_swap(const void *origin_addr, const void *compare_addr, void *result_addr, MPI_Datatype datatype, int target_rank, MPI_Aint target_disp, MPI_Win win) 12 12 { 13 int target_mpi_rank = win->comm-> rank_map->at(target_rank).second;14 int target_local_rank = win->comm-> rank_map->at(target_rank).first;13 int target_mpi_rank = win->comm->ep_rank_map->at(target_rank).second; 14 int target_local_rank = win->comm->ep_rank_map->at(target_rank).first; 15 15 int num_ep = win->comm->ep_comm_ptr->size_rank_info[1].second; 16 16 if(num_ep==1) -
XIOS/dev/branch_openmp/extern/ep_dev/ep_create.cpp
r1500 r1503 64 64 out_comm_hdls[0]->my_buffer = new BUFFER; 65 65 66 out_comm_hdls[0]->rank_map = new RANK_MAP; 67 out_comm_hdls[0]->rank_map->resize(ep_size); 66 //out_comm_hdls[0]->rank_map = new RANK_MAP; 67 //out_comm_hdls[0]->rank_map->resize(ep_size); 68 69 out_comm_hdls[0]->ep_rank_map = new EP_RANK_MAP; 70 //out_comm_hdls[0]->ep_rank_map->resize(ep_size); 68 71 69 72 … … 72 75 out_comm_hdls[i]->ep_barrier = out_comm_hdls[0]->ep_barrier; 73 76 out_comm_hdls[i]->my_buffer = out_comm_hdls[0]->my_buffer; 74 out_comm_hdls[i]->rank_map = out_comm_hdls[0]->rank_map; 77 //out_comm_hdls[i]->rank_map = out_comm_hdls[0]->rank_map; 78 out_comm_hdls[i]->ep_rank_map= out_comm_hdls[0]->ep_rank_map; 75 79 } 76 80 … … 92 96 for(int j=0; j<recv_num_ep[i]; j++) 93 97 { 94 out_comm_hdls[0]->rank_map->at(ind) = make_pair(j, i); 98 //out_comm_hdls[0]->rank_map->at(ind) = make_pair(j, i); 99 out_comm_hdls[0]->ep_rank_map->insert(std::pair< int, std::pair<int,int> >(ind, j, i)); 95 100 ind++; 96 101 } -
XIOS/dev/branch_openmp/extern/ep_dev/ep_exscan.cpp
r1500 r1503 253 253 std::vector<int> my_map(mpi_size, 0); 254 254 255 for(int i=0; i<comm-> rank_map->size(); i++) my_map[comm->rank_map->at(i).second]++;255 for(int i=0; i<comm->ep_rank_map->size(); i++) my_map[comm->ep_rank_map->at(i).second]++; 256 256 257 257 for(int i=0; i<mpi_rank; i++) my_src += my_map[i]; -
XIOS/dev/branch_openmp/extern/ep_dev/ep_fetch.cpp
r1500 r1503 11 11 int MPI_Fetch_and_op(const void *origin_addr, void *result_addr, MPI_Datatype datatype, int target_rank, MPI_Aint target_disp, MPI_Op op, MPI_Win win) 12 12 { 13 int target_mpi_rank = win->comm-> rank_map->at(target_rank).second;14 int target_local_rank = win->comm-> rank_map->at(target_rank).first;13 int target_mpi_rank = win->comm->ep_rank_map->at(target_rank).second; 14 int target_local_rank = win->comm->ep_rank_map->at(target_rank).first; 15 15 int num_ep = win->comm->ep_comm_ptr->size_rank_info[1].second; 16 16 if(num_ep==1) -
XIOS/dev/branch_openmp/extern/ep_dev/ep_free.cpp
r1500 r1503 49 49 50 50 51 if( ! (*comm)-> rank_map->empty() )51 if( ! (*comm)->ep_rank_map->empty() ) 52 52 { 53 (*comm)-> rank_map->clear();54 delete (*comm)-> rank_map;55 Debug(" rank_map emptied\n");53 (*comm)->ep_rank_map->clear(); 54 delete (*comm)->ep_rank_map; 55 Debug("ep_rank_map emptied and freed\n"); 56 56 } 57 57 … … 110 110 111 111 112 if( ! (*comm)-> rank_map->empty() )112 if( ! (*comm)->ep_rank_map->empty() ) 113 113 { 114 (*comm)->rank_map->clear(); 115 Debug("rank_map emptied\n"); 114 (*comm)->ep_rank_map->clear(); 115 delete (*comm)->ep_rank_map; 116 Debug("ep_rank_map emptied and freed\n"); 116 117 } 117 118 -
XIOS/dev/branch_openmp/extern/ep_dev/ep_gather.cpp
r1500 r1503 59 59 int mpi_size = comm->ep_comm_ptr->size_rank_info[2].second; 60 60 61 int root_mpi_rank = comm-> rank_map->at(root).second;62 int root_ep_loc = comm-> rank_map->at(root).first;61 int root_mpi_rank = comm->ep_rank_map->at(root).second; 62 int root_ep_loc = comm->ep_rank_map->at(root).first; 63 63 64 64 ::MPI_Aint datasize, lb; … … 90 90 for(int i=0; i<ep_size; i++) 91 91 { 92 recvcounts[comm-> rank_map->at(i).second]+=sendcount;92 recvcounts[comm->ep_rank_map->at(i).second]+=sendcount; 93 93 } 94 94 … … 111 111 for(int i=0; i<ep_size; i++) 112 112 { 113 offset = displs[comm-> rank_map->at(i).second] + comm->rank_map->at(i).first * sendcount;113 offset = displs[comm->ep_rank_map->at(i).second] + comm->ep_rank_map->at(i).first * sendcount; 114 114 memcpy(recvbuf + i*sendcount*datasize, tmp_recvbuf+offset*datasize, sendcount*datasize); 115 115 -
XIOS/dev/branch_openmp/extern/ep_dev/ep_gatherv.cpp
r1500 r1503 63 63 int mpi_size = comm->ep_comm_ptr->size_rank_info[2].second; 64 64 65 int root_mpi_rank = comm-> rank_map->at(root).second;66 int root_ep_loc = comm-> rank_map->at(root).first;65 int root_mpi_rank = comm->ep_rank_map->at(root).second; 66 int root_ep_loc = comm->ep_rank_map->at(root).first; 67 67 68 68 ::MPI_Aint datasize, lb; … … 126 126 for(int i=0; i<ep_size; i++) 127 127 { 128 mpi_recvcounts[comm-> rank_map->at(i).second]+=recvcounts[i];128 mpi_recvcounts[comm->ep_rank_map->at(i).second]+=recvcounts[i]; 129 129 } 130 130 … … 144 144 { 145 145 int extra = 0; 146 for(int j=0, k=0; j<ep_size, k<comm-> rank_map->at(i).first; j++)147 if(comm-> rank_map->at(i).second == comm->rank_map->at(j).second)146 for(int j=0, k=0; j<ep_size, k<comm->ep_rank_map->at(i).first; j++) 147 if(comm->ep_rank_map->at(i).second == comm->ep_rank_map->at(j).second) 148 148 { 149 149 extra += recvcounts[j]; … … 151 151 } 152 152 153 offset = mpi_displs[comm-> rank_map->at(i).second] + extra;153 offset = mpi_displs[comm->ep_rank_map->at(i).second] + extra; 154 154 155 155 memcpy(recvbuf+displs[i]*datasize, tmp_recvbuf+offset*datasize, recvcounts[i]*datasize); -
XIOS/dev/branch_openmp/extern/ep_dev/ep_get.cpp
r1500 r1503 12 12 int target_rank, MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win) 13 13 { 14 int target_mpi_rank = win->comm-> rank_map->at(target_rank).second;15 int target_local_rank = win->comm-> rank_map->at(target_rank).first;14 int target_mpi_rank = win->comm->ep_rank_map->at(target_rank).second; 15 int target_local_rank = win->comm->ep_rank_map->at(target_rank).first; 16 16 int num_ep = win->comm->ep_comm_ptr->size_rank_info[1].second; 17 17 if(num_ep==1) … … 27 27 int target_rank, MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win, MPI_Request *request) 28 28 { 29 int target_mpi_rank = win->comm-> rank_map->at(target_rank).second;30 int target_local_rank = win->comm-> rank_map->at(target_rank).first;29 int target_mpi_rank = win->comm->ep_rank_map->at(target_rank).second; 30 int target_local_rank = win->comm->ep_rank_map->at(target_rank).first; 31 31 int num_ep = win->comm->ep_comm_ptr->size_rank_info[1].second; 32 32 -
XIOS/dev/branch_openmp/extern/ep_dev/ep_intercomm.cpp
r1500 r1503 77 77 // change leader 78 78 is_decider = true; 79 int target = local_comm-> rank_map->at(local_leader).second;79 int target = local_comm->ep_rank_map->at(local_leader).second; 80 80 { 81 81 for(int i=0; i<ep_size; i++) 82 82 { 83 if(local_comm-> rank_map->at(i).second != target && local_comm->rank_map->at(i).first == 0)83 if(local_comm->ep_rank_map->at(i).second != target && local_comm->ep_rank_map->at(i).first == 0) 84 84 { 85 85 new_local_leader = i; … … 100 100 // change leader 101 101 is_decider = true; 102 int target = local_comm-> rank_map->at(local_leader).second;102 int target = local_comm->ep_rank_map->at(local_leader).second; 103 103 { 104 104 for(int i=0; i<ep_size; i++) 105 105 { 106 if(local_comm-> rank_map->at(i).second != target && local_comm->rank_map->at(i).first == 0)106 if(local_comm->ep_rank_map->at(i).second != target && local_comm->ep_rank_map->at(i).first == 0) 107 107 { 108 108 new_local_leader = i; -
XIOS/dev/branch_openmp/extern/ep_dev/ep_intercomm.hpp
r1502 r1503 5 5 typedef std::vector< std::pair<int, int> > RANK_MAP; // at(ep_rank) = <ep_rank_local, mpi_rank> 6 6 typedef std::map<int, std::pair<int, int> > EP_RANK_MAP; // key(ep_rank) = <ep_rank_local, mpi_rank> 7 typedef std::vector<std::pair< std::pair<int, int>, std::pair<int, int> > > INTERCOMM_RANK_MAP;7 //typedef std::vector<std::pair< std::pair<int, int>, std::pair<int, int> > > INTERCOMM_RANK_MAP; 8 8 9 9 namespace ep_lib -
XIOS/dev/branch_openmp/extern/ep_dev/ep_intercomm_kernel.cpp
r1500 r1503 46 46 47 47 if(ep_rank == local_leader) { is_proc_master = true; is_local_leader = true; is_final_master = true;} 48 if(ep_rank_loc == 0 && mpi_rank != local_comm-> rank_map->at(local_leader).second) is_proc_master = true;48 if(ep_rank_loc == 0 && mpi_rank != local_comm->ep_rank_map->at(local_leader).second) is_proc_master = true; 49 49 50 50 … … 125 125 send_buf[4] = rank_in_peer_mpi[1]; 126 126 127 ::MPI_Bcast(send_buf.data(), 5, to_mpi_type(MPI_INT), local_comm-> rank_map->at(local_leader).second, local_mpi_comm);127 ::MPI_Bcast(send_buf.data(), 5, to_mpi_type(MPI_INT), local_comm->ep_rank_map->at(local_leader).second, local_mpi_comm); 128 128 129 129 size_info[1] = send_buf[0]; … … 157 157 } 158 158 159 ::MPI_Bcast(recv_buf.data(), 3*size_info[1], to_mpi_type(MPI_INT), local_comm-> rank_map->at(local_leader).second, local_mpi_comm);159 ::MPI_Bcast(recv_buf.data(), 3*size_info[1], to_mpi_type(MPI_INT), local_comm->ep_rank_map->at(local_leader).second, local_mpi_comm); 160 160 161 161 std::copy ( recv_buf.data(), recv_buf.data() + size_info[1], rank_info[2].begin() ); … … 281 281 } 282 282 283 ::MPI_Bcast(&size_info[2], 2, to_mpi_type(MPI_INT), local_comm-> rank_map->at(local_leader).second, local_mpi_comm);283 ::MPI_Bcast(&size_info[2], 2, to_mpi_type(MPI_INT), local_comm->ep_rank_map->at(local_leader).second, local_mpi_comm); 284 284 285 285 new_rank_info[2].resize(size_info[3]); … … 305 305 } 306 306 307 ::MPI_Bcast(recv_buf.data(), 3*size_info[3], to_mpi_type(MPI_INT), local_comm-> rank_map->at(local_leader).second, local_mpi_comm);307 ::MPI_Bcast(recv_buf.data(), 3*size_info[3], to_mpi_type(MPI_INT), local_comm->ep_rank_map->at(local_leader).second, local_mpi_comm); 308 308 309 309 std::copy ( recv_buf.data(), recv_buf.data() + size_info[3], new_rank_info[2].begin() ); … … 337 337 } 338 338 339 ::MPI_Bcast(&leader_info[2], 1, to_mpi_type(MPI_INT), local_comm-> rank_map->at(local_leader).second, local_mpi_comm);339 ::MPI_Bcast(&leader_info[2], 1, to_mpi_type(MPI_INT), local_comm->ep_rank_map->at(local_leader).second, local_mpi_comm); 340 340 341 341 if(new_comm != static_cast< ::MPI_Comm*>(MPI_COMM_NULL->mpi_comm)) … … 542 542 MPI_Status statuses[2]; 543 543 544 MPI_Isend((*newintercomm)->rank_map->data(), 2*local_intercomm_size, MPI_INT, remote_leader, tag+6, peer_comm, &requests[0]); 545 MPI_Irecv((*newintercomm)->ep_comm_ptr->intercomm->intercomm_rank_map->data(), 2*remote_intercomm_size, MPI_INT, remote_leader, tag+6, peer_comm, &requests[1]); 544 std::vector<std::pair<int, std::pair<int, int> > > map2vec((*newintercomm)->ep_rank_map->size()); 545 std::vector<std::pair<int, std::pair<int, int> > > vec2map((*newintercomm)->ep_comm_ptr->intercomm->intercomm_rank_map->size()); 546 547 int ii=0; 548 for(std::map<int, std::pair<int, int> >::iterator it = (*newintercomm)->ep_rank_map->begin(); it != (*newintercomm)->ep_rank_map->end(); it++) 549 { 550 map2vec[ii++] = make_pair(it->first, make_pair(it->second.first, it->second.second)); 551 } 552 553 554 MPI_Isend(map2vec.data(), 3*local_intercomm_size, MPI_INT, remote_leader, tag+6, peer_comm, &requests[0]); 555 MPI_Irecv(vec2map.data(), 3*remote_intercomm_size, MPI_INT, remote_leader, tag+6, peer_comm, &requests[1]); 556 557 558 for(ii=0; ii<vec2map.size(); ii++) 559 { 560 (*newintercomm)->ep_comm_ptr->intercomm->intercomm_rank_map->at(vec2map[ii].first) = make_pair(vec2map[ii].second.first, vec2map[ii].second.second); 561 } 546 562 547 563 MPI_Waitall(2, requests, statuses); -
XIOS/dev/branch_openmp/extern/ep_dev/ep_intercomm_world.cpp
r1500 r1503 44 44 45 45 if(ep_rank == local_leader) { is_proc_master = true; is_local_leader = true; is_final_master = true;} 46 if(ep_rank_loc == 0 && mpi_rank != local_comm-> rank_map->at(local_leader).second) is_proc_master = true;46 if(ep_rank_loc == 0 && mpi_rank != local_comm->ep_rank_map->at(local_leader).second) is_proc_master = true; 47 47 48 48 … … 105 105 } 106 106 107 ::MPI_Bcast(recv_buf.data(), 4, to_mpi_type(MPI_INT), local_comm-> rank_map->at(local_leader).second, local_mpi_comm);107 ::MPI_Bcast(recv_buf.data(), 4, to_mpi_type(MPI_INT), local_comm->ep_rank_map->at(local_leader).second, local_mpi_comm); 108 108 109 109 size_info[1] = recv_buf[0]; … … 135 135 } 136 136 137 ::MPI_Bcast(recv_buf.data(), 3*size_info[1], to_mpi_type(MPI_INT), local_comm-> rank_map->at(local_leader).second, local_mpi_comm);137 ::MPI_Bcast(recv_buf.data(), 3*size_info[1], to_mpi_type(MPI_INT), local_comm->ep_rank_map->at(local_leader).second, local_mpi_comm); 138 138 139 139 std::copy ( recv_buf.data(), recv_buf.data() + size_info[1], rank_info[2].begin() ); … … 261 261 } 262 262 263 ::MPI_Bcast(&size_info[2], 2, to_mpi_type(MPI_INT), local_comm-> rank_map->at(local_leader).second, local_mpi_comm);263 ::MPI_Bcast(&size_info[2], 2, to_mpi_type(MPI_INT), local_comm->ep_rank_map->at(local_leader).second, local_mpi_comm); 264 264 265 265 new_rank_info[2].resize(size_info[3]); … … 283 283 } 284 284 285 ::MPI_Bcast(recv_buf.data(), 3*size_info[3], to_mpi_type(MPI_INT), local_comm-> rank_map->at(local_leader).second, local_mpi_comm);285 ::MPI_Bcast(recv_buf.data(), 3*size_info[3], to_mpi_type(MPI_INT), local_comm->ep_rank_map->at(local_leader).second, local_mpi_comm); 286 286 287 287 std::copy ( recv_buf.data(), recv_buf.data() + size_info[3], new_rank_info[2].begin() ); … … 315 315 } 316 316 317 ::MPI_Bcast(&leader_info[2], 1, to_mpi_type(MPI_INT), local_comm-> rank_map->at(local_leader).second, local_mpi_comm);317 ::MPI_Bcast(&leader_info[2], 1, to_mpi_type(MPI_INT), local_comm->ep_rank_map->at(local_leader).second, local_mpi_comm); 318 318 319 319 if(new_comm != static_cast< ::MPI_Comm* >(MPI_COMM_NULL->mpi_comm)) … … 512 512 { 513 513 ::MPI_Status status; 514 515 ::MPI_Send((*newintercomm)->rank_map->data(), 2*local_intercomm_size, to_mpi_type(MPI_INT), mpi_remote_leader, tag, peer_comm); 516 517 ::MPI_Recv((*newintercomm)->ep_comm_ptr->intercomm->intercomm_rank_map->data(), 2*remote_intercomm_size, to_mpi_type(MPI_INT), mpi_remote_leader, tag, peer_comm, &status); 514 515 std::vector<std::pair<int, std::pair<int, int> > > map2vec((*newintercomm)->ep_rank_map->size()); 516 std::vector<std::pair<int, std::pair<int, int> > > vec2map((*newintercomm)->ep_comm_ptr->intercomm->intercomm_rank_map->size()); 517 518 int ii=0; 519 for(std::map<int, std::pair<int, int> >::iterator it = (*newintercomm)->ep_rank_map->begin(); it != (*newintercomm)->ep_rank_map->end(); it++) 520 { 521 map2vec[ii++] = make_pair(it->first, make_pair(it->second.first, it->second.second)); 522 } 523 524 525 ::MPI_Send(map2vec.data(), 3*local_intercomm_size, to_mpi_type(MPI_INT), mpi_remote_leader, tag, peer_comm); 526 ::MPI_Recv(vec2map.data(), 3*remote_intercomm_size, to_mpi_type(MPI_INT), mpi_remote_leader, tag, peer_comm, &status); 527 528 529 for(ii=0; ii<vec2map.size(); ii++) 530 { 531 (*newintercomm)->ep_comm_ptr->intercomm->intercomm_rank_map->at(vec2map[ii].first) = make_pair(vec2map[ii].second.first, vec2map[ii].second.second); 532 } 518 533 } 519 534 -
XIOS/dev/branch_openmp/extern/ep_dev/ep_lib.cpp
r1500 r1503 33 33 int get_ep_rank(MPI_Comm comm, int ep_rank_loc, int mpi_rank) 34 34 { 35 for(int i=0; i<comm-> rank_map->size(); i++)36 { 37 if( ( comm-> rank_map->at(i).first == ep_rank_loc )38 && ( comm-> rank_map->at(i).second == mpi_rank ) )35 for(int i=0; i<comm->ep_rank_map->size(); i++) 36 { 37 if( ( comm->ep_rank_map->at(i).first == ep_rank_loc ) 38 && ( comm->ep_rank_map->at(i).second == mpi_rank ) ) 39 39 { 40 40 return i; … … 89 89 void check_sum_send(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, int type) 90 90 { 91 91 92 int src_rank; 92 93 int int_count; … … 121 122 void check_sum_recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, int type) 122 123 { 124 123 125 int dest_rank; 124 126 int int_count; … … 147 149 } 148 150 else printf("Unable to open file\n"); 151 149 152 150 153 } -
XIOS/dev/branch_openmp/extern/ep_dev/ep_lib.hpp
r1500 r1503 9 9 #include "ep_lib_fortran.hpp" 10 10 #include "ep_lib_win.hpp" 11 #include "ep_lib_mpi.hpp" 12 11 13 12 14 namespace ep_lib -
XIOS/dev/branch_openmp/extern/ep_dev/ep_merge.cpp
r1500 r1503 92 92 for(int i=0; i<intra_ep_size; i++) 93 93 { 94 tmp_rank_map[reorder[i]] = (*newintracomm)-> rank_map->at(i) ;94 tmp_rank_map[reorder[i]] = (*newintracomm)->ep_rank_map->at(i) ; 95 95 } 96 96 97 (*newintracomm)->rank_map->swap(tmp_rank_map); 97 //(*newintracomm)->rank_map->swap(tmp_rank_map); 98 (*newintracomm)->ep_rank_map->clear(); 99 for(int i=0; i<tmp_rank_map.size(); i++) 100 { 101 (*newintracomm)->ep_rank_map->insert(std::pair< int, std::pair<int,int> >(i, tmp_rank_map[i].first, tmp_rank_map[i].second)); 102 } 103 98 104 99 105 tmp_rank_map.clear(); … … 206 212 for(int i=0; i<newintracomm_ep_size; i++) 207 213 { 208 (*newintracomm)-> rank_map->at(rankmap_buf[3*i]).first = rankmap_buf[3*i+1];209 (*newintracomm)-> rank_map->at(rankmap_buf[3*i]).second = rankmap_buf[3*i+2];214 (*newintracomm)->ep_rank_map->at(rankmap_buf[3*i]).first = rankmap_buf[3*i+1]; 215 (*newintracomm)->ep_rank_map->at(rankmap_buf[3*i]).second = rankmap_buf[3*i+2]; 210 216 } 211 217 -
XIOS/dev/branch_openmp/extern/ep_dev/ep_message.cpp
r1500 r1503 20 20 int Request_Check() 21 21 { 22 if(EP_PendingRequests == 0 ) EP_PendingRequests = new std::list< MPI_Request* >; 23 24 if(EP_PendingRequests->size() == 0) return 0; 25 22 26 MPI_Status status; 23 27 MPI_Message *message; … … 26 30 std::list<MPI_Request* >::iterator it; 27 31 28 if(EP_PendingRequests == 0 ) return 0;29 32 30 33 for(it = EP_PendingRequests->begin(); it!=EP_PendingRequests->end(); it++) … … 38 41 if((*(*it))->state == 0) 39 42 { 40 41 message = new MPI_Message; 42 *message = new ep_message; 43 44 printf("new %p : in ep_lib::Request_Check, message = new MPI_Message\n", message); 45 printf("new %p : in ep_lib::Request_Check, *message = new ep_message\n", *message); 43 #pragma omp critical (_query0) 44 { 45 MPI_Iprobe((*(*it))->ep_src, (*(*it))->ep_tag, ((*(*it))->comm), &probed, &status); 46 if(probed) 47 { 48 message = new MPI_Message; 49 *message = new ep_message; 50 51 memcheck("new "<< message <<" : in ep_lib::Request_Check, message = new MPI_Message"); 52 memcheck("new "<< *message <<" : in ep_lib::Request_Check, *message = new ep_message"); 46 53 47 54 48 MPI_Improbe((*(*it))->ep_src, (*(*it))->ep_tag, ((*(*it))->comm), &probed, message, &status); 49 printf("in Request_Check, after improbe, mpi_status = %p\n", to_mpi_status_ptr(status)); 55 MPI_Improbe((*(*it))->ep_src, (*(*it))->ep_tag, (*(*it))->comm, &probed, message, &status); 56 57 } 58 } 50 59 51 60 … … 54 63 ::MPI_Get_count(to_mpi_status_ptr(status), to_mpi_type((*(*it))->ep_datatype), &recv_count); 55 64 56 printf("in Request_Check, imrecv, buf = %p, recv_count = %d, status = %p\n", (*(*it))->buf, recv_count, to_mpi_status_ptr(status));57 65 MPI_Imrecv((*(*it))->buf, recv_count, (*(*it))->ep_datatype, message, *it); 58 66 (*(*it))->type = 3; 59 67 (*(*it))->state = 1; 60 61 62 printf("delete %p : in ep_lib::Request_Check, delete *message\n", *message); 63 printf("delete %p : in ep_lib::Request_Check, delete message\n", message); 68 69 memcheck("delete "<< status.mpi_status <<" : in ep_lib::Request_Check, delete status.mpi_status"); 70 delete status.mpi_status; 71 72 memcheck("delete "<< *message <<" : in ep_lib::Request_Check, delete *message"); 73 memcheck("delete "<< message <<" : in ep_lib::Request_Check, delete message"); 64 74 65 75 delete *message; … … 68 78 it++; 69 79 continue; 70 } 80 } 71 81 } 72 82 73 83 if((*(*it))->state == 2) 74 84 { 75 printf("delete %p : in ep_lib::Request_Check, delete (*(*it))\n", (*(*it))); 85 int ep_rank = ((*(*it))->comm)->ep_comm_ptr->size_rank_info[0].first; 86 memcheck("delete "<< (*(*it)) <<" : in ep_lib::Request_Check, delete (*(*it))"); 76 87 delete (*(*it)); 77 88 78 89 EP_PendingRequests->erase(it); 79 printf("EP_PendingRequests->size() = %lu\n",EP_PendingRequests->size());90 memcheck("EP_PendingRequests["<<ep_rank<<"]->size() = " << EP_PendingRequests->size()); 80 91 it = EP_PendingRequests->begin(); 81 92 continue; … … 128 139 msg->mpi_message = new ::MPI_Message(message); 129 140 130 printf("new %p : in ep_lib::Message_Check, msg = new ep_message\n", msg);131 printf("new %p : in ep_lib::Message_Check, msg->mpi_message = new ::MPI_Message\n", msg->mpi_message);141 memcheck("new "<< msg <<" : in ep_lib::Message_Check, msg = new ep_message"); 142 memcheck("new "<< msg->mpi_message <<" : in ep_lib::Message_Check, msg->mpi_message = new ::MPI_Message"); 132 143 133 144 … … 139 150 msg->ep_src = get_ep_rank(comm, src_loc, src_mpi); 140 151 msg->mpi_status = new ::MPI_Status(status); 141 printf("new %p : in ep_lib::Message_Check, msg->mpi_status = new ::MPI_Status\n", msg->mpi_status);152 memcheck("new "<< msg->mpi_status <<" : in ep_lib::Message_Check, msg->mpi_status = new ::MPI_Status"); 142 153 143 154 #pragma omp critical (_query) … … 145 156 #pragma omp flush 146 157 comm->ep_comm_ptr->comm_list[dest_loc]->ep_comm_ptr->message_queue->push_back(msg); 147 int test_count; 148 ::MPI_Get_count(static_cast< ::MPI_Status* >(msg->mpi_status), 1275070475, &test_count); 149 printf("status1 = %p, test_count2 = %d\n", static_cast< ::MPI_Status* >(msg->mpi_status), test_count); 150 151 ::MPI_Get_count(static_cast< ::MPI_Status* >(comm->ep_comm_ptr->comm_list[dest_loc]->ep_comm_ptr->message_queue->back()->mpi_status), 1275070475, &test_count); 152 printf("status2 = %p, test_count2 = %d\n", static_cast< ::MPI_Status* >(comm->ep_comm_ptr->comm_list[dest_loc]->ep_comm_ptr->message_queue->back()->mpi_status), test_count); 153 158 int dest_mpi = comm->ep_comm_ptr->size_rank_info[2].first; 159 memcheck("message_queue["<<dest_mpi<<","<<dest_loc<<"]->size = "<<comm->ep_comm_ptr->comm_list[dest_loc]->ep_comm_ptr->message_queue->size()); 154 160 #pragma omp flush 155 161 } … … 199 205 msg->mpi_message = new ::MPI_Message(message); 200 206 201 printf("new %p : in ep_lib::Message_Check, msg = new ep_message\n", msg);202 printf("new %p : in ep_lib::Message_Check, msg->mpi_message = new ::MPI_Message\n", msg->mpi_message);207 memcheck("new "<< msg <<" : in ep_lib::Message_Check, msg = new ep_message"); 208 memcheck("new "<< msg->mpi_message <<" : in ep_lib::Message_Check, msg->mpi_message = new ::MPI_Message"); 203 209 204 210 … … 210 216 211 217 msg->ep_src = get_ep_rank(comm, src_loc, src_mpi); 212 msg->mpi_status = new ::MPI_Status(status); 213 printf("new %p : in ep_lib::Message_Check, msg->mpi_status = new ::MPI_Status\n", msg->mpi_status);218 msg->mpi_status = new ::MPI_Status(status); 219 memcheck("new "<< msg->mpi_status <<" : in ep_lib::Message_Check, msg->mpi_status = new ::MPI_Status"); 214 220 215 221 #pragma omp critical (_query) … … 217 223 #pragma omp flush 218 224 comm->ep_comm_ptr->comm_list[dest_loc]->ep_comm_ptr->message_queue->push_back(msg); 225 memcheck("comm->ep_comm_ptr->comm_list["<<dest_loc<<"]->ep_comm_ptr->message_queue->size = "<<comm->ep_comm_ptr->comm_list[dest_loc]->ep_comm_ptr->message_queue->size()); 219 226 #pragma omp flush 220 227 } -
XIOS/dev/branch_openmp/extern/ep_dev/ep_probe.cpp
r1500 r1503 13 13 if(!comm->is_ep) 14 14 { 15 ::MPI_Status *mpi_status = static_cast< ::MPI_Status* >(status->mpi_status); 16 ::MPI_Iprobe(src<0? MPI_ANY_SOURCE : src, tag<0? MPI_ANY_TAG: tag, to_mpi_comm(comm->mpi_comm), flag, mpi_status); 15 Debug("calling MPI_Iprobe MPI\n"); 16 ::MPI_Status mpi_status; 17 ::MPI_Iprobe(src<0? MPI_ANY_SOURCE : src, tag<0? MPI_ANY_TAG: tag, to_mpi_comm(comm->mpi_comm), flag, &mpi_status); 17 18 18 status->mpi_status = mpi_status;19 status->mpi_status = &mpi_status; 19 20 status->ep_src = src; 20 21 status->ep_tag = tag; … … 23 24 24 25 Debug("calling MPI_Iprobe EP\n"); 25 26 26 Message_Check(comm); 27 27 … … 43 43 ::MPI_Status mpi_status = *(static_cast< ::MPI_Status *>((*it)->mpi_status)); 44 44 45 status->mpi_status = new ::MPI_Status(mpi_status);45 status->mpi_status = (*it)->mpi_status; 46 46 status->ep_src = (*it)->ep_src; 47 47 status->ep_tag = (*it)->ep_tag; … … 49 49 break; 50 50 } 51 52 51 } 53 52 } … … 60 59 int MPI_Improbe(int src, int tag, MPI_Comm comm, int *flag, MPI_Message *message, MPI_Status *status) 61 60 { 61 int ep_rank_loc = comm->ep_comm_ptr->size_rank_info[1].first; 62 int mpi_rank = comm->ep_comm_ptr->size_rank_info[2].first; 62 63 *flag = false; 63 64 if(!comm->is_ep) … … 102 103 for(Message_list::iterator it = comm->ep_comm_ptr->message_queue->begin(); it!= comm->ep_comm_ptr->message_queue->end(); ++it) 103 104 { 104 105 //printf("in ep_lib::Improbe, it->mpi_message = %p, it->mpi_status = %p, it->ep_src = %d, it->ep_tag = %d\n",106 // (*(*it))->mpi_message,(*(*it))->mpi_status,(*(*it))->ep_src,(*(*it))->ep_tag);107 105 108 106 bool src_matched = src<0? true: (*it)->ep_src == src; … … 113 111 *flag = true; 114 112 115 status->mpi_status = (*it)->mpi_status; 113 status->mpi_status = new ::MPI_Status(*static_cast< ::MPI_Status*>((*it)->mpi_status)); 114 memcheck("new "<< status->mpi_status << " : in ep_lib::MPI_Improbe, status->mpi_status = new ::MPI_Status"); 116 115 status->ep_src = (*it)->ep_src; 117 116 status->ep_tag = (*it)->ep_tag; 118 117 119 (*message)->mpi_message = (*it)->mpi_message; 118 (*message)->mpi_message = new ::MPI_Message(*static_cast< ::MPI_Message*>((*it)->mpi_message)); 119 memcheck("new "<< (*message)->mpi_message <<" : in ep_lib::MPI_Improbe, (*message)->mpi_message = new ::MPI_Message"); 120 120 (*message)->ep_src = (*it)->ep_src; 121 121 (*message)->ep_tag = (*it)->ep_tag; 122 123 int test_count;124 ::MPI_Get_count(to_mpi_status_ptr(status), 1275070475, &test_count);125 printf("status = %p, test_count = %d\n", to_mpi_status_ptr(status), test_count);126 127 128 ::MPI_Get_count(static_cast< ::MPI_Status* >(comm->ep_comm_ptr->message_queue->back()->mpi_status), 1275070475, &test_count);129 printf("in ep_lib::Improbe, status = %p, test_count = %d\n", static_cast< ::MPI_Status* >(comm->ep_comm_ptr->message_queue->back()->mpi_status), test_count);130 122 131 123 132 124 #pragma omp critical (_query2) 133 125 { 134 printf("delete %p : in ep_lib::Message_Check, delete (*it)->mpi_message\n", (*it)->mpi_message); 135 printf("delete %p : in ep_lib::Message_Check, delete (*it)->mpi_status\n", (*it)->mpi_status); 136 printf("delete %p : in ep_lib::Message_Check, delete (*it)\n", (*it)); 126 memcheck("delete "<< (*it)->mpi_message <<" : in ep_lib::Message_Check, delete (*it)->mpi_message"); 127 memcheck("delete "<< (*it)->mpi_status <<" : in ep_lib::Message_Check, delete (*it)->mpi_status"); 128 memcheck("delete "<< (*it) <<" : in ep_lib::Message_Check, delete (*it)"); 129 137 130 138 131 delete (*it)->mpi_message; … … 140 133 delete *it; 141 134 135 142 136 comm->ep_comm_ptr->message_queue->erase(it); 143 printf("message queue siez = %lu\n",comm->ep_comm_ptr->message_queue->size());137 memcheck("message_queue["<<mpi_rank<<","<<ep_rank_loc<<"]->size = "<<comm->ep_comm_ptr->message_queue->size()); 144 138 #pragma omp flush 145 139 } -
XIOS/dev/branch_openmp/extern/ep_dev/ep_put.cpp
r1500 r1503 12 12 int target_rank, MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win) 13 13 { 14 int target_mpi_rank = win->comm-> rank_map->at(target_rank).second;15 int target_local_rank = win->comm-> rank_map->at(target_rank).first;14 int target_mpi_rank = win->comm->ep_rank_map->at(target_rank).second; 15 int target_local_rank = win->comm->ep_rank_map->at(target_rank).first; 16 16 int num_ep = win->comm->ep_comm_ptr->size_rank_info[1].second; 17 17 if(num_ep==1) … … 27 27 int target_rank, MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Win win, MPI_Request *request) 28 28 { 29 int target_mpi_rank = win->comm-> rank_map->at(target_rank).second;30 int target_local_rank = win->comm-> rank_map->at(target_rank).first;29 int target_mpi_rank = win->comm->ep_rank_map->at(target_rank).second; 30 int target_local_rank = win->comm->ep_rank_map->at(target_rank).first; 31 31 int num_ep = win->comm->ep_comm_ptr->size_rank_info[1].second; 32 32 -
XIOS/dev/branch_openmp/extern/ep_dev/ep_recv.cpp
r1500 r1503 19 19 namespace ep_lib 20 20 { 21 22 21 23 22 int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Status *status) 24 23 { 25 24 26 if(!comm->is_ep) 27 { 28 ::MPI_Status mpi_status; 29 ::MPI_Recv(buf, count, to_mpi_type(datatype), src<0? MPI_ANY_SOURCE : src, tag<0? MPI_ANY_TAG: tag, to_mpi_comm(comm->mpi_comm), &mpi_status); 30 31 status->ep_src = src; 32 status->ep_tag = tag; 33 status->ep_datatype = datatype; 34 35 return 0; 36 } 37 38 //Message_Check(comm); 25 if(!comm->is_ep) return MPI_Recv_mpi(buf, count, datatype, src, tag, comm, status); 26 27 Debug("MPI_Recv with EP"); 39 28 40 29 MPI_Request request; … … 45 34 } 46 35 47 36 48 37 49 38 50 39 int MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Request *request) 51 40 { 52 41 if(!comm->is_ep) return MPI_Irecv_mpi(buf, count, datatype, src, tag, comm, request); 42 53 43 Debug("MPI_Irecv with EP"); 54 44 int dest_rank; 55 45 MPI_Comm_rank(comm, &dest_rank); 56 46 57 58 if(!comm->is_ep) 59 { 60 ::MPI_Request mpi_request; 61 ::MPI_Irecv(buf, count, to_mpi_type(datatype), src<0? MPI_ANY_SOURCE : src, tag<0? MPI_ANY_TAG: tag, to_mpi_comm(comm->mpi_comm), &mpi_request); 62 63 (*request)->mpi_request = new ::MPI_Request(mpi_request); 64 (*request)->ep_src = src; 65 (*request)->ep_datatype = datatype; 66 (*request)->ep_tag = tag; 67 } 68 69 *request = new ep_request; 70 printf("new %p : in ep_lib::MPI_Irecv, *request = new ep_request\n", (*request)); 47 *request = new ep_request; 48 memcheck("new " << *request <<" : in ep_lib::MPI_Irecv, *request = new ep_request"); 71 49 72 50 (*request)->mpi_request = new ::MPI_Request; 73 printf("new %p : in ep_lib::MPI_Irecv, (*request)->mpi_request = new ::MPI_Request\n", (*request)->mpi_request);51 memcheck("new " << (*request)->mpi_request << " : in ep_lib::MPI_Irecv, (*request)->mpi_request = new ::MPI_Request"); 74 52 75 53 (*request)->buf = buf; … … 82 60 (*request)->ep_tag = tag; 83 61 (*request)->ep_datatype = datatype; 84 85 86 /* With Improbe*/ 62 63 if(EP_PendingRequests == 0 ) EP_PendingRequests = new std::list< MPI_Request* >; 87 64 88 if(EP_PendingRequests == 0 ) 89 { 90 EP_PendingRequests = new std::list< MPI_Request* >; 91 } 92 93 EP_PendingRequests->push_back(request); 65 EP_PendingRequests->push_back(request); 66 int ep_rank = comm->ep_comm_ptr->size_rank_info[0].first; 67 memcheck("EP_PendingRequests["<<ep_rank<<"]->size() = " << EP_PendingRequests->size()); 94 68 95 Request_Check(); 96 97 return 0; 69 return Request_Check(); 98 70 } 99 100 int MPI_Imrecv(void *buf, int count, MPI_Datatype datatype, MPI_Message *message, MPI_Request *request) 101 { 102 Debug("MPI_Imrecv"); 103 104 (*request)->type = 3; 105 106 ::MPI_Imrecv(buf, count, to_mpi_type(datatype), to_mpi_message_ptr(*message), to_mpi_request_ptr(*request)); 107 108 (*request)->ep_datatype = datatype; 109 (*request)->ep_tag = (*message)->ep_tag; 110 (*request)->ep_src = (*message)->ep_src; 111 112 113 return 0; 114 } 115 116 71 117 72 int MPI_Mrecv(void *buf, int count, MPI_Datatype datatype, MPI_Message *message, MPI_Status *status) 118 73 { 119 Debug(" EP Mrecv called\n");74 Debug("MPI_Mrecv with MPI/EP"); 120 75 121 ::MPI_Status mpi_status; 122 ::MPI_Mrecv(buf, count, to_mpi_type(datatype), static_cast< ::MPI_Message* >((*message)->mpi_message), &mpi_status); 76 status->mpi_status = new ::MPI_Status; 77 memcheck("new " << status->mpi_status << " : in ep_lib::MPI_Mrecv, status->mpi_status = new ::MPI_Status"); 78 79 ::MPI_Mrecv(buf, count, to_mpi_type(datatype), static_cast< ::MPI_Message* >((*message)->mpi_message), to_mpi_status_ptr(*status)); 123 80 124 status->mpi_status = new ::MPI_Status(mpi_status);81 125 82 status->ep_src = (*message)->ep_src; 126 83 status->ep_datatype = datatype; 127 84 status->ep_tag = (*message)->ep_tag; 128 85 86 memcheck("delete " << (*message)->mpi_message << " : in ep_lib::MPI_Mrecv, delete (*message)->mpi_message"); 129 87 delete (*message)->mpi_message; 130 88 131 //check_sum_recv(buf, count, datatype, message->ep_src, message->ep_tag); 89 #ifdef _check_sum 90 check_sum_recv(buf, count, datatype, message->ep_src, message->ep_tag); 91 #endif 132 92 133 return 0;93 return Request_Check(); 134 94 } 135 95 96 97 int MPI_Imrecv(void *buf, int count, MPI_Datatype datatype, MPI_Message *message, MPI_Request *request) 98 { 99 Debug("MPI_Imrecv with MPI/EP"); 100 101 (*request)->type = 3; 102 (*request)->ep_datatype = datatype; 103 (*request)->ep_tag = (*message)->ep_tag; 104 (*request)->ep_src = (*message)->ep_src; 105 106 ::MPI_Imrecv(buf, count, to_mpi_type(datatype), to_mpi_message_ptr(*message), to_mpi_request_ptr(*request)); 107 108 memcheck("delete " << (*message)->mpi_message << " : in ep_lib::MPI_Imrecv, delete (*message)->mpi_message"); 109 delete (*message)->mpi_message; 110 111 #ifdef _check_sum 112 check_sum_recv(buf, count, datatype, message->ep_src, message->ep_tag); 113 #endif 114 115 116 return Request_Check(); 117 } 118 119 120 int MPI_Recv_mpi(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Status *status) 121 { 122 Debug("MPI_Recv with MPI"); 123 status->ep_src = src; 124 status->ep_tag = tag; 125 status->ep_datatype = datatype; 126 127 return ::MPI_Recv(buf, count, to_mpi_type(datatype), src<0? MPI_ANY_SOURCE : src, tag<0? MPI_ANY_TAG: tag, to_mpi_comm(comm->mpi_comm), to_mpi_status_ptr(*status)); 128 } 129 130 int MPI_Irecv_mpi(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Request *request) 131 { 132 Debug("MPI_Irecv with MPI"); 133 int dest_rank; 134 MPI_Comm_rank(comm, &dest_rank); 135 136 *request = new ep_request; 137 memcheck("new "<< *request <<" : in ep_lib::MPI_Irecv, *request = new ep_request"); 138 139 (*request)->mpi_request = new ::MPI_Request; 140 memcheck("new "<< (*request)->mpi_request <<" : in ep_lib::MPI_Irecv, (*request)->mpi_request = new ::MPI_Request"); 141 142 (*request)->ep_src = src; 143 (*request)->ep_datatype = datatype; 144 (*request)->type = 2; 145 (*request)->ep_tag = tag; 146 147 return ::MPI_Irecv(buf, count, to_mpi_type(datatype), src<0? MPI_ANY_SOURCE : src, tag<0? MPI_ANY_TAG: tag, to_mpi_comm(comm->mpi_comm), to_mpi_request_ptr(*request)); 148 } 136 149 } 137 150 -
XIOS/dev/branch_openmp/extern/ep_dev/ep_reduce.cpp
r1500 r1503 302 302 int mpi_size = comm->ep_comm_ptr->size_rank_info[2].second; 303 303 304 int root_mpi_rank = comm-> rank_map->at(root).second;305 int root_ep_loc = comm-> rank_map->at(root).first;304 int root_mpi_rank = comm->ep_rank_map->at(root).second; 305 int root_ep_loc = comm->ep_rank_map->at(root).first; 306 306 307 307 ::MPI_Aint datasize, lb; -
XIOS/dev/branch_openmp/extern/ep_dev/ep_request.hpp
r1502 r1503 14 14 15 15 int type; //! type of the non-blocking communication. 16 // 1: Isend 17 // 2: Irecv18 // 3: Imrecv19 // 4:Issend16 // 1: Isend or Issend 17 // 2: Irecv 18 // 3: Imrecv 19 20 20 int state; // 0: new 21 21 // 1: imrecvd … … 27 27 int ep_tag; 28 28 void* ep_datatype; 29 30 29 31 30 32 ep_comm *comm; //! EP communicator related to the communication -
XIOS/dev/branch_openmp/extern/ep_dev/ep_scan.cpp
r1500 r1503 375 375 std::vector<int> my_map(mpi_size, 0); 376 376 377 for(int i=0; i<comm-> rank_map->size(); i++) my_map[comm->rank_map->at(i).second]++;377 for(int i=0; i<comm->ep_rank_map->size(); i++) my_map[comm->ep_rank_map->at(i).second]++; 378 378 379 379 for(int i=0; i<mpi_rank; i++) my_src += my_map[i]; -
XIOS/dev/branch_openmp/extern/ep_dev/ep_scatter.cpp
r1500 r1503 56 56 int mpi_size = comm->ep_comm_ptr->size_rank_info[2].second; 57 57 58 int root_mpi_rank = comm-> rank_map->at(root).second;59 int root_ep_loc = comm-> rank_map->at(root).first;58 int root_mpi_rank = comm->ep_rank_map->at(root).second; 59 int root_ep_loc = comm->ep_rank_map->at(root).first; 60 60 61 61 bool is_master = (ep_rank_loc==0 && mpi_rank != root_mpi_rank ) || ep_rank == root; … … 87 87 for(int i=0; i<ep_size; i++) 88 88 { 89 recvcounts[comm-> rank_map->at(i).second]++;89 recvcounts[comm->ep_rank_map->at(i).second]++; 90 90 } 91 91 -
XIOS/dev/branch_openmp/extern/ep_dev/ep_scatterv.cpp
r1500 r1503 59 59 int mpi_size = comm->ep_comm_ptr->size_rank_info[2].second; 60 60 61 int root_mpi_rank = comm-> rank_map->at(root).second;62 int root_ep_loc = comm-> rank_map->at(root).first;61 int root_mpi_rank = comm->ep_rank_map->at(root).second; 62 int root_ep_loc = comm->ep_rank_map->at(root).first; 63 63 64 64 bool is_master = (ep_rank_loc==0 && mpi_rank != root_mpi_rank ) || ep_rank == root; … … 90 90 for(int i=0; i<ep_size; i++) 91 91 { 92 recvcounts[comm-> rank_map->at(i).second]++;92 recvcounts[comm->ep_rank_map->at(i).second]++; 93 93 } 94 94 -
XIOS/dev/branch_openmp/extern/ep_dev/ep_send.cpp
r1500 r1503 12 12 13 13 14 namespace ep_lib {15 16 14 namespace ep_lib 15 { 16 17 17 int MPI_Send(void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) 18 18 { 19 if(!comm->is_ep) 20 return ::MPI_Send(buf, count, to_mpi_type(datatype), dest, tag, to_mpi_comm(comm->mpi_comm)); 21 if(comm->is_intercomm) 22 { 23 MPI_Request request; 24 MPI_Status status; 25 MPI_Isend(buf, count, datatype, dest, tag, comm, &request); 26 MPI_Wait(&request, &status); 27 } 28 else 29 { 30 int ep_src_loc = comm->ep_comm_ptr->size_rank_info[1].first; 31 int ep_dest_loc = comm->ep_comm_ptr->comm_list[0]->rank_map->at(dest).first; 32 int mpi_tag = tag_combine(tag, ep_src_loc, ep_dest_loc); 33 int mpi_dest = comm->ep_comm_ptr->comm_list[0]->rank_map->at(dest).second; 34 35 ::MPI_Send(buf, count, to_mpi_type(datatype), mpi_dest, mpi_tag, to_mpi_comm(comm->mpi_comm)); 36 } 37 //check_sum_send(buf, count, datatype, dest, tag, comm); 38 39 return 0; 19 if(!comm->is_ep) return MPI_Send_mpi(buf, count, datatype, dest, tag, comm); 20 if(comm->is_intercomm) return MPI_Send_intercomm(buf, count, datatype, dest, tag, comm); 21 22 Debug("\nMPI_Send with EP\n"); 23 24 int ep_src_loc = comm->ep_comm_ptr->size_rank_info[1].first; 25 int ep_dest_loc = comm->ep_comm_ptr->comm_list[0]->ep_rank_map->at(dest).first; 26 int mpi_tag = tag_combine(tag, ep_src_loc, ep_dest_loc); 27 int mpi_dest = comm->ep_comm_ptr->comm_list[0]->ep_rank_map->at(dest).second; 28 29 #ifdef _check_sum 30 check_sum_send(buf, count, datatype, dest, tag, comm); 31 #endif 32 33 return ::MPI_Send(buf, count, to_mpi_type(datatype), mpi_dest, mpi_tag, to_mpi_comm(comm->mpi_comm)); 40 34 } 41 35 … … 43 37 int MPI_Ssend(void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) 44 38 { 45 if(!comm->is_ep) 46 { 47 return ::MPI_Ssend(buf, count, to_mpi_type(datatype), dest, tag, to_mpi_comm(comm->mpi_comm)); 48 } 49 39 if(!comm->is_ep) return MPI_Ssend_mpi(buf, count, datatype, dest, tag, comm); 40 if(comm->is_intercomm) return MPI_Ssend_intercomm(buf, count, datatype, dest, tag, comm); 41 42 Debug("\nMPI_Ssend with EP\n"); 43 44 int ep_src_loc = comm->ep_comm_ptr->size_rank_info[1].first; 45 int ep_dest_loc = comm->ep_comm_ptr->comm_list[0]->ep_rank_map->at(dest).first; 46 int mpi_tag = tag_combine(tag, ep_src_loc, ep_dest_loc); 47 int mpi_dest = comm->ep_comm_ptr->comm_list[0]->ep_rank_map->at(dest).second; 48 49 #ifdef _check_sum 50 check_sum_send(buf, count, datatype, dest, tag, comm); 51 #endif 52 53 return ::MPI_Ssend(buf, count, to_mpi_type(datatype), mpi_dest, mpi_tag, to_mpi_comm(comm->mpi_comm)); 54 } 55 56 57 58 59 60 int MPI_Isend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) 61 { 62 if(!comm->is_ep) return MPI_Isend_mpi(buf, count, datatype, dest, tag, comm, request); 63 if(comm->is_intercomm) return MPI_Isend_intercomm(buf, count, datatype, dest, tag, comm, request); 64 65 Debug("\nMPI_Isend with EP\n"); 66 67 int src_rank; 68 MPI_Comm_rank(comm, &src_rank); 69 70 71 #ifdef _check_sum 72 check_sum_send(buf, count, datatype, dest, tag, comm); 73 #endif 74 75 *request = new ep_request; 76 memcheck("new "<< *request <<" : in ep_lib::MPI_Isend, *request = new ep_request"); 77 78 (*request)->mpi_request = new ::MPI_Request; 79 memcheck("new "<< (*request)->mpi_request <<" : in ep_lib::MPI_Isend, (*request)->mpi_request = new ::MPI_Request"); 80 81 82 int ep_src_loc = comm->ep_comm_ptr->size_rank_info[1].first; 83 int ep_dest_loc = comm->ep_comm_ptr->comm_list[0]->ep_rank_map->at(dest).first; 84 int mpi_tag = tag_combine(tag, ep_src_loc, ep_dest_loc); 85 int mpi_dest = comm->ep_comm_ptr->comm_list[0]->ep_rank_map->at(dest).second; 86 87 (*request)->ep_src = src_rank; 88 (*request)->ep_tag = tag; 89 (*request)->ep_datatype = datatype; 90 91 (*request)->type = 1; // used in wait 92 (*request)->comm = comm; 93 (*request)->buf = const_cast<void*>(buf); 94 95 96 return ::MPI_Isend(buf, count, to_mpi_type(datatype), mpi_dest, mpi_tag, to_mpi_comm(comm->mpi_comm), to_mpi_request_ptr(*request)); 97 } 98 99 100 101 102 int MPI_Issend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) 103 { 104 105 if(!comm->is_ep) return MPI_Issend_mpi(buf, count, datatype, dest, tag, comm, request); 106 if(comm->is_intercomm) return MPI_Issend_intercomm(buf, count, datatype, dest, tag, comm, request); 107 108 Debug("\nMPI_Issend with EP\n"); 109 110 int src_rank; 111 MPI_Comm_rank(comm, &src_rank); 112 113 114 #ifdef _check_sum 115 check_sum_send(buf, count, datatype, dest, tag, comm); 116 #endif 117 118 *request = new ep_request; 119 memcheck("new "<< *request <<" : in ep_lib::MPI_Issend, *request = new ep_request"); 120 121 (*request)->mpi_request = new ::MPI_Request; 122 memcheck("new "<< (*request)->mpi_request <<" : in ep_lib::MPI_Issend, (*request)->mpi_request = new ::MPI_Request"); 123 124 125 int ep_src_loc = comm->ep_comm_ptr->size_rank_info[1].first; 126 int ep_dest_loc = comm->ep_comm_ptr->comm_list[0]->ep_rank_map->at(dest).first; 127 int mpi_tag = tag_combine(tag, ep_src_loc, ep_dest_loc); 128 int mpi_dest = comm->ep_comm_ptr->comm_list[0]->ep_rank_map->at(dest).second; 129 130 (*request)->ep_src = src_rank; 131 (*request)->ep_tag = tag; 132 (*request)->ep_datatype = datatype; 133 134 (*request)->type = 1; // used in wait 135 (*request)->comm = comm; 136 (*request)->buf = const_cast<void*>(buf); 137 138 return ::MPI_Issend(buf, count, to_mpi_type(datatype), mpi_dest, mpi_tag, to_mpi_comm(comm->mpi_comm), to_mpi_request_ptr(*request)); 139 } 140 141 int MPI_Send_mpi(void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) 142 { 143 Debug("\nMPI_Send with MPI\n"); 144 return ::MPI_Send(buf, count, to_mpi_type(datatype), dest, tag, to_mpi_comm(comm->mpi_comm)); 145 } 146 147 int MPI_Send_intercomm(void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) 148 { 149 Debug("\nMPI_Send with EP_Intercomm\n"); 150 MPI_Request request; 151 MPI_Status status; 152 MPI_Isend(buf, count, datatype, dest, tag, comm, &request); 153 MPI_Wait(&request, &status); 154 return MPI_SUCCESS; 155 } 156 157 158 int MPI_Ssend_mpi(void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) 159 { 160 Debug("\nMPI_Ssend with MPI\n"); 161 return ::MPI_Ssend(buf, count, to_mpi_type(datatype), dest, tag, to_mpi_comm(comm->mpi_comm)); 162 } 163 164 165 int MPI_Ssend_intercomm(void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) 166 { 167 Debug("\nMPI_Ssend with EP_Intercomm\n"); 50 168 MPI_Request request; 51 169 MPI_Status status; 52 170 MPI_Issend(buf, count, datatype, dest, tag, comm, &request); 53 171 MPI_Wait(&request, &status); 54 //check_sum_send(buf, count, datatype, dest, tag, comm); 55 return 0; 56 } 57 58 59 60 61 62 int MPI_Isend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) 63 { 64 Debug("\nMPI_Isend with EP\n"); 172 return MPI_SUCCESS; 173 } 174 175 int MPI_Isend_mpi(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) 176 { 177 Debug("\nMPI_Isend with MPI\n"); 178 65 179 int src_rank; 66 180 MPI_Comm_rank(comm, &src_rank); 67 68 69 70 if(!comm->is_ep)71 {72 ::MPI_Request mpi_request;73 ::MPI_Isend(buf, count, to_mpi_type(datatype), dest, tag, to_mpi_comm(comm->mpi_comm), &mpi_request);74 75 (*request)->mpi_request = new ::MPI_Request(mpi_request);76 77 (*request)->ep_src = src_rank;78 (*request)->ep_tag = tag;79 (*request)->ep_datatype = datatype;80 (*request)->type = 1;81 (*request)->comm = comm;82 83 return 0;84 }85 86 if(comm->is_intercomm) return MPI_Isend_intercomm(buf, count, datatype, dest, tag, comm, request);87 88 // EP intracomm89 90 //check_sum_send(buf, count, datatype, dest, tag, comm, 1);91 181 92 182 *request = new ep_request; 93 printf("new %p : in ep_lib::MPI_Isend, *request = new ep_request\n", (*request));183 memcheck("new "<< *request <<" : in ep_lib::MPI_Isend, *request = new ep_request"); 94 184 95 185 (*request)->mpi_request = new ::MPI_Request; 96 printf("new %p : in ep_lib::MPI_Isend, (*request)->mpi_request = new ::MPI_Request\n", (*request)->mpi_request); 97 98 99 int ep_src_loc = comm->ep_comm_ptr->size_rank_info[1].first; 100 int ep_dest_loc = comm->ep_comm_ptr->comm_list[0]->rank_map->at(dest).first; 101 int mpi_tag = tag_combine(tag, ep_src_loc, ep_dest_loc); 102 int mpi_dest = comm->ep_comm_ptr->comm_list[0]->rank_map->at(dest).second; 103 104 (*request)->ep_src = src_rank; 105 (*request)->ep_tag = tag; 106 (*request)->ep_datatype = datatype; 107 108 ::MPI_Isend(buf, count, to_mpi_type(datatype), mpi_dest, mpi_tag, to_mpi_comm(comm->mpi_comm), to_mpi_request_ptr(*request)); 109 110 (*request)->type = 1; // used in wait 111 (*request)->comm = comm; 112 (*request)->buf = const_cast<void*>(buf); 113 114 115 return 0; 116 } 117 118 119 120 121 int MPI_Issend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) 122 { 123 Debug("\nMPI_Issend with EP\n"); 124 125 int src_rank; 126 MPI_Comm_rank(comm, &src_rank); 127 128 129 130 if(!comm->is_ep) 131 { 132 ::MPI_Request mpi_request; 133 ::MPI_Issend(buf, count, to_mpi_type(datatype), dest, tag, to_mpi_comm(comm->mpi_comm), &mpi_request); 134 135 (*request)->mpi_request = new ::MPI_Request(mpi_request); 136 (*request)->ep_src = src_rank; 137 (*request)->ep_tag = tag; 138 (*request)->ep_datatype = datatype; 139 (*request)->type = 1; 140 (*request)->comm = comm; 141 142 return 0; 143 } 144 145 if(comm->is_intercomm) return MPI_Issend_intercomm(buf, count, datatype, dest, tag, comm, request); 146 147 // EP intracomm 148 149 //check_sum_send(buf, count, datatype, dest, tag, comm, 1); 150 151 int ep_src_loc = comm->ep_comm_ptr->size_rank_info[1].first; 152 int ep_dest_loc = comm->ep_comm_ptr->comm_list[0]->rank_map->at(dest).first; 153 int mpi_tag = tag_combine(tag, ep_src_loc, ep_dest_loc); 154 int mpi_dest = comm->ep_comm_ptr->comm_list[0]->rank_map->at(dest).second; 155 186 memcheck("new "<< (*request)->mpi_request <<" : in ep_lib::MPI_Isend, (*request)->mpi_request = new ::MPI_Request"); 187 156 188 (*request)->ep_src = src_rank; 157 189 (*request)->ep_tag = tag; 158 190 (*request)->ep_datatype = datatype; 159 160 ::MPI_Request mpi_request; 161 162 ::MPI_Issend(buf, count, to_mpi_type(datatype), mpi_dest, mpi_tag, to_mpi_comm(comm->mpi_comm), &mpi_request); 163 164 (*request)->mpi_request = new ::MPI_Request(mpi_request); 165 (*request)->type = 1; // used in wait 191 (*request)->type = 1; 166 192 (*request)->comm = comm; 167 (*request)->buf = NULL; 168 169 170 //Message_Check(comm); 171 172 return 0; 173 } 174 175 176 177 193 194 return ::MPI_Isend(buf, count, to_mpi_type(datatype), dest, tag, to_mpi_comm(comm->mpi_comm), to_mpi_request_ptr(*request)); 195 } 196 178 197 int MPI_Isend_intercomm(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) 179 198 { 180 Debug("MPI_Isend with intercomm\n"); 181 182 //check_sum_send(buf, count, datatype, dest, tag, comm, 1); 199 Debug("MPI_Isend with EP_Intercomm\n"); 200 201 #ifdef _check_sum 202 check_sum_send(buf, count, datatype, dest, tag, comm); 203 #endif 183 204 184 205 int dest_remote_ep_rank = comm->ep_comm_ptr->intercomm->remote_rank_map->at(dest).first; … … 189 210 190 211 src_comm_label = comm->ep_comm_ptr->intercomm->local_rank_map->at(src_ep_rank).second; 191 192 193 194 195 212 //Message_Check(comm); 196 197 213 198 214 if(dest_remote_comm_label == src_comm_label) // mpi_dest differs 199 215 { 200 216 int inter_src = comm->ep_comm_ptr->intercomm->local_rank_map->at(src_ep_rank).first; 201 int ep_src_loc = comm-> rank_map->at(inter_src).first;202 int ep_dest_loc = comm-> rank_map->at(dest_remote_ep_rank).first;203 int mpi_dest = comm-> rank_map->at(dest_remote_ep_rank).second;217 int ep_src_loc = comm->ep_rank_map->at(inter_src).first; 218 int ep_dest_loc = comm->ep_rank_map->at(dest_remote_ep_rank).first; 219 int mpi_dest = comm->ep_rank_map->at(dest_remote_ep_rank).second; 204 220 int mpi_tag = tag_combine(tag, ep_src_loc, ep_dest_loc); 205 221 206 ::MPI_Request mpi_request; 207 208 ::MPI_Isend(buf, count, to_mpi_type(datatype), mpi_dest, mpi_tag, to_mpi_comm(comm->mpi_comm), &mpi_request); 209 210 (*request)->mpi_request = new ::MPI_Request(mpi_request); 222 *request = new ep_request; 223 memcheck("new "<< *request <<" : in ep_lib::MPI_Isend_intercomm, *request = new ep_request"); 224 225 (*request)->mpi_request = new ::MPI_Request; 226 memcheck("new "<< (*request)->mpi_request <<" : in ep_lib::MPI_Isend_intercomm, (*request)->mpi_request = new ::MPI_Request"); 227 211 228 (*request)->type = 1; // used in wait 212 229 (*request)->comm = comm; 213 214 230 (*request)->ep_src = src_ep_rank; 215 231 (*request)->ep_tag = tag; 216 232 (*request)->ep_datatype = datatype; 233 234 return ::MPI_Isend(buf, count, to_mpi_type(datatype), mpi_dest, mpi_tag, to_mpi_comm(comm->mpi_comm), to_mpi_request_ptr(*request)); 235 217 236 } 218 237 … … 220 239 { 221 240 int inter_src = comm->ep_comm_ptr->intercomm->local_rank_map->at(src_ep_rank).first; 222 int ep_src_loc = comm-> rank_map->at(inter_src).first;241 int ep_src_loc = comm->ep_rank_map->at(inter_src).first; 223 242 int ep_dest_loc = comm->ep_comm_ptr->intercomm->intercomm_rank_map->at(dest_remote_ep_rank).first; 224 243 int mpi_dest = comm->ep_comm_ptr->intercomm->intercomm_rank_map->at(dest_remote_ep_rank).second; 225 244 int mpi_tag = tag_combine(tag, ep_src_loc, ep_dest_loc); 226 245 227 ::MPI_Request mpi_request; 228 229 ::MPI_Isend(buf, count, to_mpi_type(datatype), mpi_dest, mpi_tag, to_mpi_comm(comm->ep_comm_ptr->intercomm->mpi_inter_comm), &mpi_request); 230 231 (*request)->mpi_request = new ::MPI_Request(mpi_request); 246 *request = new ep_request; 247 memcheck("new "<< *request <<" : in ep_lib::MPI_Isend_intercomm, *request = new ep_request"); 248 249 (*request)->mpi_request = new ::MPI_Request; 250 memcheck("new "<< (*request)->mpi_request <<" : in ep_lib::MPI_Isend_intercomm, (*request)->mpi_request = new ::MPI_Request"); 251 232 252 (*request)->type = 1; // used in wait 233 253 (*request)->comm = comm; 234 235 254 (*request)->ep_src = src_ep_rank; 236 255 (*request)->ep_tag = tag; 237 256 (*request)->ep_datatype = datatype; 257 258 return ::MPI_Isend(buf, count, to_mpi_type(datatype), mpi_dest, mpi_tag, to_mpi_comm(comm->ep_comm_ptr->intercomm->mpi_inter_comm), to_mpi_request_ptr(*request)); 238 259 } 239 240 return 0; 241 260 } 261 262 int MPI_Issend_mpi(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) 263 { 264 Debug("\nMPI_Issend with MPI\n"); 265 266 int src_rank; 267 MPI_Comm_rank(comm, &src_rank); 268 269 *request = new ep_request; 270 memcheck("new "<< *request <<" : in ep_lib::MPI_Issend, *request = new ep_request"); 271 272 (*request)->mpi_request = new ::MPI_Request; 273 memcheck("new "<< (*request)->mpi_request <<" : in ep_lib::MPI_Issend, (*request)->mpi_request = new ::MPI_Request"); 274 275 (*request)->ep_src = src_rank; 276 (*request)->ep_tag = tag; 277 (*request)->ep_datatype = datatype; 278 (*request)->type = 1; 279 (*request)->comm = comm; 280 281 return ::MPI_Issend(buf, count, to_mpi_type(datatype), dest, tag, to_mpi_comm(comm->mpi_comm), to_mpi_request_ptr(*request)); 242 282 } 243 283 … … 245 285 int MPI_Issend_intercomm(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) 246 286 { 247 Debug("MPI_Issend with intercomm\n"); 248 249 //check_sum_send(buf, count, datatype, dest, tag, comm, 1); 287 Debug("MPI_Issend with EP_Intercomm\n"); 288 289 #ifdef _check_sum 290 check_sum_send(buf, count, datatype, dest, tag, comm); 291 #endif 250 292 251 293 int dest_remote_ep_rank = comm->ep_comm_ptr->intercomm->remote_rank_map->at(dest).first; … … 255 297 int src_comm_label; 256 298 257 for(int i=0; i<comm->ep_comm_ptr->intercomm->local_rank_map->size(); i++) 258 { 259 if(comm->ep_comm_ptr->intercomm->local_rank_map->at(i).first == src_ep_rank) 260 { 261 src_comm_label = comm->ep_comm_ptr->intercomm->local_rank_map->at(i).second; 262 break; 263 } 264 } 265 299 src_comm_label = comm->ep_comm_ptr->intercomm->local_rank_map->at(src_ep_rank).second; 266 300 //Message_Check(comm); 267 301 268 269 if(dest_remote_comm_label == src_comm_label) // dest rank (loc, mpi) differs 302 if(dest_remote_comm_label == src_comm_label) // mpi_dest differs 270 303 { 271 304 int inter_src = comm->ep_comm_ptr->intercomm->local_rank_map->at(src_ep_rank).first; 272 int ep_src_loc = comm-> rank_map->at(inter_src).first;273 int ep_dest_loc = comm-> rank_map->at(dest_remote_ep_rank).first;274 int mpi_dest = comm-> rank_map->at(dest_remote_ep_rank).second;305 int ep_src_loc = comm->ep_rank_map->at(inter_src).first; 306 int ep_dest_loc = comm->ep_rank_map->at(dest_remote_ep_rank).first; 307 int mpi_dest = comm->ep_rank_map->at(dest_remote_ep_rank).second; 275 308 int mpi_tag = tag_combine(tag, ep_src_loc, ep_dest_loc); 276 309 277 ::MPI_Request mpi_request; 278 279 ::MPI_Issend(buf, count, to_mpi_type(datatype), mpi_dest, mpi_tag, to_mpi_comm(comm->mpi_comm), &mpi_request); 280 281 (*request)->mpi_request = new ::MPI_Request(mpi_request); 310 *request = new ep_request; 311 memcheck("new "<< *request <<" : in ep_lib::MPI_Issend_intercomm, *request = new ep_request"); 312 313 (*request)->mpi_request = new ::MPI_Request; 314 memcheck("new "<< (*request)->mpi_request <<" : in ep_lib::MPI_Issend_intercomm, (*request)->mpi_request = new ::MPI_Request"); 315 282 316 (*request)->type = 1; // used in wait 283 317 (*request)->comm = comm; 284 285 318 (*request)->ep_src = src_ep_rank; 286 319 (*request)->ep_tag = tag; 287 320 (*request)->ep_datatype = datatype; 321 322 return ::MPI_Issend(buf, count, to_mpi_type(datatype), mpi_dest, mpi_tag, to_mpi_comm(comm->mpi_comm), to_mpi_request_ptr(*request)); 323 288 324 } 289 325 … … 291 327 { 292 328 int inter_src = comm->ep_comm_ptr->intercomm->local_rank_map->at(src_ep_rank).first; 293 int ep_src_loc = comm-> rank_map->at(inter_src).first;329 int ep_src_loc = comm->ep_rank_map->at(inter_src).first; 294 330 int ep_dest_loc = comm->ep_comm_ptr->intercomm->intercomm_rank_map->at(dest_remote_ep_rank).first; 295 331 int mpi_dest = comm->ep_comm_ptr->intercomm->intercomm_rank_map->at(dest_remote_ep_rank).second; 296 332 int mpi_tag = tag_combine(tag, ep_src_loc, ep_dest_loc); 297 333 298 ::MPI_Request mpi_request; 299 300 ::MPI_Issend(buf, count, to_mpi_type(datatype), mpi_dest, mpi_tag, to_mpi_comm(comm->ep_comm_ptr->intercomm->mpi_inter_comm), &mpi_request); 301 302 (*request)->mpi_request = new ::MPI_Request(mpi_request); 334 *request = new ep_request; 335 memcheck("new "<< *request <<" : in ep_lib::MPI_Issend_intercomm, *request = new ep_request"); 336 337 (*request)->mpi_request = new ::MPI_Request; 338 memcheck("new "<< (*request)->mpi_request <<" : in ep_lib::MPI_Issend_intercomm, (*request)->mpi_request = new ::MPI_Request"); 339 303 340 (*request)->type = 1; // used in wait 304 341 (*request)->comm = comm; 305 306 342 (*request)->ep_src = src_ep_rank; 307 343 (*request)->ep_tag = tag; 308 344 (*request)->ep_datatype = datatype; 345 346 return ::MPI_Issend(buf, count, to_mpi_type(datatype), mpi_dest, mpi_tag, to_mpi_comm(comm->ep_comm_ptr->intercomm->mpi_inter_comm), to_mpi_request_ptr(*request)); 309 347 } 310 311 return 0;312 313 348 } 314 349 -
XIOS/dev/branch_openmp/extern/ep_dev/ep_size.cpp
r1500 r1503 38 38 39 39 ::MPI_Comm_size(mpi_comm, &mpi_size); 40 printf("============ ep comm size called for non ep comm, %d\n", mpi_size);41 40 *size = mpi_size; 42 41 return 0; … … 46 45 { 47 46 *size = MPI_UNDEFINED; 48 printf("============ ep comm size called for non ep comm not defined\n");49 47 return 0; 50 48 } -
XIOS/dev/branch_openmp/extern/ep_dev/ep_type.cpp
r1500 r1503 125 125 my_buffer = NULL; 126 126 ep_barrier = NULL; 127 rank_map = NULL;127 ep_rank_map = NULL; 128 128 ep_comm_ptr = NULL; 129 129 mem_bridge = NULL; … … 140 140 my_buffer = NULL; 141 141 ep_barrier = NULL; 142 rank_map = NULL;142 ep_rank_map = NULL; 143 143 ep_comm_ptr = NULL; 144 144 mem_bridge = NULL; -
XIOS/dev/branch_openmp/extern/ep_dev/ep_type.hpp
r1500 r1503 23 23 #endif 24 24 25 #ifdef _Memory_check 26 #define memcheck(x) std::cout << x << std::endl 27 #else 28 #define memcheck(x) 29 #endif 30 31 25 32 #define BUFFER_SIZE 10000 26 33 -
XIOS/dev/branch_openmp/extern/ep_dev/ep_wait.cpp
r1500 r1503 41 41 (*request)->state = 2; 42 42 43 printf("delete %p : in ep_lib::MPI_Wait, delete (*request)->mpi_request\n", (*request)->mpi_request);43 memcheck("delete "<< (*request)->mpi_request << " : in ep_lib::MPI_Wait, delete (*request)->mpi_request"); 44 44 delete (*request)->mpi_request; 45 45 Request_Check(); … … 91 91 array_of_statuses[i].ep_datatype = array_of_requests[i]->ep_datatype; 92 92 array_of_requests[i]->state = 2; 93 printf("delete %p : in ep_lib::MPI_Wait, array_of_requests[i]->mpi_request\n", array_of_requests[i]->mpi_request);93 memcheck("delete "<< array_of_requests[i]->mpi_request <<" : in ep_lib::MPI_Waitall, array_of_requests["<<i<<"]->mpi_request"); 94 94 delete array_of_requests[i]->mpi_request; 95 95 if(array_of_requests[i]->type == 1) 96 96 { 97 printf("delete %p : in ep_lib::MPI_Wait, array_of_requests[i]\n", array_of_requests[i]);97 memcheck("delete "<< array_of_requests[i] <<" : in ep_lib::MPI_Waitall, array_of_requests["<<i<<"]"); 98 98 delete array_of_requests[i]; 99 99 } -
XIOS/dev/branch_openmp/extern/ep_dev/main.cpp
r1500 r1503 52 52 53 53 54 MPI_Comm comm_for_dup; // this should act as EP_COMM_WORLD 54 55 MPI_Comm comm; // this should act as EP_COMM_WORLD 55 comm = passage[omp_get_thread_num()]; 56 57 comm_for_dup = passage[omp_get_thread_num()]; 58 MPI_Comm_dup(comm_for_dup, &comm); 59 60 MPI_Comm_free(&comm_for_dup); 61 62 MPI_Barrier(comm); 56 63 57 64 int rank, size; 58 65 MPI_Comm_rank(comm, &rank); 59 66 MPI_Comm_size(comm, &size); 67 68 if(rank == 0) printf(" \t test MPI_Comm_dup \t OK \n"); 60 69 /* 61 70 // TIMING SYCHRONIZATION … … 109 118 MPI_Barrier(comm); 110 119 120 MPI_Comm equal_comm = comm; 121 122 123 124 111 125 double sendbuf[10]; 112 126 double recvbuf[20]; 113 127 114 int sender = 1; 115 int receiver = 2; 128 int sender; 129 if(rank == 0) sender = rand() % size; 130 MPI_Bcast(&sender, 1, MPI_INT, 0, comm); 131 132 int receiver = sender; 133 if(rank == 0) while(sender == receiver) {receiver = rand() % size;} 134 MPI_Bcast(&receiver, 1, MPI_INT, 0, comm); 135 136 137 116 138 117 139 if(rank == sender) 118 140 { 119 141 for(int i=0; i<10; i++) sendbuf[i] = 99.99; 120 MPI_Send(sendbuf, 10, MPI_DOUBLE, receiver, 99, comm);142 MPI_Send(sendbuf, 10, MPI_DOUBLE, receiver, 99, equal_comm); 121 143 for(int i=0; i<10; i++) sendbuf[i] = -99.99; 122 MPI_Send(sendbuf, 10, MPI_DOUBLE, receiver, 11, comm);144 MPI_Send(sendbuf, 10, MPI_DOUBLE, receiver, 11, equal_comm); 123 145 } 124 146 … … 131 153 132 154 for(int i=0; i<20; i++) std::cout << "recvbuf["<< i <<"] = "<< recvbuf[i] << std::endl; 155 printf("sender = %d\nreceiver = %d \tTEST of p2p blocking communication\tOK\n", sender, receiver); 133 156 } 134 157 … … 145 168 double recvbuf[20]; 146 169 147 int sender = 3; 148 int receiver = 7; 149 170 int sender; 171 if(rank == 0) sender = rand() % size; 172 MPI_Bcast(&sender, 1, MPI_INT, 0, comm); 173 174 int receiver = sender; 175 if(rank == 0) receiver = rand() % size; 176 MPI_Bcast(&receiver, 1, MPI_INT, 0, comm); 177 178 179 150 180 MPI_Request request[2]; 151 181 … … 179 209 { 180 210 for(int i=0; i<20; i++) std::cout << "recvbuf["<< i <<"] = "<< recvbuf[i] << std::endl; 211 printf("sender = %d\nreceiver = %d \tTEST of p2p non-blocking communication\tOK\n", sender, receiver); 181 212 } 182 213 -
XIOS/dev/branch_openmp/extern/ep_dev/makefile
r1500 r1503 1 1 appname := EP_test 2 2 3 CXX := mpiicc -D_intelmpi - openmp3 CXX := mpiicc -D_intelmpi -D_noMemory_check -D_nocheck_sum -openmp 4 4 CXXFLAGS := -std=c++11 -g 5 5 #CXXFLAGS := -std=c++11 -g
Note: See TracChangeset
for help on using the changeset viewer.