SMUCNGPerfConfigurator.cpp 8.75 KB
Newer Older
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
//================================================================================
// Name        : SMUCNGPerfConfigurator.cpp
// Author      : Carla Guillen
// Contact     : info@dcdb.it
// Copyright   : Leibniz Supercomputing Centre
// Description : Template implementing features to use Units in Operators.
//================================================================================

//================================================================================
// This file is part of DCDB (DataCenter DataBase)
// Copyright (C) 2018-2019 Leibniz Supercomputing Centre
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
//================================================================================
27
28
29

#include "SMUCNGPerfConfigurator.h"

Carla Guillen's avatar
Carla Guillen committed
30

31
SMUCNGPerfConfigurator::SMUCNGPerfConfigurator() : OperatorConfiguratorTemplate(){
32
    _operatorName = "supermucngperf";
33
    _baseName     = "sensor";
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
_metricMap["INSTRUCTIONS"]=SMUCSensorBase::INSTRUCTIONS;
_metricMap["CLOCKS"]=SMUCSensorBase::CLOCKS;
_metricMap["CLOCKS_REF"]=SMUCSensorBase::CLOCKS_REF;
_metricMap["USERPCT"]=SMUCSensorBase::USERPCT;
_metricMap["SYSTEMPCT"]=SMUCSensorBase::SYSTEMPCT;
_metricMap["IOWAITPCT"]=SMUCSensorBase::IOWAITPCT;
_metricMap["MEMINFO"]=SMUCSensorBase::MEMINFO;
_metricMap["IOBYTESREAD"]=SMUCSensorBase::IOBYTESREAD;
_metricMap["IOBYTESWRITE"]=SMUCSensorBase::IOBYTESWRITE;
_metricMap["IOOPENS"]=SMUCSensorBase::IOOPENS;
_metricMap["IOCLOSES"]=SMUCSensorBase::IOCLOSES;
_metricMap["IOREADS"]=SMUCSensorBase::IOREADS;
_metricMap["IOWRITES"]=SMUCSensorBase::IOWRITES;
_metricMap["NETWORK_XMIT"]=SMUCSensorBase::NETWORK_XMIT;
_metricMap["NETWORK_RCVD"]=SMUCSensorBase::NETWORK_RCVD;
_metricMap["NETWORK_XMIT_PKTS"]=SMUCSensorBase::NETWORK_XMIT_PKTS;
_metricMap["NETWORK_RCVD_PKTS"]=SMUCSensorBase::NETWORK_RCVD_PKTS;
_metricMap["L2_RQSTS_MISS"]=SMUCSensorBase::L2_RQSTS_MISS;
_metricMap["ARITH_FPU_DIVIDER_ACTIVE"]=SMUCSensorBase::ARITH_FPU_DIVIDER_ACTIVE;
_metricMap["FP_ARITH_SCALAR_DOUBLE"]=SMUCSensorBase::FP_ARITH_SCALAR_DOUBLE;
_metricMap["FP_ARITH_SCALAR_SINGLE"]=SMUCSensorBase::FP_ARITH_SCALAR_SINGLE;
_metricMap["FP_ARITH_128B_PACKED_DOUBLE"]=SMUCSensorBase::FP_ARITH_128B_PACKED_DOUBLE;
_metricMap["FP_ARITH_128B_PACKED_SINGLE"]=SMUCSensorBase::FP_ARITH_128B_PACKED_SINGLE;
_metricMap["FP_ARITH_256B_PACKED_DOUBLE"]=SMUCSensorBase::FP_ARITH_256B_PACKED_DOUBLE;
_metricMap["FP_ARITH_256B_PACKED_SINGLE"]=SMUCSensorBase::FP_ARITH_256B_PACKED_SINGLE;
_metricMap["FP_ARITH_512B_PACKED_DOUBLE"]=SMUCSensorBase::FP_ARITH_512B_PACKED_DOUBLE;
_metricMap["FP_ARITH_512B_PACKED_SINGLE"]=SMUCSensorBase::FP_ARITH_512B_PACKED_SINGLE;
_metricMap["MEM_INST_RETIRED_ALL_LOADS"]=SMUCSensorBase::MEM_INST_RETIRED_ALL_LOADS;
_metricMap["MEM_INST_RETIRED_ALL_STORES"]=SMUCSensorBase::MEM_INST_RETIRED_ALL_STORES;
_metricMap["MEM_LOAD_UOPS_RETIRED_L3_MISS"]=SMUCSensorBase::MEM_LOAD_UOPS_RETIRED_L3_MISS;
_metricMap["MEM_LOAD_RETIRED_L3_HIT"]=SMUCSensorBase::MEM_LOAD_RETIRED_L3_HIT;
_metricMap["MEM_LOAD_RETIRED_L3_MISS"]=SMUCSensorBase::MEM_LOAD_RETIRED_L3_MISS;
_metricMap["PERF_COUNT_HW_BRANCH_INSTRUCTIONS"]=SMUCSensorBase::PERF_COUNT_HW_BRANCH_INSTRUCTIONS;
_metricMap["PERF_COUNT_HW_BRANCH_MISSES"]=SMUCSensorBase::PERF_COUNT_HW_BRANCH_MISSES;
_metricMap["CORE_TEMPERATURE"]=SMUCSensorBase::CORE_TEMPERATURE;
_metricMap["CPI"]=SMUCSensorBase::CPI;
_metricMap["FREQUENCY"]=SMUCSensorBase::FREQUENCY;
_metricMap["INSTRUCTIONS_PER_SECOND"]=SMUCSensorBase::INSTRUCTIONS_PER_SECOND;
_metricMap["FLOPS"]=SMUCSensorBase::FLOPS;
_metricMap["PACKED_FLOPS"]=SMUCSensorBase::PACKED_FLOPS;
_metricMap["AVX512_TOVECTORIZED_RATIO"]=SMUCSensorBase::AVX512_TOVECTORIZED_RATIO;
_metricMap["VECTORIZED_RATIO"]=SMUCSensorBase::VECTORIZED_RATIO;
_metricMap["SINGLE_PRECISION_TO_TOTAL_RATIO"]=SMUCSensorBase::SINGLE_PRECISION_TO_TOTAL_RATIO;
_metricMap["EXPENSIVE_INSTRUCTIONS_PER_SECOND"]=SMUCSensorBase::EXPENSIVE_INSTRUCTIONS_PER_SECOND;
_metricMap["INSTR_INTRA_NODE_LOADIMBALANCE"]=SMUCSensorBase::INSTR_INTRA_NODE_LOADIMBALANCE;
_metricMap["INSTR_INTER_NODE_LOADIMBALANCE"]=SMUCSensorBase::INSTR_INTER_NODE_LOADIMBALANCE;
_metricMap["L2_HITS_PER_SECOND"]=SMUCSensorBase::L2_HITS_PER_SECOND;
_metricMap["L2_MISSES_PER_SECOND"]=SMUCSensorBase::L2_MISSES_PER_SECOND;
_metricMap["L3_HITS_PER_SECOND"]=SMUCSensorBase::L3_HITS_PER_SECOND;
_metricMap["L3_MISSES_PER_SECOND"]=SMUCSensorBase::L3_MISSES_PER_SECOND;
_metricMap["L3_TO_INSTRUCTIONS_RATIO"]=SMUCSensorBase::L3_TO_INSTRUCTIONS_RATIO;
_metricMap["L3_BANDWIDTH"]=SMUCSensorBase::L3_BANDWIDTH;
_metricMap["L3HIT_TO_L3MISS_RATIO"]=SMUCSensorBase::L3HIT_TO_L3MISS_RATIO;
_metricMap["LOADS_TO_STORES"]=SMUCSensorBase::LOADS_TO_STORES;
_metricMap["LOADS_TOL3MISS_RATIO"]=SMUCSensorBase::LOADS_TOL3MISS_RATIO;
_metricMap["MISSBRANCHES_PER_SECOND"]=SMUCSensorBase::MISSBRANCHES_PER_SECOND;
_metricMap["BRANCH_PER_INSTRUCTIONS"]=SMUCSensorBase::BRANCH_PER_INSTRUCTIONS;
_metricMap["MISSBRANCHES_TO_TOTAL_BRANCH_RATIO"]=SMUCSensorBase::MISSBRANCHES_TO_TOTAL_BRANCH_RATIO;
_metricMap["MEMORY_BANDWIDTH"]=SMUCSensorBase::MEMORY_BANDWIDTH;
_metricMap["RAPL_PKG"]=SMUCSensorBase::RAPL_PKG;
_metricMap["RAPL_MEM"]=SMUCSensorBase::RAPL_MEM;
_metricMap["IPMI_CPU"]=SMUCSensorBase::IPMI_CPU;
_metricMap["IPMI_MEM"]=SMUCSensorBase::IPMI_MEM;
_metricMap["IPMI_DC"]=SMUCSensorBase::IPMI_DC;
_metricMap["IPMI_AC"]=SMUCSensorBase::IPMI_AC;
_metricMap["NETWORK_XMIT_BYTES_PER_OP"]=SMUCSensorBase::NETWORK_XMIT_BYTES_PER_OP;
_metricMap["NETWORK_BYTES_XMIT_PER_SECOND"]=SMUCSensorBase::NETWORK_BYTES_XMIT_PER_SECOND;
_metricMap["NETWORK_RCV_BYTES_PER_OP"]=SMUCSensorBase::NETWORK_RCV_BYTES_PER_OP;
_metricMap["NETWORK_BYTES_RCVD_PER_SECOND"]=SMUCSensorBase::NETWORK_BYTES_RCVD_PER_SECOND;
_metricMap["IOOPENS_PER_SECOND"]=SMUCSensorBase::IOOPENS_PER_SECOND;
_metricMap["IOCLOSES_PER_SECOND"]=SMUCSensorBase::IOCLOSES_PER_SECOND;
_metricMap["IOBYTESREAD_PER_SECOND"]=SMUCSensorBase::IOBYTESREAD_PER_SECOND;
_metricMap["IOBYTESWRITE_PER_SECOND"]=SMUCSensorBase::IOBYTESWRITE_PER_SECOND;
_metricMap["IOREADS_PER_SECOND"]=SMUCSensorBase::IOREADS_PER_SECOND;
_metricMap["IOWRITES_PER_SECOND"]=SMUCSensorBase::IOWRITES_PER_SECOND;
_metricMap["IO_BYTES_READ_PER_OP"]=SMUCSensorBase::IO_BYTES_READ_PER_OP;
_metricMap["IO_BYTES_WRITE_PER_OP"]=SMUCSensorBase::IO_BYTES_WRITE_PER_OP;
_metricMap["IOBYTESREAD_PER_SECOND_PROF"]=SMUCSensorBase::IOBYTESREAD_PER_SECOND_PROF;
_metricMap["IOBYTESWRITE_PER_SECOND_PROF"]=SMUCSensorBase::IOBYTESWRITE_PER_SECOND_PROF;
_metricMap["IOREADS_PER_SECOND_PROF"]=SMUCSensorBase::IOREADS_PER_SECOND_PROF;
_metricMap["IOWRITES_PER_SECOND_PROF"]=SMUCSensorBase::IOWRITES_PER_SECOND_PROF;
_metricMap["IO_BYTES_READ_PER_OP_PROF"]=SMUCSensorBase::IO_BYTES_READ_PER_OP_PROF;
_metricMap["IO_BYTES_WRITE_PER_OP_PROF"]=SMUCSensorBase::IO_BYTES_WRITE_PER_OP_PROF;

118
119
120
121
122
}

