This repository has been archived by the owner on Sep 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
node-synchronization.cpp
185 lines (159 loc) · 7.27 KB
/
node-synchronization.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
//
// node-synchronization.cpp - file with definitions of functions related to synchronizing metrics gathered from different nodes
//
// 2022-2023 Damian Strojek @damianStrojek
// Piotr Garbowski @dideek
// Jakub Wasniewski @wisnia01
//
// Internal headers
#include "node-synchronization.h"
#include "metrics.h"
// Create MPI data type for SystemMetricsType
MPI_Datatype createMpiSystemMetricsType(){
int blockLengths[] = {1, 1, 1, 1, 1};
MPI_Datatype metricTypes[] = {
MPI_INT, MPI_INT, MPI_INT, MPI_INT, MPI_INT};
MPI_Aint metricOffsets[] = {
offsetof(struct SystemMetrics, processesRunning),
offsetof(struct SystemMetrics, processesAll),
offsetof(struct SystemMetrics, processesBlocked),
offsetof(struct SystemMetrics, contextSwitchRate),
offsetof(struct SystemMetrics, interruptRate)};
MPI_Datatype systemMetricsType;
MPI_Type_create_struct(5, blockLengths, metricOffsets, metricTypes, &systemMetricsType);
MPI_Type_commit(&systemMetricsType);
return systemMetricsType;
};
// Create MPI data type for ProcessorMetricsType
MPI_Datatype createMpiProcessorMetricsType(){
int blockLengths[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1};
MPI_Datatype metricTypes[] = {
MPI_INT, MPI_INT, MPI_INT, MPI_INT,
MPI_INT, MPI_INT, MPI_INT, MPI_INT,
MPI_INT, MPI_INT, MPI_INT, MPI_FLOAT,
MPI_FLOAT, MPI_INT, MPI_INT, MPI_INT,
MPI_INT, MPI_INT, MPI_FLOAT, MPI_INT,
MPI_FLOAT};
MPI_Aint metricOffsets[] = {
offsetof(struct ProcessorMetrics, timeUser),
offsetof(struct ProcessorMetrics, timeNice),
offsetof(struct ProcessorMetrics, timeSystem),
offsetof(struct ProcessorMetrics, timeIdle),
offsetof(struct ProcessorMetrics, timeIoWait),
offsetof(struct ProcessorMetrics, timeIRQ),
offsetof(struct ProcessorMetrics, timeSoftIRQ),
offsetof(struct ProcessorMetrics, timeSteal),
offsetof(struct ProcessorMetrics, timeGuest),
offsetof(struct ProcessorMetrics, instructionsRetired),
offsetof(struct ProcessorMetrics, cycles),
offsetof(struct ProcessorMetrics, frequencyRelative),
offsetof(struct ProcessorMetrics, unhaltedFrequency),
offsetof(struct ProcessorMetrics, cacheL2Requests),
offsetof(struct ProcessorMetrics, cacheL2Misses),
offsetof(struct ProcessorMetrics, cacheLLCLoads),
offsetof(struct ProcessorMetrics, cacheLLCStores),
offsetof(struct ProcessorMetrics, cacheLLCLoadMisses),
offsetof(struct ProcessorMetrics, cacheLLCLoadMissRate),
offsetof(struct ProcessorMetrics, cacheLLCStoreMisses),
offsetof(struct ProcessorMetrics, cacheLLCStoreMissRate)};
MPI_Datatype processorMetricsType;
MPI_Type_create_struct(21, blockLengths, metricOffsets, metricTypes, &processorMetricsType);
MPI_Type_commit(&processorMetricsType);
return processorMetricsType;
};
// Create MPI data type for InputOutputMetricsType
MPI_Datatype createMpiInputOutputMetricsType(){
int blockLengths[] = {1, 1, 1, 1, 1, 1, 1, 1, 1};
MPI_Datatype metricTypes[] = {
MPI_INT, MPI_FLOAT, MPI_FLOAT,
MPI_INT, MPI_FLOAT, MPI_FLOAT,
MPI_INT, MPI_FLOAT, MPI_FLOAT};
MPI_Aint metricOffsets[] = {
offsetof(struct InputOutputMetrics, processID),
offsetof(struct InputOutputMetrics, dataRead),
offsetof(struct InputOutputMetrics, readTime),
offsetof(struct InputOutputMetrics, readOperationsRate),
offsetof(struct InputOutputMetrics, dataWritten),
offsetof(struct InputOutputMetrics, writeTime),
offsetof(struct InputOutputMetrics, writeOperationsRate),
offsetof(struct InputOutputMetrics, flushTime),
offsetof(struct InputOutputMetrics, flushOperationsRate)};
MPI_Datatype inputOutputMetricsType;
MPI_Type_create_struct(9, blockLengths, metricOffsets, metricTypes, &inputOutputMetricsType);
MPI_Type_commit(&inputOutputMetricsType);
return inputOutputMetricsType;
};
// Create MPI data type for MemoryMetricsType
MPI_Datatype createMpiMemoryMetricsType(){
int blockLengths[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
MPI_Datatype metricTypes[] = {
MPI_FLOAT, MPI_FLOAT, MPI_FLOAT, MPI_FLOAT,
MPI_FLOAT, MPI_FLOAT, MPI_FLOAT, MPI_FLOAT,
MPI_FLOAT, MPI_FLOAT, MPI_FLOAT, MPI_FLOAT,
MPI_FLOAT, MPI_FLOAT, MPI_FLOAT, MPI_FLOAT};
MPI_Aint metricOffsets[] = {
offsetof(struct MemoryMetrics, memoryUsed),
offsetof(struct MemoryMetrics, memoryCached),
offsetof(struct MemoryMetrics, swapUsed),
offsetof(struct MemoryMetrics, swapCached),
offsetof(struct MemoryMetrics, memoryActive),
offsetof(struct MemoryMetrics, memoryInactive),
offsetof(struct MemoryMetrics, pageInRate),
offsetof(struct MemoryMetrics, pageOutRate),
offsetof(struct MemoryMetrics, pageFaultRate),
offsetof(struct MemoryMetrics, pageFaultsMajorRate),
offsetof(struct MemoryMetrics, pageFreeRate),
offsetof(struct MemoryMetrics, pageActivateRate),
offsetof(struct MemoryMetrics, pageDeactivateRate),
offsetof(struct MemoryMetrics, memoryReadRate),
offsetof(struct MemoryMetrics, memoryWriteRate),
offsetof(struct MemoryMetrics, memoryIoRate)};
MPI_Datatype memoryMetricsType;
MPI_Type_create_struct(16, blockLengths, metricOffsets, metricTypes, &memoryMetricsType);
MPI_Type_commit(&memoryMetricsType);
return memoryMetricsType;
};
// Create MPI data type for NetworkMetricsType
MPI_Datatype createMpiNetworkMetricsType(){
int blockLengths[] = {1, 1, 1, 1};
MPI_Datatype metricTypes[] = {
MPI_INT, MPI_FLOAT, MPI_INT, MPI_FLOAT};
MPI_Aint metricOffsets[] = {
offsetof(NetworkMetrics, receivedData),
offsetof(NetworkMetrics, receivePacketRate),
offsetof(NetworkMetrics, sentData),
offsetof(NetworkMetrics, sendPacketsRate)};
MPI_Datatype networkMetricsType;
MPI_Type_create_struct(4, blockLengths, metricOffsets, metricTypes, &networkMetricsType);
MPI_Type_commit(&networkMetricsType);
return networkMetricsType;
};
// Create MPI data type for PowerMetrics
MPI_Datatype createMpiPowerMetricsType(){
int blockLengths[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
MPI_Datatype metricTypes[] = {
MPI_FLOAT, MPI_FLOAT, MPI_FLOAT, MPI_FLOAT,
MPI_FLOAT, MPI_FLOAT, MPI_FLOAT, MPI_FLOAT,
MPI_FLOAT, MPI_FLOAT, MPI_FLOAT};
MPI_Aint metricOffsets[] = {
offsetof(PowerMetrics, processorPower),
offsetof(PowerMetrics, memoryPower),
offsetof(PowerMetrics, systemPower),
offsetof(PowerMetrics, gpuPower),
offsetof(PowerMetrics, gpuTemperature),
offsetof(PowerMetrics, gpuFanSpeed),
offsetof(PowerMetrics, gpuMemoryTotal),
offsetof(PowerMetrics, gpuMemoryUsed),
offsetof(PowerMetrics, gpuMemoryFree),
offsetof(PowerMetrics, gpuClocksCurrentSM),
offsetof(PowerMetrics, gpuClocksCurrentMemory)};
MPI_Datatype powerMetricsType;
MPI_Type_create_struct(11, blockLengths, metricOffsets, metricTypes, &powerMetricsType);
MPI_Type_commit(&powerMetricsType);
return powerMetricsType;
};