Cancelling request fails for serialized communication
- Dominant language
- C++
- Stars
- 64
- Forks
- 65
- PR merge metrics
- No merged PRs in 30d
Description
I believe this is a regression from 1.70.
In the following code, an asynchronous recv is initiated then later an other thread marks the operation for cancellation (and that should guarantee `wait()` to return according to the spec).
This works for fundamental type (such as `int`) but not for serialized types.
```c++
#include
#include
#include
#include
#include
using namespace std::literals::chrono_literals;
namespace mpi = boost::mpi;
void async_cancel(boost::mpi::request request)
{
std::this_thread::sleep_for(1s);
std::cout << "Before MPI_Cancel" << std::endl;
request.cancel();
std::cout << "After MPI_Cancel" << std::endl;
}
struct data
{
int i;
};
template
void serialize(Archive& ar, data& t, const unsigned int version)
{
ar & t.i;
}
int main(int argc, char* argv[])
{
mpi::environment env(mpi::threading::level::multiple);
mpi::communicator world;
if (world.rank() == 0)
{
//int buffer; // WORKS
data buffer; // FAILS
auto request = world.irecv(0, 0, buffer);
auto res = std::async(std::launch::async, &async_cancel, request);
std::cout << "Before MPI_Wait" << std::endl;
auto status = request.wait();
std::cout << "After MPI_Wait " << std::endl;
}
else
std::this_thread::sleep_for(2s);
return 0;
}
```
The expected result is:
```
Before MPI_Wait
Before MPI_Cancel
After MPI_Cancel
After MPI_Wait
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.