Ignore:
Timestamp:
05/28/18 09:54:32 (6 years ago)
Author:
yushan
Message:

save dev

File:
1 edited

Legend:

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

    r1381 r1500  
    1111    *flag = false; 
    1212 
    13     if(!comm.is_ep) 
     13    if(!comm->is_ep) 
    1414    { 
    1515      ::MPI_Status *mpi_status = static_cast< ::MPI_Status* >(status->mpi_status); 
    16       ::MPI_Iprobe(src<0? MPI_ANY_SOURCE : src, tag<0? MPI_ANY_TAG: tag, to_mpi_comm(comm.mpi_comm), flag, mpi_status); 
     16      ::MPI_Iprobe(src<0? MPI_ANY_SOURCE : src, tag<0? MPI_ANY_TAG: tag, to_mpi_comm(comm->mpi_comm), flag, mpi_status); 
    1717 
    1818      status->mpi_status = mpi_status; 
     
    2929 
    3030    #pragma omp critical (_query) 
    31     if(!comm.ep_comm_ptr->message_queue->empty()) 
     31    if(!comm->ep_comm_ptr->message_queue->empty()) 
    3232    { 
    33       for(Message_list::iterator it = comm.ep_comm_ptr->message_queue->begin(); it!= comm.ep_comm_ptr->message_queue->end(); ++it) 
     33      for(Message_list::iterator it = comm->ep_comm_ptr->message_queue->begin(); it!= comm->ep_comm_ptr->message_queue->end(); ++it) 
    3434      { 
    35         bool src_matched = src<0? true: it->ep_src == src; 
    36         bool tag_matched = tag<0? true: it->ep_tag == tag; 
     35        bool src_matched = src<0? true: (*it)->ep_src == src; 
     36        bool tag_matched = tag<0? true: (*it)->ep_tag == tag; 
    3737         
    3838        if(src_matched && tag_matched)         
     
    4141          *flag = true; 
    4242 
    43           ::MPI_Status mpi_status = *(static_cast< ::MPI_Status *>(it->mpi_status)); 
     43          ::MPI_Status mpi_status = *(static_cast< ::MPI_Status *>((*it)->mpi_status)); 
    4444 
    4545          status->mpi_status = new ::MPI_Status(mpi_status); 
    46           status->ep_src = it->ep_src; 
    47           status->ep_tag = it->ep_tag; 
     46          status->ep_src = (*it)->ep_src; 
     47          status->ep_tag = (*it)->ep_tag; 
    4848 
    4949          break; 
     
    6161  { 
    6262    *flag = false; 
    63     if(!comm.is_ep) 
     63    if(!comm->is_ep) 
    6464    { 
    6565      Debug("calling MPI_Improbe MPI\n"); 
     
    7171      #pragma omp critical (_mpi_call) 
    7272      { 
    73         ::MPI_Iprobe(src<0? MPI_ANY_SOURCE : src, tag<0? MPI_ANY_TAG: tag, to_mpi_comm(comm.mpi_comm), flag, &mpi_status); 
     73        ::MPI_Iprobe(src<0? MPI_ANY_SOURCE : src, tag<0? MPI_ANY_TAG: tag, to_mpi_comm(comm->mpi_comm), flag, &mpi_status); 
    7474        if(*flag) 
    7575        { 
    76           ::MPI_Mprobe(src<0? MPI_ANY_SOURCE : src, tag<0? MPI_ANY_TAG: tag, to_mpi_comm(comm.mpi_comm), &mpi_message, &mpi_status); 
     76          ::MPI_Mprobe(src<0? MPI_ANY_SOURCE : src, tag<0? MPI_ANY_TAG: tag, to_mpi_comm(comm->mpi_comm), &mpi_message, &mpi_status); 
    7777        } 
    7878      } 
    7979      #elif _intelmpi 
    80         ::MPI_Improbe(src<0? MPI_ANY_SOURCE : src, tag<0? MPI_ANY_TAG: tag, to_mpi_comm(comm.mpi_comm), flag, &mpi_message, &mpi_status); 
     80        ::MPI_Improbe(src<0? MPI_ANY_SOURCE : src, tag<0? MPI_ANY_TAG: tag, to_mpi_comm(comm->mpi_comm), flag, &mpi_message, &mpi_status); 
    8181      #endif 
    8282         
    83       status->mpi_status = new ::MPI_Status(mpi_status); 
     83      status->mpi_status = &mpi_status; 
    8484      status->ep_src = src; 
    8585      status->ep_tag = tag; 
    8686 
    87       message->mpi_message = new ::MPI_Message; 
    88       *(static_cast< ::MPI_Message*>(message->mpi_message)) = mpi_message; 
    89       message->ep_src = src; 
    90       message->ep_tag = tag; 
     87      (*message)->mpi_message = &message; 
     88      (*message)->ep_src = src; 
     89      (*message)->ep_tag = tag; 
     90       
     91       
    9192      return 0; 
    9293    } 
    9394 
    94      
    95     //Message_Check(comm); 
     95    
    9696 
    9797    #pragma omp flush 
    9898 
    9999    #pragma omp critical (_query) 
    100     if(! comm.ep_comm_ptr->message_queue->empty()) 
     100    if(! comm->ep_comm_ptr->message_queue->empty()) 
    101101    { 
    102       for(Message_list::iterator it = comm.ep_comm_ptr->message_queue->begin(); it!= comm.ep_comm_ptr->message_queue->end(); ++it) 
     102      for(Message_list::iterator it = comm->ep_comm_ptr->message_queue->begin(); it!= comm->ep_comm_ptr->message_queue->end(); ++it) 
    103103      { 
    104         bool src_matched = src<0? true: it->ep_src == src; 
    105         bool tag_matched = tag<0? true: it->ep_tag == tag; 
     104 
     105        //printf("in ep_lib::Improbe, it->mpi_message = %p, it->mpi_status = %p, it->ep_src = %d, it->ep_tag = %d\n",  
     106        //                            (*(*it))->mpi_message,(*(*it))->mpi_status,(*(*it))->ep_src,(*(*it))->ep_tag); 
     107                                           
     108        bool src_matched = src<0? true: (*it)->ep_src == src; 
     109        bool tag_matched = tag<0? true: (*it)->ep_tag == tag; 
    106110         
    107111        if(src_matched && tag_matched) 
     
    109113          *flag = true; 
    110114 
    111           ::MPI_Status mpi_status; 
    112           mpi_status = *(static_cast< ::MPI_Status *>(it->mpi_status)); 
     115          status->mpi_status = (*it)->mpi_status; 
     116          status->ep_src = (*it)->ep_src; 
     117          status->ep_tag = (*it)->ep_tag; 
    113118 
    114           status->mpi_status = new ::MPI_Status(mpi_status); 
    115           status->ep_src = it->ep_src; 
    116           status->ep_tag = it->ep_tag; 
    117  
    118           message->mpi_message = it->mpi_message; 
    119           message->ep_tag = it->ep_tag; 
    120           message->ep_src = it->ep_src; 
     119          (*message)->mpi_message = (*it)->mpi_message; 
     120          (*message)->ep_src = (*it)->ep_src; 
     121          (*message)->ep_tag = (*it)->ep_tag; 
     122           
     123          int test_count; 
     124          ::MPI_Get_count(to_mpi_status_ptr(status), 1275070475, &test_count); 
     125          printf("status = %p, test_count = %d\n", to_mpi_status_ptr(status), test_count); 
     126           
     127           
     128          ::MPI_Get_count(static_cast< ::MPI_Status* >(comm->ep_comm_ptr->message_queue->back()->mpi_status), 1275070475, &test_count); 
     129          printf("in ep_lib::Improbe, status = %p, test_count = %d\n", static_cast< ::MPI_Status* >(comm->ep_comm_ptr->message_queue->back()->mpi_status), test_count); 
     130                                       
    121131 
    122132          #pragma omp critical (_query2) 
    123133          {               
    124             delete it->mpi_status; 
    125             comm.ep_comm_ptr->message_queue->erase(it); 
     134            printf("delete %p : in ep_lib::Message_Check, delete (*it)->mpi_message\n", (*it)->mpi_message); 
     135            printf("delete %p : in ep_lib::Message_Check, delete (*it)->mpi_status\n", (*it)->mpi_status); 
     136            printf("delete %p : in ep_lib::Message_Check, delete (*it)\n", (*it)); 
     137             
     138            delete (*it)->mpi_message;      
     139            delete (*it)->mpi_status;  
     140            delete *it; 
     141             
     142            comm->ep_comm_ptr->message_queue->erase(it); 
     143            printf("message queue siez = %lu\n", comm->ep_comm_ptr->message_queue->size()); 
    126144            #pragma omp flush 
    127145          } 
    128  
     146           
    129147          break; 
    130148        } 
Note: See TracChangeset for help on using the changeset viewer.