13 int first = -1, next = -1;
15 explicit MsgRange(
int m_first) : first(m_first), next(first) {}
17 bool valid()
const {
return 0 <= first && first <= next; }
19 bool empty()
const {
return 0 <= first && first == next; }
21 bool fresh()
const {
return 0 == first && first == next; }
22 std::string str()
const {
23 return "[" + std::to_string(first) +
"," + std::to_string(next) +
")";
32 bool valid()
const {
return id >= 0 && send.valid() && recv.valid(); }
34 bool empty()
const {
return id >= 0 && send.empty() && recv.empty(); }
36 bool fresh()
const {
return id >= 0 && send.fresh() && recv.fresh(); }
39 explicit Region(
int m_id) : id(m_id) {}
40 Region(
int m_id,
int first_send,
int first_recv)
41 : id(m_id), send(first_send), recv(first_recv) {}
46 auto operator<=>(
const Region& o)
const {
return id <=> o.id; }
47 auto operator<=>(
const int& i)
const {
return id <=> i; }
48 auto operator==(
const Region& o)
const {
return id == o.id; }
49 auto operator==(
const int& i)
const {
return id == i; }
50 std::string str()
const {
51 return "Region " + std::to_string(
id) +
" (send:" + send.str() +
52 ",recv:" + recv.str() +
")";
61 void serialize(std::ostream& o)
const;
69 void begin_region(
int region_id);
72 void reset_consistency(
int target_region);
74 void reply_consistency();
76 void fenix_pre_recovery() { task =
TaskT(); }
77 int send(
const void* b,
int n, MPI_Datatype d,
int t);
78 int irecv(
void* b,
int n, MPI_Datatype d,
int t, MPI_Request* r);
81 std::string str()
const;
84 TaskT form_consistency();
85 void ensure_consistency();
87 const SendLog& log_send(
const void* b,
int n, MPI_Datatype d,
int t);
88 void replay_messages();
90 void append_region(
const Region& r);
91 void erase_sends(
const Region& r);
93 std::vector<Region>::iterator begin, std::vector<Region>::iterator end
97 void check_consistent(std::vector<Region>& a, std::vector<Region>& b);
98 void recover_invalid(std::vector<Region>& a, std::vector<Region>& b);
100 std::set<SendLog, std::less<>> sends;
102 int already_sent = -1;
105 std::vector<Region> regions;
108 Region& cur_region = regions.back();
109 int& next_send = cur_region.send.next;
110 int& next_recv = cur_region.recv.next;