Re: [Boost-bugs] [Boost C++ Libraries] #13043: Serialized MPI doesn't properly handle cancellation of a request

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #13043: Serialized MPI doesn't properly handle cancellation of a request
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-06-05 13:24:20


#13043: Serialized MPI doesn't properly handle cancellation of a request
-------------------------------------------------+---------------------
  Reporter: Mike Willaims <michael.williams@…> | Owner: troyer
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: mpi
   Version: Boost 1.62.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------------------------+---------------------

Comment (by michael.williams@…):

 I was wrong. It's simpler than all that. Sorry.

 {{{

 template<typename T>
 optional<status>
 request::handle_serialized_irecv(request* self, request_action action)
 {
   typedef detail::serialized_irecv_data<T> data_t;
   shared_ptr<data_t> data = static_pointer_cast<data_t>(self->m_data);
   if (action == ra_wait) {
           status stat;
     if (self->m_requests[1] == MPI_REQUEST_NULL) {
       // Wait for the count message to complete
       BOOST_MPI_CHECK_RESULT(MPI_Wait,
                              (self->m_requests, &stat.m_status));
           if (stat.cancelled())
           {
                   return stat;
           }
       // Resize our buffer and get ready to receive its data
       data->ia.resize(data->count);
       BOOST_MPI_CHECK_RESULT(MPI_Irecv,
                              (data->ia.address(), data->ia.size(),
 MPI_PACKED,
                               stat.source(), stat.tag(),
                               MPI_Comm(data->comm), self->m_requests +
 1));
     }

     // Wait until we have received the entire message
     BOOST_MPI_CHECK_RESULT(MPI_Wait,
                            (self->m_requests + 1, &stat.m_status));
         if (stat.cancelled())
         {
                 return stat;
         }
     data->deserialize(stat);
     return stat;
   } else if (action == ra_test) {
     status stat;
     int flag = 0;
     if (self->m_requests[1] == MPI_REQUEST_NULL) {
       // Check if the count message has completed
       BOOST_MPI_CHECK_RESULT(MPI_Test,
                              (self->m_requests, &flag, &stat.m_status));
       if (flag) {
                 if (stat.cancelled())
                 {
                         return stat;
                 }
         // Resize our buffer and get ready to receive its data
         data->ia.resize(data->count);
         BOOST_MPI_CHECK_RESULT(MPI_Irecv,
                                (data->ia.address(),
 data->ia.size(),MPI_PACKED,
                                 stat.source(), stat.tag(),
                                 MPI_Comm(data->comm), self->m_requests +
 1));
       } else
         return optional<status>(); // We have not finished yet
     }

     // Check if we have received the message data
     BOOST_MPI_CHECK_RESULT(MPI_Test,
                            (self->m_requests + 1, &flag, &stat.m_status));
     if (flag) {
       if (stat.cancelled())
           {
                   return stat;
           }
       data->deserialize(stat);
       return stat;
     } else
       return optional<status>();
   }
   else if (action == ra_cancel)
   {
           status stat;
           if (self->m_requests[0] != MPI_REQUEST_NULL)
           {
                   BOOST_MPI_CHECK_RESULT(MPI_Cancel,
 (&self->m_requests[0]));
           }
           if (self->m_requests[1] != MPI_REQUEST_NULL)
           {
                   BOOST_MPI_CHECK_RESULT(MPI_Cancel,
 (&self->m_requests[0]));
           }
           return optional<status>();
   }
   else
   {
     return optional<status>();
   }
 }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/13043#comment:4>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-06-05 13:27:43 UTC