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_recv.cpp

    r1187 r1196  
    1313using namespace std; 
    1414 
     15extern std::list< ep_lib::MPI_Request* > * EP_PendingRequests; 
     16#pragma omp threadprivate(EP_PendingRequests) 
    1517 
    1618namespace ep_lib  
     
    5456    int dest_rank; 
    5557    MPI_Comm_rank(comm, &dest_rank); 
     58    int world_rank; 
     59    MPI_Comm_rank(MPI_COMM_WORLD_STD, &world_rank); 
    5660 
    5761    if(!comm.is_ep) 
     
    8387    if(EP_PendingRequests == 0 )  
    8488    { 
    85       EP_PendingRequests = new std::list< MPI_Request* >;  
    86       printf("proc %d : EP_PendingRequests allocated, add = %p\n", dest_rank, EP_PendingRequests);   
     89      EP_PendingRequests = new std::list< MPI_Request* >; 
     90      //printf("proc %d(%d) : EP_PendingRequests allocated, add = %p\n", dest_rank, world_rank, EP_PendingRequests);   
    8791    } 
    8892 
    89     request->pending_ptr = EP_PendingRequests; 
    90     printf("proc %d : &EP_PendingRequests add = %p, ptr = %p\n", dest_rank, EP_PendingRequests, request->pending_ptr);   
     93 
     94    EP_PendingRequests->push_back(request); 
     95 
     96    Request_Check(); 
     97    //printf("proc %d(%d) : EP_PendingRequests insert one request, src = %d(%d), tag = %d(%d), size = %d; request add = %p\n",  
     98    //        dest_rank, world_rank, EP_PendingRequests->back()->ep_src, request->ep_src,  
     99    //        EP_PendingRequests->back()->ep_tag, request->ep_tag,  
     100    //        EP_PendingRequests->size(), request); 
    91101     
    92     EP_PendingRequests->push_back(request); 
    93     //printf("proc %d : EP_PendingRequests insert one request, src = %d, tag = %d, size = %d\n", dest_rank, request->ep_src, request->ep_tag, EP_PendingRequests->size()); 
     102    // check all EP_PendingRequests       
     103    //for(std::list<MPI_Request* >::iterator it = EP_PendingRequests->begin(); it!=EP_PendingRequests->end(); ) 
     104    //{ 
     105    //if((*it)->type == 3)  
     106    //{ 
     107    //    EP_PendingRequests->erase(it); 
     108   //     it = EP_PendingRequests->begin(); 
     109    //    continue; 
     110     // } 
     111         
     112      //int probed = false; 
     113      //MPI_Message pending_message; 
     114      //MPI_Status pending_status; 
    94115     
    95     // check all EP_PendingRequests 
     116      //MPI_Improbe((*it)->ep_src, (*it)->ep_tag, (*it)->comm, &probed, &pending_message, &pending_status); 
    96117     
    97     //printf("proc %d have %d pending irecv request\n", dest_rank, EP_PendingRequests->size()); 
    98        
    99     for(std::list<MPI_Request* >::iterator it = EP_PendingRequests->begin(); it!=EP_PendingRequests->end(); ) 
    100     { 
    101       if((*it)->type == 3)  
    102       { 
    103         //printf("proc %d : pending request type = %d, src= %d, tag = %d    skip\n", dest_rank, (*it)->type, (*it)->ep_src, (*it)->ep_tag); 
    104         EP_PendingRequests->erase(it); 
    105         it = EP_PendingRequests->begin(); 
    106         //printf("proc %d : pending request processed, size = %d\n", dest_rank, EP_PendingRequests->size()); 
    107         continue; 
    108       } 
     118      //if(probed)  
     119      //{  
     120        //int count; 
     121        //MPI_Get_count(&pending_status, (*it)->ep_datatype, &count); 
     122        //MPI_Imrecv((*it)->buf, count, (*it)->ep_datatype, &pending_message, *it); 
     123 
     124        //EP_PendingRequests->erase(it); 
     125        //if(EP_PendingRequests->empty()) return 0; 
    109126         
    110       //printf("proc %d : pending irecv request src = %d, tag = %d, type = %d\n", dest_rank, (*it)->ep_src, (*it)->ep_tag, (*it)->type); 
    111       int probed = false; 
    112       MPI_Message pending_message; 
    113       MPI_Status pending_status; 
    114      
    115       MPI_Improbe((*it)->ep_src, (*it)->ep_tag, (*it)->comm, &probed, &pending_message, &pending_status); 
    116       //printf("proc %d : pending irecv request probed to be %d, src = %d, tag = %d\n",dest_rank, probed, (*it)->ep_src, (*it)->ep_tag); 
    117      
    118       if(probed)  
    119       {  
    120         int count; 
    121         MPI_Get_count(&pending_status, (*it)->ep_datatype, &count); 
    122         MPI_Imrecv((*it)->buf, count, (*it)->ep_datatype, &pending_message, *it); 
    123         //printf("proc %d : pending request is imrecving src = %d, tag = %d, count = %d\n", dest_rank, (*it)->ep_src, (*it)->ep_tag, count); 
    124         EP_PendingRequests->erase(it); 
    125         it = EP_PendingRequests->begin(); 
    126         //printf("proc %d : pending request processed, size = %d\n", dest_rank, EP_PendingRequests->size()); 
    127         continue; 
    128       } 
     127        //it = EP_PendingRequests->begin(); 
     128        //continue; 
     129     // } 
    129130 
    130       it++; 
    131     } 
     131      //it++; 
     132   // } 
    132133     
    133134    return 0; 
     
    149150    request->ep_tag = message->ep_tag; 
    150151    request->ep_src = message->ep_src; 
    151     //request->buf = buf; 
    152152 
    153153    return 0; 
     
    177177 
    178178 
     179 
Note: See TracChangeset for help on using the changeset viewer.