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.

SMUCNGPerfOperator.h 4.21 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        : SMUCNGPerfOperator.h
// 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
#ifndef ANALYTICS_SMUCNGPERF_SMUCNGPERFOPERATOR_H_
#define ANALYTICS_SMUCNGPERF_SMUCNGPERFOPERATOR_H_
30

31
#include "../../includes/OperatorTemplate.h"
32
#include "SMUCSensorBase.h"
Carla Guillen's avatar
Carla Guillen committed
33
#include "SKXPMUMetrics.h"
34 35
#include <map>

36
class SMUCNGPerfOperator: virtual public OperatorTemplate<SMUCSensorBase>{
37
public:
Carla Guillen's avatar
Carla Guillen committed
38 39 40 41
    SMUCNGPerfOperator(const std::string& name);
    virtual ~SMUCNGPerfOperator();
    SMUCNGPerfOperator(const SMUCNGPerfOperator& other);
    SMUCNGPerfOperator& operator=(const SMUCNGPerfOperator& other);
42 43
    void printConfig(LOG_LEVEL ll) override;

Carla Guillen's avatar
Carla Guillen committed
44
    void setMetricToPosition(const std::map<SMUCSensorBase::Metric_t,unsigned int>&metricToPosition) {
45
		_metricToPosition = metricToPosition;
Carla Guillen's avatar
Carla Guillen committed
46
    }
47

48 49 50
    void setMeasuringInterval(double measurement_interval_s){
    	_measuring_interval_s = measurement_interval_s;
    }
Carla Guillen's avatar
Carla Guillen committed
51
    void setGoBackMs(int go_back_ms){
52
    	_go_back_ns = go_back_ms * 1e6;
Carla Guillen's avatar
Carla Guillen committed
53
    }
54

55
protected:
56
    std::map<SMUCSensorBase::Metric_t, unsigned int> _metricToPosition;
57
    std::map<SMUCSensorBase::Metric_t, SMUCSensorBase::Metric_t> _metricPerSecToId;
58
    std::map<SMUCSensorBase::Metric_t, std::pair<SMUCSensorBase::Metric_t, SMUCSensorBase::Metric_t>> _metricRatioToPair;
59
    std::map<SMUCSensorBase::Metric_t, std::vector<SMUCSensorBase::Metric_t>> _profileMetricToMetricIds;
Carla Guillen Carias's avatar
Carla Guillen Carias committed
60
    vector<vector<reading_t>> _buffers;
Carla Guillen's avatar
Carla Guillen committed
61 62
    const unsigned int MAX_FREQ_MHZ = 2700;
    const unsigned int MIN_FREQ_MHZ = 1200;
Carla Guillen's avatar
Carla Guillen committed
63
    double _go_back_ns;
64
    double _measuring_interval_s;
Carla Guillen's avatar
Carla Guillen committed
65

66 67
    virtual void compute(U_Ptr unit) override;

Carla Guillen Carias's avatar
Carla Guillen Carias committed
68

Carla Guillen's avatar
Carla Guillen committed
69 70
    void resetBuffers();
    void query(const std::string & sensor_name, const uint64_t timestamp, vector<reading_t> &buffer);
71 72

    void copy(const SMUCNGPerfOperator& other);
73 74 75 76

    void computeMetricRatio(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp);
    void computeMetricPerSecond(std::vector<SMUCNGPtr> &inputs, SMUCNGPtr& outSensor, const uint64_t timestamp);

77 78
    void computeFREQUENCY(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp);
	void computeFLOPS(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp);
79
	void computeLOADIMBALANCES(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp);
80 81 82
	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 computeMEMORY_BANDWIDTH(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp);
83 84
	void computeProfileMetric(std::vector<SMUCNGPtr>& inputs, SMUCNGPtr &outSensor, const uint64_t timestamp);

Carla Guillen's avatar
Carla Guillen committed
85
	bool isAMetricPerSecond(SMUCSensorBase::Metric_t comp);
86
	bool isAMetricRatio(SMUCSensorBase::Metric_t comp);
87
	bool isAProfileMetric(SMUCSensorBase::Metric_t comp);
88 89
};

90
#endif /* ANALYTICS_SMUCNGPERF_SMUCNGPERFOPERATOR_H_ */