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