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