Fenix
@develop
Loading...
Searching...
No Matches
irecv_log.h
1
#ifndef FENIX_LOGGING_OPS_IRECV_LOG_H
2
#define FENIX_LOGGING_OPS_IRECV_LOG_H
3
4
#include <cstring>
5
#include <string>
6
#include <mpi.h>
7
8
namespace
fenix::logging {
9
10
struct
IrecvLog
{
11
IrecvLog
() =
default
;
12
IrecvLog
(
void
* b,
int
c, MPI_Datatype d,
int
t, MPI_Request* r)
13
: buf(b), count(c), datatype(d), tag(t), request(r) {}
14
IrecvLog
& operator=(
const
IrecvLog
& o) {
15
buf = o.buf;
16
count = o.count;
17
datatype = o.datatype;
18
tag = o.tag;
19
request = o.request;
20
return
*
this
;
21
}
22
23
void
* buf =
nullptr
;
24
int
count = -1;
25
MPI_Datatype datatype;
26
int
tag = -1;
27
MPI_Request* request =
nullptr
;
28
29
int
irecv(
int
src, MPI_Comm comm) {
30
fenix_assert(*
this
);
31
return
PMPI_Irecv(buf, count, datatype, src, tag, comm, request);
32
}
33
bool
operator==(MPI_Request*
const
& r)
const
{
return
request == r; }
34
void
reset() { *
this
=
IrecvLog
(); }
35
operator
bool()
const
{
return
request !=
nullptr
; }
36
std::string str()
const
{
37
return
"Recv 0x"
+ std::to_string((uintptr_t)request) +
" (tag "
+
38
std::to_string(tag) +
")"
;
39
}
40
};
41
42
}
//namespace fenix::logging
43
#endif
fenix::logging::IrecvLog
Definition
irecv_log.h:10
include
fenix
logging
ops
irecv_log.h
Generated by
1.12.0