Ignore:
Timestamp:
05/31/18 16:32:39 (6 years ago)
Author:
yushan
Message:

save dev

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_send.cpp

    r1512 r1515  
    147147  int MPI_Send_intercomm(void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) 
    148148  { 
    149     Debug("\nMPI_Send with EP_Intercomm\n"); 
     149    Debug("\nMPI_Send_intercomm with EP\n"); 
    150150    MPI_Request request; 
    151151    MPI_Status status; 
     
    165165  int MPI_Ssend_intercomm(void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) 
    166166  { 
    167     Debug("\nMPI_Ssend with EP_Intercomm\n"); 
     167    Debug("\nMPI_Ssend_intercomm with EP\n"); 
    168168    MPI_Request request; 
    169169    MPI_Status status; 
     
    181181     
    182182    *request = new ep_request; 
    183     memcheck("new "<< *request <<" : in ep_lib::MPI_Isend, *request = new ep_request"); 
    184  
    185     (*request)->mpi_request = new ::MPI_Request; 
    186     memcheck("new "<< (*request)->mpi_request <<" : in ep_lib::MPI_Isend, (*request)->mpi_request = new ::MPI_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"); 
    187187       
    188188    (*request)->ep_src = src_rank; 
     
    197197  int MPI_Isend_intercomm(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) 
    198198  { 
    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 
    204  
    205     int dest_remote_ep_rank    = comm->ep_comm_ptr->intercomm->remote_rank_map->at(dest).first; 
    206     int dest_remote_comm_label = comm->ep_comm_ptr->intercomm->remote_rank_map->at(dest).second; 
    207  
    208     int src_ep_rank    = comm->ep_comm_ptr->intercomm->size_rank_info[0].first; 
    209     int src_comm_label; 
    210  
    211     src_comm_label = comm->ep_comm_ptr->intercomm->local_rank_map->at(src_ep_rank).second; 
    212     //Message_Check(comm); 
    213  
    214     if(dest_remote_comm_label == src_comm_label)       // mpi_dest differs 
     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("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) 
    215239    { 
    216       int inter_src = comm->ep_comm_ptr->intercomm->local_rank_map->at(src_ep_rank).first; 
    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; 
    220       int mpi_tag = tag_combine(tag, ep_src_loc, ep_dest_loc); 
    221  
    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        
    228       (*request)->type = 1;    // used in wait 
    229       (*request)->comm = comm; 
    230       (*request)->ep_src = src_ep_rank; 
    231       (*request)->ep_tag = tag; 
    232       (*request)->ep_datatype = datatype; 
    233  
     240      Debug("\nMPI_Isend_intercomm with EP_intracomm\n"); 
    234241      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  
    236242    } 
    237243 
    238     else   // dest_remote_comm_label != src_comm_label 
    239     {  
    240       int inter_src = comm->ep_comm_ptr->intercomm->local_rank_map->at(src_ep_rank).first; 
    241       int ep_src_loc = comm->ep_rank_map->at(inter_src).first; 
    242       int ep_dest_loc = comm->ep_comm_ptr->intercomm->inter_rank_map->at(dest_remote_ep_rank).first; 
    243       int mpi_dest    = comm->ep_comm_ptr->intercomm->inter_rank_map->at(dest_remote_ep_rank).second; 
    244       int mpi_tag = tag_combine(tag, ep_src_loc, ep_dest_loc); 
    245  
    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  
    252       (*request)->type = 1;    // used in wait 
    253       (*request)->comm = comm; 
    254       (*request)->ep_src = src_ep_rank; 
    255       (*request)->ep_tag = tag; 
    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));  
     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)); 
    259248    } 
    260249  } 
    261250 
     251 
     252 
     253 
    262254  int MPI_Issend_mpi(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) 
    263255  { 
     
    268260     
    269261    *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"); 
     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"); 
    274266       
    275267    (*request)->ep_src = src_rank; 
     
    285277  int MPI_Issend_intercomm(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) 
    286278  { 
    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 
    292  
    293     int dest_remote_ep_rank    = comm->ep_comm_ptr->intercomm->remote_rank_map->at(dest).first; 
    294     int dest_remote_comm_label = comm->ep_comm_ptr->intercomm->remote_rank_map->at(dest).second; 
    295  
    296     int src_ep_rank    = comm->ep_comm_ptr->intercomm->size_rank_info[0].first; 
    297     int src_comm_label; 
    298  
    299     src_comm_label = comm->ep_comm_ptr->intercomm->local_rank_map->at(src_ep_rank).second; 
    300     //Message_Check(comm); 
    301  
    302     if(dest_remote_comm_label == src_comm_label)       // mpi_dest differs 
     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) 
    303318    { 
    304       int inter_src = comm->ep_comm_ptr->intercomm->local_rank_map->at(src_ep_rank).first; 
    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; 
    308       int mpi_tag = tag_combine(tag, ep_src_loc, ep_dest_loc); 
    309  
    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        
    316       (*request)->type = 1;    // used in wait 
    317       (*request)->comm = comm; 
    318       (*request)->ep_src = src_ep_rank; 
    319       (*request)->ep_tag = tag; 
    320       (*request)->ep_datatype = datatype; 
    321  
     319      Debug("\nMPI_Issend_intercomm with EP_intracomm\n"); 
    322320      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  
    324321    } 
    325322 
    326     else   // dest_remote_comm_label != src_comm_label 
    327     {  
    328       int inter_src = comm->ep_comm_ptr->intercomm->local_rank_map->at(src_ep_rank).first; 
    329       int ep_src_loc = comm->ep_rank_map->at(inter_src).first; 
    330       int ep_dest_loc = comm->ep_comm_ptr->intercomm->inter_rank_map->at(dest_remote_ep_rank).first; 
    331       int mpi_dest    = comm->ep_comm_ptr->intercomm->inter_rank_map->at(dest_remote_ep_rank).second; 
    332       int mpi_tag = tag_combine(tag, ep_src_loc, ep_dest_loc); 
    333  
    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  
    340       (*request)->type = 1;    // used in wait 
    341       (*request)->comm = comm; 
    342       (*request)->ep_src = src_ep_rank; 
    343       (*request)->ep_tag = tag; 
    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));  
     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)); 
    347327    } 
    348328  } 
Note: See TracChangeset for help on using the changeset viewer.