Starting from 2021-07-01, all LRZ GitLab users will be required to explicitly accept the GitLab Terms of Service. Please see the detailed information at https://doku.lrz.de/display/PUBLIC/GitLab and make sure that your projects conform to the requirements.

Commit 2b5b1e1f authored by Carla Guillen Carias's avatar Carla Guillen Carias
Browse files

Implementing final derived metrics

parent 76633c62
...@@ -87,8 +87,8 @@ SMUCNGPerfConfigurator::SMUCNGPerfConfigurator() : OperatorConfiguratorTemplate( ...@@ -87,8 +87,8 @@ SMUCNGPerfConfigurator::SMUCNGPerfConfigurator() : OperatorConfiguratorTemplate(
_metricMap["VECTORIZED_RATIO"]=SMUCSensorBase::VECTORIZED_RATIO; _metricMap["VECTORIZED_RATIO"]=SMUCSensorBase::VECTORIZED_RATIO;
_metricMap["SINGLE_PRECISION_TO_TOTAL_RATIO"]=SMUCSensorBase::SINGLE_PRECISION_TO_TOTAL_RATIO; _metricMap["SINGLE_PRECISION_TO_TOTAL_RATIO"]=SMUCSensorBase::SINGLE_PRECISION_TO_TOTAL_RATIO;
_metricMap["EXPENSIVE_INSTRUCTIONS_PER_SECOND"]=SMUCSensorBase::EXPENSIVE_INSTRUCTIONS_PER_SECOND; _metricMap["EXPENSIVE_INSTRUCTIONS_PER_SECOND"]=SMUCSensorBase::EXPENSIVE_INSTRUCTIONS_PER_SECOND;
_metricMap["INSTR_INTRA_NODE_LOADIMBALANCE"]=SMUCSensorBase::INSTR_INTRA_NODE_LOADIMBALANCE; _metricMap["INTRA_NODE_LOADIMBALANCE"]=SMUCSensorBase::INTRA_NODE_LOADIMBALANCE;
_metricMap["INSTR_INTER_NODE_LOADIMBALANCE"]=SMUCSensorBase::INSTR_INTER_NODE_LOADIMBALANCE; _metricMap["INTER_NODE_LOADIMBALANCE"]=SMUCSensorBase::INTER_NODE_LOADIMBALANCE;
_metricMap["L2_HITS_PER_SECOND"]=SMUCSensorBase::L2_HITS_PER_SECOND; _metricMap["L2_HITS_PER_SECOND"]=SMUCSensorBase::L2_HITS_PER_SECOND;
_metricMap["L2_MISSES_PER_SECOND"]=SMUCSensorBase::L2_MISSES_PER_SECOND; _metricMap["L2_MISSES_PER_SECOND"]=SMUCSensorBase::L2_MISSES_PER_SECOND;
_metricMap["L3_HITS_PER_SECOND"]=SMUCSensorBase::L3_HITS_PER_SECOND; _metricMap["L3_HITS_PER_SECOND"]=SMUCSensorBase::L3_HITS_PER_SECOND;
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <string> #include <string>
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <numeric>
#include "../../../common/include/cacheentry.h" #include "../../../common/include/cacheentry.h"
#include "../../../common/include/logging.h" #include "../../../common/include/logging.h"
...@@ -43,6 +44,7 @@ ...@@ -43,6 +44,7 @@
#include "../../includes/QueryEngine.h" #include "../../includes/QueryEngine.h"
#include "../../includes/UnitTemplate.h" #include "../../includes/UnitTemplate.h"
#include "SKXPMUMetrics.h" #include "SKXPMUMetrics.h"
#include "../../includes/CommonStatistics.h"
SMUCNGPerfOperator::SMUCNGPerfOperator(const std::string& name): OperatorTemplate(name), _go_back_ns(0), _measuring_interval_s(1) { SMUCNGPerfOperator::SMUCNGPerfOperator(const std::string& name): OperatorTemplate(name), _go_back_ns(0), _measuring_interval_s(1) {
_buffers.resize(64); _buffers.resize(64);
...@@ -82,6 +84,13 @@ SMUCNGPerfOperator::SMUCNGPerfOperator(const std::string& name): OperatorTemplat ...@@ -82,6 +84,13 @@ SMUCNGPerfOperator::SMUCNGPerfOperator(const std::string& name): OperatorTemplat
std::forward_as_tuple(SMUCSensorBase::NETWORK_XMIT_BYTES, SMUCSensorBase::NETWORK_XMIT_PKTS)); std::forward_as_tuple(SMUCSensorBase::NETWORK_XMIT_BYTES, SMUCSensorBase::NETWORK_XMIT_PKTS));
_metricRatioToPair.emplace(std::piecewise_construct, std::forward_as_tuple(SMUCSensorBase::NETWORK_RCV_BYTES_PER_PKT), _metricRatioToPair.emplace(std::piecewise_construct, std::forward_as_tuple(SMUCSensorBase::NETWORK_RCV_BYTES_PER_PKT),
std::forward_as_tuple(SMUCSensorBase::NETWORK_RCVD_BYTES, SMUCSensorBase::NETWORK_RCVD_PKTS)); std::forward_as_tuple(SMUCSensorBase::NETWORK_RCVD_BYTES, SMUCSensorBase::NETWORK_RCVD_PKTS));
_profileMetricToMetricIds[SMUCSensorBase::IOBYTESREAD_PER_SECOND_PROF]= {SMUCSensorBase::IOBYTESREAD};
_profileMetricToMetricIds[SMUCSensorBase::IOBYTESWRITE_PER_SECOND_PROF] = {SMUCSensorBase::IOBYTESWRITE};
_profileMetricToMetricIds[SMUCSensorBase::IOREADS_PER_SECOND_PROF] = {SMUCSensorBase::IOREADS};
_profileMetricToMetricIds[SMUCSensorBase::IOWRITES_PER_SECOND_PROF] = {SMUCSensorBase::IOWRITES};
_profileMetricToMetricIds[SMUCSensorBase::IO_BYTES_READ_PER_OP_PROF] = {SMUCSensorBase::IOBYTESREAD, SMUCSensorBase::IOREADS};
_profileMetricToMetricIds[SMUCSensorBase::IO_BYTES_WRITE_PER_OP_PROF] = {SMUCSensorBase::IOBYTESWRITE, SMUCSensorBase::IOWRITES};
} }
SMUCNGPerfOperator::~SMUCNGPerfOperator() { SMUCNGPerfOperator::~SMUCNGPerfOperator() {
...@@ -138,6 +147,11 @@ void SMUCNGPerfOperator::compute(U_Ptr unit) { ...@@ -138,6 +147,11 @@ void SMUCNGPerfOperator::compute(U_Ptr unit) {
computeMetricPerSecond(inputs, outSensor, timestamp); computeMetricPerSecond(inputs, outSensor, timestamp);
} else if (isAMetricRatio(outSensor->getMetric())){ } else if (isAMetricRatio(outSensor->getMetric())){
computeMetricRatio(inputs, outSensor, timestamp); computeMetricRatio(inputs, outSensor, timestamp);
} else if (isAProfileMetric(outSensor->getMetric())){
computeProfileMetric(inputs, outSensor, timestamp);
} else if (outSensor->getMetric() == SMUCSensorBase::INTER_NODE_LOADIMBALANCE ||
outSensor->getMetric() == SMUCSensorBase::INTRA_NODE_LOADIMBALANCE) {
computeLOADIMBALANCES(inputs, outSensor, timestamp);
} else { } else {
LOG(error) << "Derived metric " << outSensor->getMetric() << " not implemented."; LOG(error) << "Derived metric " << outSensor->getMetric() << " not implemented.";
} }
...@@ -190,6 +204,61 @@ void SMUCNGPerfOperator::computeMetricRatio(std::vector<SMUCNGPtr>& inputs, SMUC ...@@ -190,6 +204,61 @@ void SMUCNGPerfOperator::computeMetricRatio(std::vector<SMUCNGPtr>& inputs, SMUC
} }
} }
void SMUCNGPerfOperator::computeProfileMetric(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp){
auto queryMetrics = _profileMetricToMetricIds[outSensor->getMetric()]; //should be here since this was queried in the compute() member function
for(std::size_t i = 0; i < queryMetrics.size(); ++i){
if(!_queryEngine.querySensor(inputs[_metricToPosition[queryMetrics[i]]]->getName(), timestamp - (_interval * 1e6), timestamp, _buffers[i], false)){
LOG(debug) << "Could not find data for " << queryMetrics[i] << " metric.";
return;
}
}
auto value = computeSum(_buffers[0]);
reading_t result;
if(queryMetrics.size()==2){ //_buffer[0] and _buffer[1] should have been filled
auto second_value = computeSum(_buffers[1]);
if(second_value != 0){
result.value = value / (outSensor->getMetadata()->scale * static_cast<double>(second_value));
result.timestamp = _buffers[0][0].timestamp;
outSensor->storeReading(result);
}
} else { //only one buffer was filled
result.value = value / (outSensor->getMetadata()->scale * (_interval/1000.0));
result.timestamp = _buffers[0][0].timestamp;
outSensor->storeReading(result);
}
}
void SMUCNGPerfOperator::computeLOADIMBALANCES(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp){
//query for every cpu
std::vector<reading_t> & cpus_vec = _buffers[0];
for(auto & input: inputs){
query(input->getName(), timestamp, cpus_vec);
}
if(cpus_vec.size() == 0) {
return;
}
reading_t result;
result.timestamp = cpus_vec.begin()->timestamp;
if(outSensor->getMetric() == SMUCSensorBase::INTRA_NODE_LOADIMBALANCE){
//calculate max - min
auto smallest = std::min_element(cpus_vec.begin(), cpus_vec.end(),
[](const reading_t& l, const reading_t& r) -> bool {return l.value < r.value;});
auto largest = std::max_element(cpus_vec.begin(), cpus_vec.end(),
[](const reading_t& l, const reading_t& r) -> bool {return l.value < r.value;});
result.value = largest->value - smallest->value;
} else if (outSensor->getMetric() == SMUCSensorBase::INTRA_NODE_LOADIMBALANCE) {
//calculate avg
result.value = computeAvg(cpus_vec);
}
outSensor->storeReading(result);
}
void SMUCNGPerfOperator::computeFREQUENCY(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr& outSensor, const uint64_t timestamp) { void SMUCNGPerfOperator::computeFREQUENCY(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr& outSensor, const uint64_t timestamp) {
std::vector<reading_t> & clocks = _buffers[0]; std::vector<reading_t> & clocks = _buffers[0];
std::vector<reading_t> & clocks_ref = _buffers[1]; std::vector<reading_t> & clocks_ref = _buffers[1];
...@@ -327,3 +396,10 @@ bool SMUCNGPerfOperator::isAMetricRatio(SMUCSensorBase::Metric_t comp){ ...@@ -327,3 +396,10 @@ bool SMUCNGPerfOperator::isAMetricRatio(SMUCSensorBase::Metric_t comp){
} }
return false; return false;
} }
bool SMUCNGPerfOperator::isAProfileMetric(SMUCSensorBase::Metric_t comp){
if(_profileMetricToMetricIds.find(comp) != _profileMetricToMetricIds.end()){
return true;
}
return false;
}
...@@ -56,6 +56,7 @@ protected: ...@@ -56,6 +56,7 @@ protected:
std::map<SMUCSensorBase::Metric_t, unsigned int> _metricToPosition; std::map<SMUCSensorBase::Metric_t, unsigned int> _metricToPosition;
std::map<SMUCSensorBase::Metric_t, SMUCSensorBase::Metric_t> _metricPerSecToId; std::map<SMUCSensorBase::Metric_t, SMUCSensorBase::Metric_t> _metricPerSecToId;
std::map<SMUCSensorBase::Metric_t, std::pair<SMUCSensorBase::Metric_t, SMUCSensorBase::Metric_t>> _metricRatioToPair; std::map<SMUCSensorBase::Metric_t, std::pair<SMUCSensorBase::Metric_t, SMUCSensorBase::Metric_t>> _metricRatioToPair;
std::map<SMUCSensorBase::Metric_t, std::vector<SMUCSensorBase::Metric_t>> _profileMetricToMetricIds;
vector<vector<reading_t>> _buffers; vector<vector<reading_t>> _buffers;
const unsigned int MAX_FREQ_MHZ = 2700; const unsigned int MAX_FREQ_MHZ = 2700;
const unsigned int MIN_FREQ_MHZ = 1200; const unsigned int MIN_FREQ_MHZ = 1200;
...@@ -75,13 +76,15 @@ protected: ...@@ -75,13 +76,15 @@ protected:
void computeFREQUENCY(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp); void computeFREQUENCY(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp);
void computeFLOPS(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp); void computeFLOPS(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp);
//void computeINSTR_INTRA_NODE_LOADIMBALANCE(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp); void computeLOADIMBALANCES(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp);
//void computeINSTR_INTER_NODE_LOADIMBALANCE((SMUCNGPtr &outSensor); //needs to be donejob plugin
void computeL3_BANDWIDTH(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp); void computeL3_BANDWIDTH(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp);
void computeL3HIT_TO_L3MISS_RATIO(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp); void computeL3HIT_TO_L3MISS_RATIO(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp);
void computeMEMORY_BANDWIDTH(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp); void computeMEMORY_BANDWIDTH(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp);
void computeProfileMetric(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp);
bool isAMetricPerSecond(SMUCSensorBase::Metric_t comp); bool isAMetricPerSecond(SMUCSensorBase::Metric_t comp);
bool isAMetricRatio(SMUCSensorBase::Metric_t comp); bool isAMetricRatio(SMUCSensorBase::Metric_t comp);
bool isAProfileMetric(SMUCSensorBase::Metric_t comp);
}; };
#endif /* ANALYTICS_SMUCNGPERF_SMUCNGPERFOPERATOR_H_ */ #endif /* ANALYTICS_SMUCNGPERF_SMUCNGPERFOPERATOR_H_ */
...@@ -90,8 +90,8 @@ public: ...@@ -90,8 +90,8 @@ public:
VECTORIZED_RATIO=56, //(TOTAL VECTORIZED)/(ALL FLOPS) VECTORIZED_RATIO=56, //(TOTAL VECTORIZED)/(ALL FLOPS)
SINGLE_PRECISION_TO_TOTAL_RATIO=57, //Flops SINGLE_PRECISION_TO_TOTAL_RATIO=57, //Flops
EXPENSIVE_INSTRUCTIONS_PER_SECOND=58, EXPENSIVE_INSTRUCTIONS_PER_SECOND=58,
INSTR_INTRA_NODE_LOADIMBALANCE=59, INTRA_NODE_LOADIMBALANCE=59,
INSTR_INTER_NODE_LOADIMBALANCE=60, INTER_NODE_LOADIMBALANCE=60,
L2_HITS_PER_SECOND=61, L2_HITS_PER_SECOND=61,
L2_MISSES_PER_SECOND=62, L2_MISSES_PER_SECOND=62,
L3_HITS_PER_SECOND=63, L3_HITS_PER_SECOND=63,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment