Commit 1c6afabe authored by Samuel Debionne's avatar Samuel Debionne

Add MPI patch for request::cancel()

parent 5dc400ae
Pipeline #12481 passed with stages
in 29 minutes and 42 seconds
......@@ -11,10 +11,11 @@ source:
patches:
- build.patch
- hana.patch
- mpi.patch
- serialization.patch
build:
number: 2
number: 3
requirements:
build:
......
diff --git a/boost/mpi/communicator.hpp b/boost/mpi/communicator.hpp
index 6e55b16..5bcd985 100644
--- a/boost/mpi/communicator.hpp
+++ b/boost/mpi/communicator.hpp
@@ -1760,6 +1760,8 @@ request::handle_serialized_irecv(request* self, request_action action)
// 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,
@@ -1772,6 +1774,8 @@ request::handle_serialized_irecv(request* self, request_action action)
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) {
@@ -1783,6 +1787,9 @@ request::handle_serialized_irecv(request* self, request_action action)
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,
@@ -1797,11 +1804,22 @@ request::handle_serialized_irecv(request* self, request_action action)
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 {
+ }
+ 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>();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment