Fenix @develop
 
Loading...
Searching...
No Matches
send_log.h
1#ifndef FENIX_LOGGING_OPS_SEND_LOG_H
2#define FENIX_LOGGING_OPS_SEND_LOG_H
3#include <cstring>
4#include <istream>
5#include <ostream>
6#include "fenix/mpi_util.hpp"
7#include "fenix/logging/serialize.h"
8#include "fenix/logging/op_log.h"
9
10namespace fenix::logging {
11
12class SendLog : public OpLog {
13 public:
14 SendLog(const void* b, int n, MPI_Datatype d, int t, int idx)
15 : OpLog(idx), buf(MPIBuffer::copy(b, n, d)), tag(t) {}
16 ~SendLog() = default;
17
18 SendLog(SendLog&& o) { *this = std::move(o); }
19 SendLog& operator=(SendLog&& o) {
20 OpLog::operator=(std::move(o));
21 buf = std::move(o.buf);
22 tag = o.tag;
23 return *this;
24 }
25
26 SendLog(std::istream& i) : OpLog(i) {
27 serialize::read(i, buf);
28 serialize::read(i, tag);
29 }
30 void serialize_impl(std::ostream& s) const override {
31 serialize::write(s, buf);
32 serialize::write(s, tag);
33 }
34
35 int isend(int dst, MPI_Comm c) const {
36 req_free();
37 return PMPI_Isend(buf, buf, buf, dst, tag, c, req());
38 }
39
40 std::string str() const override {
41 return "Send " + std::to_string(m_idx) + " (tag " + std::to_string(tag) +
42 ")";
43 }
44
45 private:
46 MPIBuffer buf;
47 int tag;
48};
49
50} //namespace fenix::logging
51#endif
Definition op_log.h:93
Definition op_log.h:18
Definition send_log.h:12