SMUCNGPerfConfigurator::~SMUCNGPerfConfigurator() {
}

123
124
125
126
127
128
129
130
bool endsWith (std::string const &fullString, std::string const &ending) {
    if (fullString.length() >= ending.length()) {
        return (0 == fullString.compare (fullString.length() - ending.length(), ending.length(), ending));
    } else {
        return false;
    }
}

131
void SMUCNGPerfConfigurator::sensorBase(SMUCSensorBase& s, CFG_VAL config) {
132
133
134
135
136
	BOOST_FOREACH(boost::property_tree::iptree::value_type &val, config) {
    	if (boost::iequals(val.first, "position")) {
    		unsigned int position = std::stoul(val.second.data());
    		s.setPosition(position);
    		std::string name = s.getName();
137
138
139
140
141
		for (auto & kv : _metricMap){
			if(endsWith(name,kv.first)){
				_metricToPosition[kv.second] = position;
				s.setMetric(kv.second);
				break;
142
			}
143
		}
144
    	} 
145
146
147
     }
}

148
149
void SMUCNGPerfConfigurator::operatorAttributes(SMUCNGPerfOperator& op, CFG_VAL config){
	op.setMetricToPosition(_metricToPosition);
150
    BOOST_FOREACH(boost::property_tree::iptree::value_type &val, config)
151
    {
152
153
154
    	if (boost::iequals(val.first, "measuring_interval")){
    		auto measurementInterval_s = std::stod(val.second.data())/1000.0; //miliseconds to seconds
    		op.setMeasuringInterval(measurementInterval_s);
Carla Guillen's avatar
Carla Guillen committed
155
    	} else if(boost::iequals(val.first, "go_back_ms")) {
156
157
158
    		auto go_back_ms = std::stod(val.second.data());
			op.setGoBackMs(go_back_ms);
    	}
159
    }
160
161
162
163
164
}

bool SMUCNGPerfConfigurator::unit(UnitTemplate<SMUCSensorBase>& u) {
	return true;
}