Fenix @develop
 
Loading...
Searching...
No Matches
barrier_log.h
1#ifndef FENIX_LOGGING_OPS_BARRIER_LOG_H
2#define FENIX_LOGGING_OPS_BARRIER_LOG_H
3#include <cstring>
4#include <istream>
5#include <ostream>
6#include "fenix/logging/op_log.h"
7
8namespace fenix::logging {
9
10class BarrierLog : public CollectiveLog {
11 public:
12 BarrierLog(MPI_Comm, int idx) : CollectiveLog(idx) {}
13 BarrierLog(std::istream& i) : CollectiveLog(i) {}
14 BarrierLog(BarrierLog&& o) { *this = std::move(o); }
15 BarrierLog& operator=(BarrierLog&& o) {
16 CollectiveLog::operator=(std::move(o));
17 return *this;
18 }
19
20 ~BarrierLog() = default;
21
22 void serialize_impl(std::ostream& s) const override {}
23
24 std::string str() const override {
25 return "Barrier " + std::to_string(m_idx);
26 }
27
28 int begin(MPI_Comm c) const override {
29 // We need to convert to an Ibarrier to correctly match with the Ibarriers
30 // during replay
31 req_free();
32 int ret = PMPI_Ibarrier(c, req());
33 if (ret == MPI_SUCCESS) ret = PMPI_Wait(req(), MPI_STATUS_IGNORE);
34 return ret;
35 }
36
37 void replay(MPI_Comm c) const override {
38 req_free();
39 int ret = PMPI_Ibarrier(c, req());
40 fenix_assert(
41 ret == MPI_SUCCESS, "Non-process MPI error during collective replay\n"
42 );
43 }
44};
45
46template <>
47struct mpi_log<MPI_Barrier> {
48 using type = BarrierLog;
49};
50
51} //namespace fenix::logging
52#endif
Definition barrier_log.h:10
Definition op_log.h:76
Definition op_log.h:71