Changeset 1500 for XIOS/dev/branch_openmp/extern/ep_dev/ep_probe.cpp
- Timestamp:
- 05/28/18 09:54:32 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_openmp/extern/ep_dev/ep_probe.cpp
r1381 r1500 11 11 *flag = false; 12 12 13 if(!comm .is_ep)13 if(!comm->is_ep) 14 14 { 15 15 ::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); 17 17 18 18 status->mpi_status = mpi_status; … … 29 29 30 30 #pragma omp critical (_query) 31 if(!comm .ep_comm_ptr->message_queue->empty())31 if(!comm->ep_comm_ptr->message_queue->empty()) 32 32 { 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) 34 34 { 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; 37 37 38 38 if(src_matched && tag_matched) … … 41 41 *flag = true; 42 42 43 ::MPI_Status mpi_status = *(static_cast< ::MPI_Status *>( it->mpi_status));43 ::MPI_Status mpi_status = *(static_cast< ::MPI_Status *>((*it)->mpi_status)); 44 44 45 45 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; 48 48 49 49 break; … … 61 61 { 62 62 *flag = false; 63 if(!comm .is_ep)63 if(!comm->is_ep) 64 64 { 65 65 Debug("calling MPI_Improbe MPI\n"); … … 71 71 #pragma omp critical (_mpi_call) 72 72 { 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); 74 74 if(*flag) 75 75 { 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); 77 77 } 78 78 } 79 79 #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); 81 81 #endif 82 82 83 status->mpi_status = new ::MPI_Status(mpi_status);83 status->mpi_status = &mpi_status; 84 84 status->ep_src = src; 85 85 status->ep_tag = tag; 86 86 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 91 92 return 0; 92 93 } 93 94 94 95 //Message_Check(comm); 95 96 96 97 97 #pragma omp flush 98 98 99 99 #pragma omp critical (_query) 100 if(! comm .ep_comm_ptr->message_queue->empty())100 if(! comm->ep_comm_ptr->message_queue->empty()) 101 101 { 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) 103 103 { 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; 106 110 107 111 if(src_matched && tag_matched) … … 109 113 *flag = true; 110 114 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; 113 118 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 121 131 122 132 #pragma omp critical (_query2) 123 133 { 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()); 126 144 #pragma omp flush 127 145 } 128 146 129 147 break; 130 148 }
Note: See TracChangeset
for help on using the changeset viewer.