Changeset 1520 for XIOS/dev/branch_openmp/extern/src_ep_dev/ep_send.cpp
- Timestamp:
- 06/04/18 19:25:08 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_openmp/extern/src_ep_dev/ep_send.cpp
r1373 r1520 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->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->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 //printf("call mpi_send for intracomm, dest = %d, tag = %d\n", dest, tag); 37 } 38 //check_sum_send(buf, count, datatype, dest, tag, comm); 39 40 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)); 41 34 } 42 35 … … 44 37 int MPI_Ssend(void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) 45 38 { 46 if(!comm.is_ep) 47 { 48 return ::MPI_Ssend(buf, count, to_mpi_type(datatype), dest, tag, to_mpi_comm(comm.mpi_comm)); 49 } 50 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_intercomm with EP\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_intercomm with EP\n"); 51 168 MPI_Request request; 52 169 MPI_Status status; 53 170 MPI_Issend(buf, count, datatype, dest, tag, comm, &request); 54 171 MPI_Wait(&request, &status); 55 //check_sum_send(buf, count, datatype, dest, tag, comm); 56 return 0; 57 } 58 59 60 61 62 63 int MPI_Isend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) 64 { 65 Debug("\nMPI_Isend with EP\n"); 66 int src_rank; 67 MPI_Comm_rank(comm, &src_rank); 68 69 70 71 if(!comm.is_ep) 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 179 int src_rank; 180 MPI_Comm_rank(comm, &src_rank); 181 182 *request = new ep_request; 183 memcheck("new "<< *request <<" : in ep_lib::MPI_Isend_mpi, *request = new ep_request"); 184 185 (*request)->mpi_request = new ::MPI_Request; 186 memcheck("new "<< (*request)->mpi_request <<" : in ep_lib::MPI_Isend_mpi, (*request)->mpi_request = new ::MPI_Request"); 187 188 (*request)->ep_src = src_rank; 189 (*request)->ep_tag = tag; 190 (*request)->ep_datatype = datatype; 191 (*request)->type = 1; 192 (*request)->comm = comm; 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 197 int MPI_Isend_intercomm(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) 198 { 199 Debug("\nMPI_Isend_intercomm with EP\n"); 200 201 #ifdef _check_sum 202 check_sum_send(buf, count, datatype, dest, tag, comm); 203 #endif 204 205 int src_comm_label = comm->ep_comm_ptr->comm_label; 206 int dest_comm_label = comm->ep_comm_ptr->intercomm->intercomm_rank_map->at(dest).second.second; 207 208 int src_rank; 209 MPI_Comm_rank(comm, &src_rank); 210 211 212 *request = new ep_request; 213 memcheck("new "<< *request <<" : in ep_lib::MPI_Isend_intercomm, *request = new ep_request"); 214 215 (*request)->mpi_request = new ::MPI_Request; 216 memcheck("new "<< (*request)->mpi_request <<" : in ep_lib::MPI_Isend_intercomm, (*request)->mpi_request = new ::MPI_Request"); 217 218 219 int ep_src_loc = comm->ep_rank_map->at(src_rank).first; 220 int ep_dest_loc = comm->ep_comm_ptr->intercomm->intercomm_rank_map->at(dest).first; 221 int mpi_tag = tag_combine(tag, ep_src_loc, ep_dest_loc); 222 int mpi_dest = comm->ep_comm_ptr->intercomm->intercomm_rank_map->at(dest).second.first; 223 224 #ifdef _showinfo 225 printf("Send : ep_src_loc = %d, ep_dest_loc = %d, mpi_src = %d, mpi_dest = %d, mpi_tag = %d\n", ep_src_loc, ep_dest_loc, comm->ep_comm_ptr->size_rank_info[2].first, mpi_dest, mpi_tag); 226 #endif 227 228 229 (*request)->ep_src = src_rank; 230 (*request)->ep_tag = tag; 231 (*request)->ep_datatype = datatype; 232 233 (*request)->type = 1; // used in wait 234 (*request)->comm = comm; 235 (*request)->buf = const_cast<void*>(buf); 236 237 238 if(src_comm_label == dest_comm_label) 72 239 { 73 ::MPI_Request mpi_request; 74 ::MPI_Isend(buf, count, to_mpi_type(datatype), dest, tag, to_mpi_comm(comm.mpi_comm), &mpi_request); 75 76 request->mpi_request = new ::MPI_Request(mpi_request); 77 78 request->ep_src = src_rank; 79 request->ep_tag = tag; 80 request->ep_datatype = datatype; 81 request->type = 1; 82 request->comm = comm; 83 84 return 0; 240 Debug("\nMPI_Isend_intercomm with EP_intracomm\n"); 241 return ::MPI_Isend(buf, count, to_mpi_type(datatype), mpi_dest, mpi_tag, to_mpi_comm(comm->mpi_comm), to_mpi_request_ptr(*request)); 85 242 } 86 243 87 if(comm.is_intercomm) return MPI_Isend_intercomm(buf, count, datatype, dest, tag, comm, request); 88 89 // EP intracomm 90 91 //check_sum_send(buf, count, datatype, dest, tag, comm, 1); 92 93 int ep_src_loc = comm.ep_comm_ptr->size_rank_info[1].first; 94 int ep_dest_loc = comm.ep_comm_ptr->comm_list->rank_map->at(dest).first; 95 int mpi_tag = tag_combine(tag, ep_src_loc, ep_dest_loc); 96 int mpi_dest = comm.ep_comm_ptr->comm_list->rank_map->at(dest).second; 97 98 request->ep_src = src_rank; 99 request->ep_tag = tag; 100 request->ep_datatype = datatype; 101 102 ::MPI_Request mpi_request; 103 104 ::MPI_Isend(buf, count, to_mpi_type(datatype), mpi_dest, mpi_tag, to_mpi_comm(comm.mpi_comm), &mpi_request); 105 106 request->mpi_request = new ::MPI_Request(mpi_request); 107 request->type = 1; // used in wait 108 request->comm = comm; 109 request->buf = const_cast<void*>(buf); 110 111 //Message_Check(comm); 112 113 return 0; 114 } 115 116 117 118 119 int MPI_Issend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) 120 { 121 Debug("\nMPI_Issend with EP\n"); 122 123 int src_rank; 124 MPI_Comm_rank(comm, &src_rank); 125 126 127 128 if(!comm.is_ep) 244 else 129 245 { 130 ::MPI_Request mpi_request; 131 ::MPI_Issend(buf, count, to_mpi_type(datatype), dest, tag, to_mpi_comm(comm.mpi_comm), &mpi_request); 132 133 request->mpi_request = new ::MPI_Request(mpi_request); 134 request->ep_src = src_rank; 135 request->ep_tag = tag; 136 request->ep_datatype = datatype; 137 request->type = 1; 138 request->comm = comm; 139 140 return 0; 246 Debug("\nMPI_Isend_intercomm with EP_intercomm\n"); 247 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)); 141 248 } 142 143 if(comm.is_intercomm) return MPI_Issend_intercomm(buf, count, datatype, dest, tag, comm, request); 144 145 // EP intracomm 146 147 //check_sum_send(buf, count, datatype, dest, tag, comm, 1); 148 149 int ep_src_loc = comm.ep_comm_ptr->size_rank_info[1].first; 150 int ep_dest_loc = comm.ep_comm_ptr->comm_list->rank_map->at(dest).first; 151 int mpi_tag = tag_combine(tag, ep_src_loc, ep_dest_loc); 152 int mpi_dest = comm.ep_comm_ptr->comm_list->rank_map->at(dest).second; 153 154 request->ep_src = src_rank; 155 request->ep_tag = tag; 156 request->ep_datatype = datatype; 157 158 ::MPI_Request mpi_request; 159 160 ::MPI_Issend(buf, count, to_mpi_type(datatype), mpi_dest, mpi_tag, to_mpi_comm(comm.mpi_comm), &mpi_request); 161 162 request->mpi_request = new ::MPI_Request(mpi_request); 163 request->type = 1; // used in wait 164 request->comm = comm; 165 request->buf = NULL; 166 167 168 //Message_Check(comm); 169 170 return 0; 171 } 172 173 174 175 176 int MPI_Isend_intercomm(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) 177 { 178 Debug("MPI_Isend with intercomm\n"); 179 180 //check_sum_send(buf, count, datatype, dest, tag, comm, 1); 181 182 int dest_remote_ep_rank = comm.ep_comm_ptr->intercomm->remote_rank_map->at(dest).first; 183 int dest_remote_comm_label = comm.ep_comm_ptr->intercomm->remote_rank_map->at(dest).second; 184 185 int src_ep_rank = comm.ep_comm_ptr->intercomm->size_rank_info[0].first; 186 int src_comm_label; 187 188 src_comm_label = comm.ep_comm_ptr->intercomm->local_rank_map->at(src_ep_rank).second; 189 190 191 192 193 //Message_Check(comm); 194 195 196 if(dest_remote_comm_label == src_comm_label) // mpi_dest differs 249 } 250 251 252 253 254 int MPI_Issend_mpi(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) 255 { 256 Debug("\nMPI_Issend with MPI\n"); 257 258 int src_rank; 259 MPI_Comm_rank(comm, &src_rank); 260 261 *request = new ep_request; 262 memcheck("new "<< *request <<" : in ep_lib::MPI_Issend_mpi, *request = new ep_request"); 263 264 (*request)->mpi_request = new ::MPI_Request; 265 memcheck("new "<< (*request)->mpi_request <<" : in ep_lib::MPI_Issend_mpi, (*request)->mpi_request = new ::MPI_Request"); 266 267 (*request)->ep_src = src_rank; 268 (*request)->ep_tag = tag; 269 (*request)->ep_datatype = datatype; 270 (*request)->type = 1; 271 (*request)->comm = comm; 272 273 return ::MPI_Issend(buf, count, to_mpi_type(datatype), dest, tag, to_mpi_comm(comm->mpi_comm), to_mpi_request_ptr(*request)); 274 } 275 276 277 int MPI_Issend_intercomm(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) 278 { 279 Debug("\nMPI_Issend_intercomm with EP\n"); 280 281 #ifdef _check_sum 282 check_sum_send(buf, count, datatype, dest, tag, comm); 283 #endif 284 285 int src_comm_label = comm->ep_comm_ptr->comm_label; 286 int dest_comm_label = comm->ep_comm_ptr->intercomm->intercomm_rank_map->at(dest).second.second; 287 288 int src_rank; 289 MPI_Comm_rank(comm, &src_rank); 290 291 292 *request = new ep_request; 293 memcheck("new "<< *request <<" : in ep_lib::MPI_Issend_intercomm, *request = new ep_request"); 294 295 (*request)->mpi_request = new ::MPI_Request; 296 memcheck("new "<< (*request)->mpi_request <<" : in ep_lib::MPI_Issend_intercomm, (*request)->mpi_request = new ::MPI_Request"); 297 298 299 int ep_src_loc = comm->ep_rank_map->at(src_rank).first; 300 int ep_dest_loc = comm->ep_comm_ptr->intercomm->intercomm_rank_map->at(dest).first; 301 int mpi_tag = tag_combine(tag, ep_src_loc, ep_dest_loc); 302 int mpi_dest = comm->ep_comm_ptr->intercomm->intercomm_rank_map->at(dest).second.first; 303 304 #ifdef _showinfo 305 printf("ep_src_loc = %d, ep_dest_loc = %d, mpi_src = %d, mpi_dest = %d, mpi_tag = %d\n", ep_src_loc, ep_dest_loc, comm->ep_comm_ptr->size_rank_info[2].first, mpi_dest, mpi_tag); 306 #endif 307 308 (*request)->ep_src = src_rank; 309 (*request)->ep_tag = tag; 310 (*request)->ep_datatype = datatype; 311 312 (*request)->type = 1; // used in wait 313 (*request)->comm = comm; 314 (*request)->buf = const_cast<void*>(buf); 315 316 317 if(src_comm_label == dest_comm_label) 197 318 { 198 int inter_src = comm.ep_comm_ptr->intercomm->local_rank_map->at(src_ep_rank).first; 199 int ep_src_loc = comm.rank_map->at(inter_src).first; 200 int ep_dest_loc = comm.rank_map->at(dest_remote_ep_rank).first; 201 int mpi_dest = comm.rank_map->at(dest_remote_ep_rank).second; 202 int mpi_tag = tag_combine(tag, ep_src_loc, ep_dest_loc); 203 204 ::MPI_Request mpi_request; 205 206 ::MPI_Isend(buf, count, to_mpi_type(datatype), mpi_dest, mpi_tag, to_mpi_comm(comm.mpi_comm), &mpi_request); 207 208 request->mpi_request = new ::MPI_Request(mpi_request); 209 request->type = 1; // used in wait 210 request->comm = comm; 211 212 request->ep_src = src_ep_rank; 213 request->ep_tag = tag; 214 request->ep_datatype = datatype; 319 Debug("\nMPI_Issend_intercomm with EP_intracomm\n"); 320 return ::MPI_Issend(buf, count, to_mpi_type(datatype), mpi_dest, mpi_tag, to_mpi_comm(comm->mpi_comm), to_mpi_request_ptr(*request)); 215 321 } 216 322 217 else // dest_remote_comm_label != src_comm_label 218 { 219 int inter_src = comm.ep_comm_ptr->intercomm->local_rank_map->at(src_ep_rank).first; 220 int ep_src_loc = comm.rank_map->at(inter_src).first; 221 int ep_dest_loc = comm.ep_comm_ptr->intercomm->intercomm_rank_map->at(dest_remote_ep_rank).first; 222 int mpi_dest = comm.ep_comm_ptr->intercomm->intercomm_rank_map->at(dest_remote_ep_rank).second; 223 int mpi_tag = tag_combine(tag, ep_src_loc, ep_dest_loc); 224 225 ::MPI_Request mpi_request; 226 227 ::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); 228 229 request->mpi_request = new ::MPI_Request(mpi_request); 230 request->type = 1; // used in wait 231 request->comm = comm; 232 233 request->ep_src = src_ep_rank; 234 request->ep_tag = tag; 235 request->ep_datatype = datatype; 323 else 324 { 325 Debug("\nMPI_Issend_intercomm with EP_intercomm\n"); 326 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)); 236 327 } 237 238 return 0;239 240 }241 242 243 int MPI_Issend_intercomm(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request)244 {245 Debug("MPI_Issend with intercomm\n");246 247 //check_sum_send(buf, count, datatype, dest, tag, comm, 1);248 249 int dest_remote_ep_rank = comm.ep_comm_ptr->intercomm->remote_rank_map->at(dest).first;250 int dest_remote_comm_label = comm.ep_comm_ptr->intercomm->remote_rank_map->at(dest).second;251 252 int src_ep_rank = comm.ep_comm_ptr->intercomm->size_rank_info[0].first;253 int src_comm_label;254 255 for(int i=0; i<comm.ep_comm_ptr->intercomm->local_rank_map->size(); i++)256 {257 if(comm.ep_comm_ptr->intercomm->local_rank_map->at(i).first == src_ep_rank)258 {259 src_comm_label = comm.ep_comm_ptr->intercomm->local_rank_map->at(i).second;260 break;261 }262 }263 264 //Message_Check(comm);265 266 267 if(dest_remote_comm_label == src_comm_label) // dest rank (loc, mpi) differs268 {269 int inter_src = comm.ep_comm_ptr->intercomm->local_rank_map->at(src_ep_rank).first;270 int ep_src_loc = comm.rank_map->at(inter_src).first;271 int ep_dest_loc = comm.rank_map->at(dest_remote_ep_rank).first;272 int mpi_dest = comm.rank_map->at(dest_remote_ep_rank).second;273 int mpi_tag = tag_combine(tag, ep_src_loc, ep_dest_loc);274 275 ::MPI_Request mpi_request;276 277 ::MPI_Issend(buf, count, to_mpi_type(datatype), mpi_dest, mpi_tag, to_mpi_comm(comm.mpi_comm), &mpi_request);278 279 request->mpi_request = new ::MPI_Request(mpi_request);280 request->type = 1; // used in wait281 request->comm = comm;282 283 request->ep_src = src_ep_rank;284 request->ep_tag = tag;285 request->ep_datatype = datatype;286 }287 288 else // dest_remote_comm_label != src_comm_label289 {290 int inter_src = comm.ep_comm_ptr->intercomm->local_rank_map->at(src_ep_rank).first;291 int ep_src_loc = comm.rank_map->at(inter_src).first;292 int ep_dest_loc = comm.ep_comm_ptr->intercomm->intercomm_rank_map->at(dest_remote_ep_rank).first;293 int mpi_dest = comm.ep_comm_ptr->intercomm->intercomm_rank_map->at(dest_remote_ep_rank).second;294 int mpi_tag = tag_combine(tag, ep_src_loc, ep_dest_loc);295 296 ::MPI_Request mpi_request;297 298 ::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);299 300 request->mpi_request = new ::MPI_Request(mpi_request);301 request->type = 1; // used in wait302 request->comm = comm;303 304 request->ep_src = src_ep_rank;305 request->ep_tag = tag;306 request->ep_datatype = datatype;307 }308 309 return 0;310 311 328 } 312 329
Note: See TracChangeset
for help on using the changeset viewer.