Ignore:
Timestamp:
07/05/17 14:14:09 (7 years ago)
Author:
yushan
Message:

add request_check. test client and complete OK

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_yushan_merged/extern/src_ep_dev/ep_send.cpp

    r1185 r1196  
    5050    return 0; 
    5151  } 
     52   
     53  int MPI_Bsend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) 
     54  { 
     55    if(!comm.is_ep) 
     56    { 
     57      ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm > (comm.mpi_comm); 
     58      ::MPI_Bsend(buf, count, static_cast< ::MPI_Datatype>(datatype), dest, tag, mpi_comm); 
     59      return 0; 
     60    } 
     61 
     62    MPI_Request request; 
     63    MPI_Status status; 
     64    //MPI_Ibsend(buf, count, datatype, dest, tag, comm, &request); 
     65    MPI_Wait(&request, &status); 
     66 
     67    //check_sum_send(buf, count, datatype, dest, tag, comm); 
     68 
     69    return 0; 
     70  } 
     71  
    5272 
    5373 
     
    103123    request->buf = const_cast<void*>(buf); 
    104124 
    105     Message_Check(comm); 
     125    //Message_Check(comm); 
    106126 
    107127    return 0; 
     
    166186    return 0; 
    167187  } 
     188   
     189  int MPI_Ibsend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) 
     190  { 
     191    Debug("\nMPI_Isend with EP\n"); 
     192    int src_rank; 
     193    MPI_Comm_rank(comm, &src_rank); 
     194 
     195   
     196 
     197    if(!comm.is_ep) 
     198    { 
     199      ::MPI_Request mpi_request; 
     200      ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm > (comm.mpi_comm); 
     201      ::MPI_Ibsend(buf, count, static_cast< ::MPI_Datatype> (datatype), dest, tag, mpi_comm, &mpi_request); 
     202 
     203      request->mpi_request = mpi_request; 
     204 
     205      request->ep_src = src_rank; 
     206      request->ep_tag = tag; 
     207      request->ep_datatype = datatype; 
     208      request->type = 1; 
     209      request->comm = comm; 
     210 
     211      return 0; 
     212    } 
     213 
     214    if(comm.is_intercomm) return 0;//MPI_Ibsend_intercomm(buf, count, datatype, dest, tag, comm, request); 
     215 
     216   // EP intracomm 
     217 
     218    //check_sum_send(buf, count, datatype, dest, tag, comm, 1); 
     219 
     220    int ep_src_loc = comm.ep_comm_ptr->size_rank_info[1].first; 
     221    int ep_dest_loc = comm.ep_comm_ptr->comm_list->rank_map->at(dest).first; 
     222    int mpi_tag                 = tag_combine(tag, ep_src_loc, ep_dest_loc); 
     223    int mpi_dest        = comm.ep_comm_ptr->comm_list->rank_map->at(dest).second; 
     224 
     225    request->ep_src  = src_rank; 
     226    request->ep_tag  = tag; 
     227    request->ep_datatype = datatype; 
     228 
     229    ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm> (comm.mpi_comm); 
     230    ::MPI_Request mpi_request; 
     231 
     232    ::MPI_Ibsend(buf, count, static_cast< ::MPI_Datatype>(datatype), mpi_dest, mpi_tag, mpi_comm, &mpi_request); 
     233 
     234    request->mpi_request = mpi_request; 
     235    request->type = 1;          // used in wait 
     236    request->comm = comm; 
     237    request->buf = const_cast<void*>(buf); 
     238 
     239    //Message_Check(comm); 
     240 
     241    return 0;   
     242  } 
    168243 
    169244 
     
    190265    } 
    191266 
    192     Message_Check(comm); 
     267    //Message_Check(comm); 
    193268 
    194269 
     
    263338    } 
    264339 
    265     Message_Check(comm); 
     340    //Message_Check(comm); 
    266341 
    267342 
     
    313388 
    314389  } 
     390   
     391  int MPI_Ibsend_intercomm(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) 
     392  { 
     393    printf("MPI_Ibsend with intercomm not yet implemented\n"); 
     394    MPI_Abort(comm, 0); 
     395    //check_sum_send(buf, count, datatype, dest, tag, comm, 1); 
     396 
     397    int dest_remote_ep_rank    = comm.ep_comm_ptr->intercomm->remote_rank_map->at(dest).first; 
     398    int dest_remote_comm_label = comm.ep_comm_ptr->intercomm->remote_rank_map->at(dest).second; 
     399 
     400    int src_ep_rank    = comm.ep_comm_ptr->intercomm->size_rank_info[0].first; 
     401    int src_comm_label; 
     402 
     403    for(int i=0; i<comm.ep_comm_ptr->intercomm->local_rank_map->size(); i++) 
     404    { 
     405      if(comm.ep_comm_ptr->intercomm->local_rank_map->at(i).first == src_ep_rank) 
     406      { 
     407        src_comm_label = comm.ep_comm_ptr->intercomm->local_rank_map->at(i).second; 
     408        break; 
     409      } 
     410    } 
     411 
     412    //Message_Check(comm); 
     413 
     414 
     415    if(dest_remote_comm_label == src_comm_label)       // mpi_dest differs 
     416    { 
     417      int inter_src = comm.ep_comm_ptr->intercomm->local_rank_map->at(src_ep_rank).first; 
     418      int ep_src_loc = comm.rank_map->at(inter_src).first; 
     419      int ep_dest_loc = comm.rank_map->at(dest_remote_ep_rank).first; 
     420      int mpi_dest    = comm.rank_map->at(dest_remote_ep_rank).second; 
     421      int mpi_tag = tag_combine(tag, ep_src_loc, ep_dest_loc); 
     422 
     423      ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm > (comm.mpi_comm); 
     424      ::MPI_Request mpi_request; 
     425   
     426      ::MPI_Isend(buf, count, static_cast< ::MPI_Datatype >(datatype), mpi_dest, mpi_tag, mpi_comm, &mpi_request); 
     427 
     428      request->mpi_request = mpi_request; 
     429      request->type = 1;                // used in wait 
     430      request->comm = comm; 
     431 
     432      request->ep_src = src_ep_rank; 
     433      request->ep_tag = tag; 
     434      request->ep_datatype = datatype; 
     435    } 
     436 
     437    else   // dest_remote_comm_label != src_comm_label 
     438    {  
     439      int inter_src = comm.ep_comm_ptr->intercomm->local_rank_map->at(src_ep_rank).first; 
     440      int ep_src_loc = comm.rank_map->at(inter_src).first; 
     441      int ep_dest_loc = comm.ep_comm_ptr->intercomm->intercomm_rank_map->at(dest_remote_ep_rank).first; 
     442      int mpi_dest    = comm.ep_comm_ptr->intercomm->intercomm_rank_map->at(dest_remote_ep_rank).second; 
     443      int mpi_tag = tag_combine(tag, ep_src_loc, ep_dest_loc); 
     444 
     445      ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm >(comm.ep_comm_ptr->intercomm->mpi_inter_comm); 
     446      ::MPI_Request mpi_request; 
     447 
     448      ::MPI_Isend(buf, count, static_cast< ::MPI_Datatype >(datatype), mpi_dest, mpi_tag, mpi_comm, &mpi_request); 
     449 
     450      request->mpi_request = mpi_request; 
     451      request->type = 1;                // used in wait 
     452      request->comm = comm; 
     453    
     454      request->ep_src = src_ep_rank; 
     455      request->ep_tag = tag; 
     456      request->ep_datatype = datatype; 
     457    } 
     458 
     459    return 0; 
     460 
     461  } 
    315462} 
    316463 
     
    319466 
    320467 
     468 
Note: See TracChangeset for help on using the changeset viewer.