mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-01-01 12:06:54 -06:00
fixed: avoid deadlocks in parallel if serialization throws
This commit is contained in:
parent
2c447ae829
commit
49cc70f49c
@ -321,12 +321,21 @@ public:
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_comm.rank() == 0) {
|
if (m_comm.rank() == 0) {
|
||||||
pack(data);
|
try {
|
||||||
m_packSize = m_position;
|
pack(data);
|
||||||
m_comm.broadcast(&m_packSize, 1, 0);
|
m_packSize = m_position;
|
||||||
m_comm.broadcast(m_buffer.data(), m_position, 0);
|
m_comm.broadcast(&m_packSize, 1, 0);
|
||||||
|
m_comm.broadcast(m_buffer.data(), m_position, 0);
|
||||||
|
} catch (...) {
|
||||||
|
m_packSize = std::numeric_limits<size_t>::max();
|
||||||
|
m_comm.broadcast(&m_packSize, 1, 0);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
m_comm.broadcast(&m_packSize, 1, 0);
|
m_comm.broadcast(&m_packSize, 1, 0);
|
||||||
|
if (m_packSize == std::numeric_limits<size_t>::max()) {
|
||||||
|
throw std::runtime_error("Error detected in parallel serialization");
|
||||||
|
}
|
||||||
m_buffer.resize(m_packSize);
|
m_buffer.resize(m_packSize);
|
||||||
m_comm.broadcast(m_buffer.data(), m_packSize, 0);
|
m_comm.broadcast(m_buffer.data(), m_packSize, 0);
|
||||||
unpack(data);
|
unpack(data);
|
||||||
|
Loading…
Reference in New Issue
Block a user