forked from RWTH-HPC/OTF-CPT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtracking.cpp
92 lines (89 loc) · 2.8 KB
/
tracking.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#include "tracking.h"
#ifdef HANDLE_OP
template <> MPI_Op OpData::nullHandle{MPI_OP_NULL};
OpFactory of;
MapListOpFactory mof;
#endif
#ifdef HANDLE_WIN
template <> MPI_Win WinData::nullHandle{MPI_WIN_NULL};
WinFactory wf;
MapListWinFactory mwf;
#endif
#ifdef HANDLE_TYPE
template <> MPI_Datatype TypeData::nullHandle{MPI_DATATYPE_NULL};
TypeFactory tf{};
MapListTypeFactory mtf{};
#endif
#ifdef HANDLE_FILE
template <> MPI_File FileData::nullHandle{MPI_FILE_NULL};
FileFactory ff;
MapListFileFactory mff;
#endif
#ifdef HANDLE_COMM
template <>
bool AbstractHandleFactory<MPI_Comm, CommData>::isPredefined(MPI_Comm handle) {
return handle == MPI_COMM_NULL || handle == MPI_COMM_WORLD ||
handle == MPI_COMM_SELF;
}
template <> void AbstractHandleFactory<MPI_Comm, CommData>::initPredefined() {
predefHandles[MPI_COMM_NULL].init(MPI_COMM_NULL);
predefHandles[MPI_COMM_WORLD].init(MPI_COMM_WORLD);
predefHandles[MPI_COMM_SELF].init(MPI_COMM_SELF);
}
MPI_Comm CommData::nullHandle{MPI_COMM_NULL};
CommFactory cf;
MapListCommFactory mcf;
#endif
#ifdef HANDLE_GROUP
template <>
bool AbstractHandleFactory<MPI_Group, GroupData>::isPredefined(
MPI_Group handle) {
return handle == MPI_GROUP_NULL || handle == MPI_GROUP_EMPTY;
}
template <> void AbstractHandleFactory<MPI_Group, GroupData>::initPredefined() {
predefHandles[MPI_GROUP_NULL].init(MPI_GROUP_NULL);
predefHandles[MPI_GROUP_EMPTY].init(MPI_GROUP_EMPTY);
}
template <> MPI_Group GroupData::nullHandle{MPI_GROUP_NULL};
GroupFactory gf;
MapListGroupFactory mgf;
#endif
#ifdef HANDLE_REQUEST
MPI_Request RequestData::nullHandle{MPI_REQUEST_NULL};
RequestFactory rf;
MapListRequestFactory mrf;
#endif
#if defined(HAVE_SESSION) && defined(HANDLE_SESSION)
template <> MPI_Session SessionData::nullHandle{MPI_SESSION_NULL};
SessionFactory sf;
MapListSessionFactory msf;
#endif
int ipcData::num_uc_double{NUM_UC_DOUBLE};
int ipcData::num_uc_int64{NUM_UC_INT64};
MPI_Datatype ipcData::ipcMpiType{MPI_DATATYPE_NULL};
void ipcData::initIpcData() {
if (num_uc_int64 > 0) {
ipcData tempData{};
RequestData tempRData{};
MPI_Aint displs[2], rdispls[2];
PMPI_Get_address(tempData.uc_double, displs);
PMPI_Get_address(tempData.uc_int64, displs + 1);
PMPI_Get_address(tempRData.uc_double, rdispls);
PMPI_Get_address(tempRData.uc_int64, rdispls + 1);
displs[1] -= displs[0];
displs[0] = 0;
rdispls[1] -= rdispls[0];
rdispls[0] = 0;
assert(displs[1] == rdispls[1]);
MPI_Datatype types[] = {MPI_DOUBLE, MPI_INT64_T};
int blengths[] = {num_uc_double, num_uc_int64};
PMPI_Type_create_struct(2, blengths, displs, types, &ipcMpiType);
} else {
PMPI_Type_contiguous(num_uc_double, MPI_DOUBLE, &ipcMpiType);
}
PMPI_Type_commit(&ipcMpiType);
}
void ipcData::finiIpcData() {
if (ipcMpiType != MPI_DATATYPE_NULL)
PMPI_Type_free(&ipcMpiType);
}