Ignore:
Timestamp:
06/08/18 17:23:42 (6 years ago)
Author:
yushan
Message:

save dev.

Location:
XIOS/dev/branch_openmp/extern/ep_dev
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_lib_endpoint.hpp

    r1527 r1532  
    1616   
    1717  int MPI_Comm_dup_endpoint(MPI_Comm comm, MPI_Comm *newcomm); 
     18   
     19  int MPI_Iprobe_endpoint(int source, int tag, MPI_Comm comm, int *flag, MPI_Status *status); 
     20  int MPI_Improbe_endpoint(int source, int tag, MPI_Comm comm, int *flag, MPI_Message *message, MPI_Status *status); 
    1821 
    1922} 
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_message.cpp

    r1527 r1532  
    6767        #pragma omp critical (_query0) 
    6868        { 
    69           MPI_Iprobe((*(*it))->ep_src, (*(*it))->ep_tag, ((*(*it))->comm), &probed, &status); 
     69          MPI_Iprobe_endpoint((*(*it))->ep_src, (*(*it))->ep_tag, ((*(*it))->comm), &probed, &status); 
    7070          if(probed) 
    7171          { 
     
    7777           
    7878           
    79             MPI_Improbe((*(*it))->ep_src, (*(*it))->ep_tag, (*(*it))->comm, &probed, message, &status); 
     79            MPI_Improbe_endpoint((*(*it))->ep_src, (*(*it))->ep_tag, (*(*it))->comm, &probed, message, &status); 
    8080         
    8181          } 
     
    196196        continue; 
    197197      } 
    198        
    199       if((*(*it))->state == 2) 
    200       { 
    201         EP_PendingRequests->erase(it); 
    202          
    203         memcheck("EP_PendingRequests["<<ep_rank<<"]->size() = " << EP_PendingRequests->size()); 
    204         it = EP_PendingRequests->begin(); 
    205         continue; 
    206       } 
    207198           
    208199      if((*(*it))->ep_src>6) 
     
    217208 
    218209} 
     210 
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_probe.cpp

    r1527 r1532  
    4646 
    4747 
    48  
    49  
    5048  int MPI_Iprobe(int src, int tag, MPI_Comm comm, int *flag, MPI_Status *status) 
    5149  { 
     
    5553      return MPI_Iprobe_mpi(src, tag, comm, flag, status); 
    5654    } 
     55 
     56    if(comm->is_intercomm) 
     57    { 
     58      src = comm->inter_rank_map->at(src); 
     59    }  
    5760     
    58     else 
     61    return MPI_Iprobe_endpoint(src, tag, comm, flag, status); 
     62  } 
     63 
     64  int MPI_Iprobe_endpoint(int src, int tag, MPI_Comm comm, int *flag, MPI_Status *status) 
     65  { 
     66    Debug("MPI_Iprobe with EP\n"); 
     67 
     68    *flag = false; 
     69     
     70    Message_Check(comm); 
     71 
     72    #pragma omp flush 
     73 
     74    #pragma omp critical (_query) 
     75    for(Message_list::iterator it = comm->ep_comm_ptr->message_queue->begin(); it!= comm->ep_comm_ptr->message_queue->end(); ++it) 
    5976    { 
    60       Debug("MPI_Iprobe with EP\n"); 
     77      bool src_matched = src<0? true: (*it)->ep_src == src; 
     78      bool tag_matched = tag<0? true: (*it)->ep_tag == tag; 
     79       
     80      if(src_matched && tag_matched)         
     81      { 
     82        Debug("find message\n"); 
     83          
     84        status->mpi_status = new ::MPI_Status(*static_cast< ::MPI_Status*>((*it)->mpi_status)); 
     85        status->ep_src = (*it)->ep_src; 
     86        status->ep_tag = (*it)->ep_tag; 
    6187 
    62       *flag = false; 
    63      
    64       Message_Check(comm); 
    65  
    66       #pragma omp flush 
    67  
    68       #pragma omp critical (_query) 
    69       for(Message_list::iterator it = comm->ep_comm_ptr->message_queue->begin(); it!= comm->ep_comm_ptr->message_queue->end(); ++it) 
    70       { 
    71         bool src_matched = src<0? true: (*it)->ep_src == src; 
    72         bool tag_matched = tag<0? true: (*it)->ep_tag == tag; 
    73          
    74         if(src_matched && tag_matched)         
    75         { 
    76           Debug("find message\n"); 
    77            
    78  
    79           status->mpi_status = new ::MPI_Status(*static_cast< ::MPI_Status*>((*it)->mpi_status)); 
    80           status->ep_src = (*it)->ep_src; 
    81           status->ep_tag = (*it)->ep_tag; 
    82  
    83           *flag = true; 
    84           break; 
    85         } 
     88        *flag = true; 
     89        break; 
    8690      } 
    8791    } 
     
    9094   
    9195 
     96  int MPI_Improbe(int src, int tag, MPI_Comm comm, int *flag, MPI_Message *message, MPI_Status *status) 
     97  { 
     98    if(!comm->is_ep) 
     99    { 
     100      Debug("MPI_Iprobe with MPI\n"); 
     101      return MPI_Improbe_mpi(src, tag, comm, flag, message, status); 
     102    } 
     103 
     104    if(comm->is_intercomm) 
     105    { 
     106      src = comm->inter_rank_map->at(src); 
     107      *message = new ep_message; 
     108      printf("============= new *message = %p\n", *message); 
     109    }  
     110     
     111    return MPI_Improbe_endpoint(src, tag, comm, flag, message, status); 
     112  } 
    92113 
    93114 
    94   int MPI_Improbe(int src, int tag, MPI_Comm comm, int *flag, MPI_Message *message, MPI_Status *status) 
     115 
     116  int MPI_Improbe_endpoint(int src, int tag, MPI_Comm comm, int *flag, MPI_Message *message, MPI_Status *status) 
    95117  { 
    96118    int ep_rank_loc = comm->ep_comm_ptr->size_rank_info[1].first; 
    97119    int mpi_rank    = comm->ep_comm_ptr->size_rank_info[2].first; 
     120 
    98121    *flag = false; 
    99     if(!comm->is_ep) 
    100     { 
    101       Debug("calling MPI_Improbe MPI\n"); 
    102       return MPI_Improbe_mpi(src, tag, comm, flag, message, status); 
    103     }  
    104  
     122     
     123    Message_Check(comm); 
     124     
    105125    #pragma omp flush 
    106126 
     
    155175} 
    156176 
     177 
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_recv.cpp

    r1527 r1532  
    106106    memcheck("delete " << (*message)->mpi_message << " : in ep_lib::MPI_Mrecv, delete (*message)->mpi_message"); 
    107107    delete (*message)->mpi_message; 
     108    memcheck("delete " << *message << " : in ep_lib::MPI_Imrecv, delete *message"); 
     109    delete *message; 
    108110 
    109111#ifdef _check_sum 
     
    130132    memcheck("delete " << (*message)->mpi_message << " : in ep_lib::MPI_Imrecv, delete (*message)->mpi_message"); 
    131133    delete (*message)->mpi_message; 
     134 
    132135 
    133136#ifdef _check_sum 
  • XIOS/dev/branch_openmp/extern/ep_dev/main.cpp

    r1527 r1532  
    144144 
    145145      if(rank == 0) printf("            \t Test iP2P for intercomm \t OK\n"); 
     146 
     147      if(color==2 && split_rank==0) 
     148      { 
     149        double sendbuf[9]={1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9}; 
     150        MPI_Request send_request; 
     151        MPI_Status send_status; 
     152        MPI_Isend(sendbuf, 9, MPI_DOUBLE, 0, 10, inter_comm, &send_request); 
     153        MPI_Wait(&send_request, &send_status); 
     154      } 
     155 
     156      if(color==1 && split_rank==0) 
     157      { 
     158        double recvbuf[9]; 
     159        MPI_Request recv_request; 
     160        MPI_Status recv_status; 
     161        int probed = false; 
     162        MPI_Message message; 
     163        while(!probed) 
     164        { 
     165          MPI_Improbe(0, 10, inter_comm, &probed, &message, &recv_status);   
     166        } 
     167        MPI_Mrecv(recvbuf, 9, MPI_DOUBLE, &message, &recv_status); 
     168        for(int i=0; i<9; i++) 
     169        { 
     170          printf("==========recvbuf[%d] = %lf\n", i, recvbuf[i]); 
     171        } 
     172      } 
     173 
     174 
    146175 
    147176 
     
    15461575 
    15471576} 
     1577 
Note: See TracChangeset for help on using the changeset viewer.