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.

SMUCNGPerfConfigurator.cpp 9.73 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(), _vector_position(0) {
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
	_operatorName = "supermucngperf";
	_baseName     = "sensor";
	_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;
47 48
	_metricMap["NETWORK_XMIT_BYTES"]=SMUCSensorBase::NETWORK_XMIT_BYTES;
	_metricMap["NETWORK_RCVD_BYTES"]=SMUCSensorBase::NETWORK_RCVD_BYTES;
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
	_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["CAS_COUNT_READ0"]=SMUCSensorBase::CAS_COUNT_READ0;
	_metricMap["CAS_COUNT_READ1"]=SMUCSensorBase::CAS_COUNT_READ1;
	_metricMap["CAS_COUNT_READ2"]=SMUCSensorBase::CAS_COUNT_READ2;
	_metricMap["CAS_COUNT_READ3"]=SMUCSensorBase::CAS_COUNT_READ3;
	_metricMap["CAS_COUNT_READ4"]=SMUCSensorBase::CAS_COUNT_READ4;
	_metricMap["CAS_COUNT_READ5"]=SMUCSensorBase::CAS_COUNT_READ5;
	_metricMap["CAS_COUNT_WRITE0"]=SMUCSensorBase::CAS_COUNT_WRITE0;
	_metricMap["CAS_COUNT_WRITE1"]=SMUCSensorBase::CAS_COUNT_WRITE1;
	_metricMap["CAS_COUNT_WRITE2"]=SMUCSensorBase::CAS_COUNT_WRITE2;
	_metricMap["CAS_COUNT_WRITE3"]=SMUCSensorBase::CAS_COUNT_WRITE3;
	_metricMap["CAS_COUNT_WRITE4"]=SMUCSensorBase::CAS_COUNT_WRITE4;
	_metricMap["CAS_COUNT_WRITE5"]=SMUCSensorBase::CAS_COUNT_WRITE5;
	_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;
90 91
	_metricMap["INTRA_NODE_LOADIMBALANCE"]=SMUCSensorBase::INTRA_NODE_LOADIMBALANCE;
	_metricMap["INTER_NODE_LOADIMBALANCE"]=SMUCSensorBase::INTER_NODE_LOADIMBALANCE;
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
	_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;
111
	_metricMap["NETWORK_XMIT_BYTES_PER_PKT"]=SMUCSensorBase::NETWORK_XMIT_BYTES_PER_PKT;
112
	_metricMap["NETWORK_BYTES_XMIT_PER_SECOND"]=SMUCSensorBase::NETWORK_BYTES_XMIT_PER_SECOND;
113
	_metricMap["NETWORK_RCV_BYTES_PER_PKT"]=SMUCSensorBase::NETWORK_RCV_BYTES_PER_PKT;
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
	_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;
129 130 131 132 133
}

SMUCNGPerfConfigurator::~SMUCNGPerfConfigurator() {
}

134 135 136 137 138 139 140 141
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;
    }
}

142
void SMUCNGPerfConfigurator::sensorBase(SMUCSensorBase& s, CFG_VAL config) {
143 144 145 146 147 148
	std::string name = s.getName();
	for (auto & kv : _metricMap) {
		if(endsWith(name,kv.first)) {
			_metricToPosition[kv.second] = _vector_position;
			s.setMetric(kv.second);
			break;
149
		}
150 151
	}
	_vector_position++;
152 153
}

154 155
void SMUCNGPerfConfigurator::operatorAttributes(SMUCNGPerfOperator& op, CFG_VAL config){
	op.setMetricToPosition(_metricToPosition);
156
    _vector_position = 0;
157
    BOOST_FOREACH(boost::property_tree::iptree::value_type &val, config)
158
    {
159 160 161
    	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
162
    	} else if(boost::iequals(val.first, "go_back_ms")) {
163 164 165
    		auto go_back_ms = std::stod(val.second.data());
			op.setGoBackMs(go_back_ms);
    	}
166
    }
167
	_metricToPosition.clear();
168 169 170
}

bool SMUCNGPerfConfigurator::unit(UnitTemplate<SMUCSensorBase>& u) {
171
	if(u.isTopUnit()) {
172
		LOG(error) << "    " << _operatorName << ": This operator type only supports flat units!";
173 174 175
		return false;
	}
	if(u.getOutputs().empty()) {
176
		LOG(error) << "    " << _operatorName << ": At least one output sensor per unit must be defined!";
177 178
		return false;
	}
179 180
	return true;
}