Changeset 1527 for XIOS/dev/branch_openmp/extern/ep_dev/ep_send.cpp
- Timestamp:
- 06/08/18 15:59:53 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_openmp/extern/ep_dev/ep_send.cpp
r1518 r1527 18 18 { 19 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);20 if(comm->is_intercomm) dest = comm->inter_rank_map->at(dest); 21 21 22 22 Debug("\nMPI_Send with EP\n"); … … 38 38 { 39 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);40 if(comm->is_intercomm) dest = comm->inter_rank_map->at(dest); 41 41 42 42 Debug("\nMPI_Ssend with EP\n"); … … 61 61 { 62 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);63 if(comm->is_intercomm) dest = comm->inter_rank_map->at(dest); 64 64 65 65 Debug("\nMPI_Isend with EP\n"); … … 104 104 105 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);106 if(comm->is_intercomm) dest = comm->inter_rank_map->at(dest); 107 107 108 108 Debug("\nMPI_Issend with EP\n"); … … 144 144 return ::MPI_Send(buf, count, to_mpi_type(datatype), dest, tag, to_mpi_comm(comm->mpi_comm)); 145 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 146 157 147 158 148 int MPI_Ssend_mpi(void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) … … 163 153 164 154 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");168 MPI_Request request;169 MPI_Status status;170 MPI_Issend(buf, count, datatype, dest, tag, comm, &request);171 MPI_Wait(&request, &status);172 return MPI_SUCCESS;173 }174 175 155 int MPI_Isend_mpi(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) 176 156 { … … 195 175 } 196 176 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) 239 { 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)); 242 } 243 244 else 245 { 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)); 248 } 249 } 250 251 177 252 178 253 179 … … 275 201 276 202 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_sum282 check_sum_send(buf, count, datatype, dest, tag, comm);283 #endif284 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 _showinfo305 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 #endif307 308 (*request)->ep_src = src_rank;309 (*request)->ep_tag = tag;310 (*request)->ep_datatype = datatype;311 312 (*request)->type = 1; // used in wait313 (*request)->comm = comm;314 (*request)->buf = const_cast<void*>(buf);315 316 317 if(src_comm_label == dest_comm_label)318 {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));321 }322 323 else324 {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));327 }328 }329 330 203 } 331 204
Note: See TracChangeset
for help on using the changeset viewer.