...
 
Commits (82)
......@@ -5,6 +5,7 @@ build
*.o
*.a
*.mod
*.json
test/mericMeasurement*
test/hdeemMeasurement*
tools/__pycache__/
......@@ -14,6 +15,7 @@ tools/staticMERICtool/energyMeasureStart
tools/staticMERICtool/energyMeasureStop
tools/systemInfo
tools/DBI/*
tools/wrapper
include/meric
test/sleepTest
......
### XX.XX.XXXX #################################################################
- powercap is now set in milliwatts and milliseconds instead of watts and microseconds
- new MERIC_COUNTERS=msr - CPU core and uncore freq monitoring using msr-safe
- fixed restore of the system hardware settings in the energyMeasureStop
- systemInfo tool provides posibility to restore the system settings
- HW tuning and RAPL energy measurement using GEOPM
- continual mode is now default
- it is not necessary any more to set MERIC_CONTINUAL for energy measurement systems that does not support non-continual measurement
- unified output label for all the energy measurement systems
### 30.04.2019 #################################################################
- new Dynamic Binary Instrymentation (DBI) tool for MERIC instrumentation
- user should not specify value of requested CPU core frequency, uncore frequency and number of active threads in the name of the output file any more - it is done automatically
......
This diff is collapsed.
......@@ -142,7 +142,7 @@ DistributedMeric::DistributedMeric()
_storeList.push_back(new CountersStore<RAPL, unsigned long long int>(Meric::SAMPLES, !_MPInodeRank));
}
if (Meric::MODE == MODE_JETSON && Meric::CONTINUAL)
if (Meric::MODE == MODE_JETSON)
{
if (Meric::AGGREGATE)
{
......@@ -152,13 +152,13 @@ DistributedMeric::DistributedMeric()
else
_storeList.push_back(new TimeStore<JETSON>(Meric::SAMPLES, !_MPInodeRank));
}
else if (Meric::MODE == MODE_THUNDER && Meric::CONTINUAL)
else if (Meric::MODE == MODE_THUNDER)
{
MPI_Comm_split(MPI_COMM_WORLD, _MPIglobalRank, 0, &_supportComm); //_supportComm currently used by THUNDER only, so the split is here to make it obvious
_storeList.push_back(new AggregateStore<TimeStore<THUNDER>>(_supportComm));
_storeList.back()->setMPIWrite(!_MPIglobalRank);
}
else if (Meric::MODE == MODE_DAVIDE && Meric::CONTINUAL)
else if (Meric::MODE == MODE_DAVIDE)
{
if (Meric::AGGREGATE)
{
......@@ -195,6 +195,10 @@ DistributedMeric::DistributedMeric()
}
_storeList.back()->setMPIWrite(true);
}
else if (Meric::COUNTERS == "msr" && !Meric::AGGREGATE)
{
_storeList.push_back(new CountersStore<MSR, uint64_t>(Meric::SAMPLES));
}
}
if (_storeList.size() > 0 || Meric::MODE == MODE_TIME)
......@@ -223,38 +227,35 @@ DistributedMeric::DistributedMeric()
currentState.socket[socket] = defaultParameter;
//available energy measurement systems on ARM architectures requires short wait to start the measurement - sleep(5)
if (Meric::MODE == MODE_JETSON && Meric::CONTINUAL)
if (Meric::MODE == MODE_JETSON)
{
if (!_MPInodeRank)
JETSON::init();
sleep(5);
}
else if (Meric::MODE == MODE_THUNDER && Meric::CONTINUAL)
else if (Meric::MODE == MODE_THUNDER)
{
if (!_MPIglobalRank)
THUNDER::init();
sleep(5);
}
else if (Meric::MODE == MODE_DAVIDE && Meric::CONTINUAL)
else if (Meric::MODE == MODE_DAVIDE)
{
if (!_MPIglobalRank)
if (!_MPInodeRank)
DAVIDE::init();
DAVIDE::start(_startTime); //TODO << test if it is neccessary to have a start here, also for all procs?
}
//wrappers must be initialized after meric instantiation
//rapl counter expects that environment::init() was already called
//RAPL + MSR wrappers expects that environment::init() was already called
if (Meric::COUNTERS == "perfevent")
PERFEVENT::init();
if (Meric::COUNTERS == "papi")
PAPI::init();
if (Meric::MODE == MODE_RAPL || Meric::MODE == MODE_BOTH)
{
// if (Meric::DETAILED)
// RAPL::detailed();
RAPL::init(Meric::DETAILED);
}
if (Meric::COUNTERS == "msr")
MSR::init();
std::string applicationMainRegion = std::string(program_invocation_name);
size_t n = applicationMainRegion.find_last_of("/");
......@@ -273,7 +274,7 @@ DistributedMeric::~DistributedMeric()
{
HDEEM::close();
}
else if (Meric::MODE == MODE_DAVIDE && Meric::CONTINUAL && (!_MPInodeRank))
else if (Meric::MODE == MODE_DAVIDE && (!_MPInodeRank))
{
DAVIDE::close();
}
......
......@@ -5,7 +5,7 @@ using namespace meric;
int Meric::ITERATION = mutils::getenv("MERIC_ITERATION", 0);
int Meric::MODE = mutils::getenv<int>("MERIC_MODE" , MODE_RUN);
bool Meric::CONTINUAL = mutils::getenv("MERIC_CONTINUAL" , false);
bool Meric::CONTINUAL = mutils::getenv("MERIC_CONTINUAL" , true);
bool Meric::DETAILED = mutils::getenv("MERIC_DETAILED" , false);
bool Meric::AGGREGATE = mutils::getenv("MERIC_AGGREGATE" , true);
bool Meric::DEBUG = mutils::getenv("MERIC_DEBUG" , false);
......@@ -46,13 +46,8 @@ int Meric::getDefaultParameters()
{
int ret=0;
//OBLIGATORY SECTION
defaultParameter.nthreads = mutils::getenv("MERIC_NUM_THREADS", -1);
defaultParameter.frequency = mutils::frequencyToHz(mutils::getenv("MERIC_FREQUENCY", std::string("")));
defaultParameter.uncoreFrequency = mutils::frequencyToHz(mutils::getenv("MERIC_UNCORE_FREQUENCY", std::string("")));
defaultParameter.powerCapPKG = mutils::getenv("MERIC_PWRCAP_POWER", -1);
defaultParameter.powerCapPKGtime = mutils::getenv("MERIC_PWRCAP_TIME", -1);
#if defined (HAVE_CPUFREQ_H) || defined (HAVE_X86_ADAPT_H) || defined (HAVE_MSR_CORE_H)
#if defined HAVE_CPUFREQ_H || defined HAVE_X86_ADAPT_H || defined HAVE_MSR_CORE_H || defined HAVE_GEOPM_H
defaultParameter.frequency = mutils::frequencyToHz(mutils::getenv("MERIC_FREQUENCY", std::string("")));
if (defaultParameter.frequency < 0)
{
std::cerr << "MERIC ERROR: set MERIC_FREQUENCY [Hz]\n";
......@@ -62,10 +57,12 @@ int Meric::getDefaultParameters()
{
Meric::outputFilenameInfo +="CF_";
}
#else
defaultParameter.frequency = 0;
#endif
#if defined (HAVE_X86_ADAPT_H) || defined (HAVE_MSR_CORE_H)
#if defined HAVE_X86_ADAPT_H || defined HAVE_MSR_CORE_H || defined HAVE_GEOPM_H
defaultParameter.uncoreFrequency = mutils::frequencyToHz(mutils::getenv("MERIC_UNCORE_FREQUENCY", std::string("")));
if (defaultParameter.uncoreFrequency < 0)
{
std::cerr << "MERIC ERROR: set MERIC_UNCORE_FREQUENCY [Hz]\n";
......@@ -75,9 +72,12 @@ int Meric::getDefaultParameters()
{
Meric::outputFilenameInfo +="UnCF_";
}
#else
defaultParameter.uncoreFrequency = 0;
#endif
#ifdef HAVE_OMP_H
defaultParameter.nthreads = mutils::getenv("MERIC_NUM_THREADS", -1);
if (defaultParameter.nthreads < 0)
{
std::cerr << "MERIC ERROR: set MERIC_NUM_THREADS\n"
......@@ -88,9 +88,13 @@ int Meric::getDefaultParameters()
{
Meric::outputFilenameInfo +="thrds_";
}
#else
defaultParameter.nthreads = 0;
#endif
#if defined (HAVE_X86_ADAPT_H) || defined (HAVE_MSR_CORE_H)
#if defined HAVE_X86_ADAPT_H || defined HAVE_MSR_CORE_H || defined HAVE_GEOPM_H
defaultParameter.powerCapPKG = mutils::getenv("MERIC_PWRCAP_POWER", -1);
defaultParameter.powerCapPKGtime = mutils::getenv("MERIC_PWRCAP_TIME", -1);
if (defaultParameter.powerCapPKG < 0 || defaultParameter.powerCapPKGtime < 0)
{
std::cerr << "MERIC ERROR: set MERIC_PWRCAP_POWER [W] and MERIC_PWRCAP_TIME [us]\n";
......@@ -107,6 +111,9 @@ int Meric::getDefaultParameters()
std::cerr << "MERIC ERROR: MERIC_PWRCAP_POWER [W] must be set to change MERIC_PWRCAP_TIME [us]\n";
ret = 1;
}
#else
defaultParameter.powerCapPKG = 0;
defaultParameter.powerCapPKGtime = 0;
#endif
#ifndef HAVE_HDF5_H
......@@ -117,10 +124,10 @@ int Meric::getDefaultParameters()
return ret;
//OPTIONAL SECTION
MERIC_INFO << "Default number of threads: " << defaultParameter.nthreads << " Hz\n";
MERIC_INFO << "Default number of threads: " << defaultParameter.nthreads << "\n";
MERIC_INFO << "Default frequency: " << defaultParameter.frequency << " Hz\n";
MERIC_INFO << "Default uncore frequency: " << defaultParameter.uncoreFrequency << "\n";
MERIC_INFO << "Default powercap: " << defaultParameter.powerCapPKG << " W\t" << defaultParameter.powerCapPKGtime << " us\n";
MERIC_INFO << "Default uncore frequency: " << defaultParameter.uncoreFrequency << " Hz\n";
MERIC_INFO << "Default powercap: " << defaultParameter.powerCapPKG << " mW\t" << defaultParameter.powerCapPKGtime << " ms\n";
std::string outputFilenameSuffix = mutils::getenv("MERIC_OUTPUT_FILENAME", std::string(""));
if (outputFilenameSuffix.size() == 0)
......@@ -176,7 +183,7 @@ int Meric::getDefaultParameters()
if (Meric::COUNTERS != "none")
{
if (Meric::COUNTERS != "papi" && Meric::COUNTERS != "perfevent")
if (Meric::COUNTERS != "papi" && Meric::COUNTERS != "perfevent" && Meric::COUNTERS != "msr")
{
if (Meric::COUNTERS != "")
std::cerr << "MERIC WARNING: unknown counter type "<<Meric::COUNTERS<<std::endl;
......
......@@ -24,6 +24,7 @@
#include "../wrapper/perfeventwrapper.h"
#include "../wrapper/papiwrapper.h"
#include "../wrapper/raplwrapper.h"
#include "../wrapper/msrcounterswrapper.h"
namespace meric {
......
......@@ -38,26 +38,27 @@ SharedMeric::SharedMeric()
_storeList.push_back(new CountersStore<RAPL, unsigned long long int>(Meric::SAMPLES));
}
if (Meric::MODE == MODE_JETSON && Meric::CONTINUAL)
if (Meric::MODE == MODE_JETSON)
{
_storeList.push_back(new TimeStore<JETSON>(Meric::SAMPLES));
}
else if (Meric::MODE == MODE_THUNDER && Meric::CONTINUAL)
else if (Meric::MODE == MODE_THUNDER)
{
_storeList.push_back(new TimeStore<THUNDER>(Meric::SAMPLES));
}
else if (Meric::MODE == MODE_DAVIDE && Meric::CONTINUAL)
else if (Meric::MODE == MODE_DAVIDE)
{
_storeList.push_back(new TimeStore<DAVIDE>(Meric::SAMPLES));
}
if (Meric::COUNTERS != "none")
{
if (Meric::COUNTERS == "perfevent")
_storeList.push_back(new CountersStore<PERFEVENT, unsigned long long int>(Meric::SAMPLES));
else if (Meric::COUNTERS == "papi")
_storeList.push_back(new CountersStore<PAPI, unsigned long long int>(Meric::SAMPLES));
else if (Meric::COUNTERS == "msr")
_storeList.push_back(new CountersStore<MSR, uint64_t>(Meric::SAMPLES));
}
if (_storeList.size() > 0 || Meric::MODE == MODE_TIME)
......@@ -82,22 +83,20 @@ SharedMeric::SharedMeric()
//wrappers must be initialized after meric instantiation
//RAPL counter expects that environment::init() was already called
//RAPL + MSR wrappers expects that environment::init() was already called
if (Meric::COUNTERS == "perfevent")
PERFEVENT::init();
if (Meric::COUNTERS == "papi")
PAPI::init();
if (Meric::MODE == MODE_RAPL || Meric::MODE == MODE_BOTH)
{
// if (Meric::DETAILED)
// RAPL::detailed();
RAPL::init(Meric::DETAILED);
}
if (Meric::MODE == MODE_JETSON && Meric::CONTINUAL)
if (Meric::COUNTERS == "msr")
MSR::init();
if (Meric::MODE == MODE_JETSON)
JETSON::init();
else if (Meric::MODE == MODE_THUNDER && Meric::CONTINUAL)
else if (Meric::MODE == MODE_THUNDER)
THUNDER::init();
else if (Meric::MODE == MODE_DAVIDE && Meric::CONTINUAL)
else if (Meric::MODE == MODE_DAVIDE)
{
DAVIDE::init();
DAVIDE::start(_startTime);
......@@ -121,7 +120,7 @@ SharedMeric::~SharedMeric()
{
HDEEM::close();
}
else if (Meric::MODE == MODE_DAVIDE && Meric::CONTINUAL)
else if (Meric::MODE == MODE_DAVIDE)
{
DAVIDE::close();
}
......
......@@ -32,7 +32,7 @@ void AggregateStore<TStore>::saveInterval(std::ofstream &ss, std::vector<size_t>
sumEnergy += _buffer[i].energy;
}
ss << "\n# Blade summary - hdeem\n"
ss << "\n# Blade summary\n"
<< "Average energy consumption [J]," << sumEnergy/this->_size << '\n'
<< "Maximal energy consumption [J]," << maxEnergy << '\n'
<< "Minimal energy consumption [J]," << minEnergy << '\n'
......
......@@ -38,7 +38,7 @@ void DetailedAggregateStore<TStore>::saveInterval(std::ofstream &ss, std::vector
// Blade values //
//////////////////
ss << "\n# Blade summary - HDEEM\n"
ss << "\n# Blade summary\n"
<< "Average energy consumption [J]," << sumEnergy/this->_size << '\n'
<< "Maximal energy consumption [J]," << maxEnergy << '\n'
<< "Minimal energy consumption [J]," << minEnergy << '\n'
......
......@@ -5,6 +5,7 @@
#include "countersstore.h"
#include "../wrapper/perfeventwrapper.h"
#include "../wrapper/papiwrapper.h"
#include "../wrapper/msrcounterswrapper.h"
#include "../wrapper/raplwrapper.h"
#ifdef HAVE_MPI_H
......@@ -100,6 +101,7 @@ template <class TCounter, typename TType> void CountersStore<TCounter, TType>::s
template class CountersStore <PERFEVENT, unsigned long long int>;
template class CountersStore <PAPI, unsigned long long int>;
template class CountersStore <MSR, uint64_t>;
template class CountersStore <RAPL, unsigned long long int>;
template class CountersStore <HDEEM, double>;
......@@ -46,7 +46,7 @@ void DetailedTimeStore::saveInterval(std::ofstream &ss, std::vector<size_t> &iSt
{
if (printSamples)
{
ss << "# Blade samples" << std::endl;
ss << "# Blade (" << HDEEM::storeLabel <<") samples [W]"<< std::endl;
std::vector<double> samples;
HDEEM::getSamplesList(0, firstBlade, lastBlade, samples);
size_t it = firstBlade;
......@@ -81,7 +81,7 @@ void DetailedTimeStore::saveInterval(std::ofstream &ss, std::vector<size_t> &iSt
{
if(printSamples)
{
ss << "# Voltage regulator (" << HDEEM::vrSensorLabel[sensorID] << ") samples" << std::endl;
ss << "# Voltage regulator (" << HDEEM::vrSensorLabel[sensorID] << ") samples [W]" << std::endl;
std::vector<double> samples;
HDEEM::getSamplesList(sensorID, firstVR, lastVR, samples);
size_t it = firstVR;
......
......@@ -97,14 +97,14 @@ void TimeEnergyStore::saveInterval(std::ofstream &ss, std::vector<size_t> &iStar
// Blade values //
//////////////////
if(printSamples)
ss << "# Blade samples - " << HDEEM::storeLabel << std::endl;
// if(printSamples)
// ss << "# Blade (" << HDEEM::storeLabel <<") samples [W]"<< std::endl;
if(lastBlade > 0 && lastBlade > firstBlade)
{
if (printSamples)
{
ss << "# Blade samples - " << HDEEM::storeLabel << std::endl;
ss << "# Blade (" << HDEEM::storeLabel <<") samples [W]"<< std::endl;
std::vector<double> samples;
HDEEM::getSamplesList(0, firstBlade, lastBlade, samples);
for (size_t it = firstBlade; it < lastBlade; it++)
......@@ -144,7 +144,7 @@ void TimeEnergyStore::saveInterval(std::ofstream &ss, std::vector<size_t> &iStar
{
if(printSamples)
{
ss << "# Voltage regulator (" << HDEEM::vrSensorLabel[sensorID] << ") samples" << std::endl;
ss << "# Voltage regulator (" << HDEEM::vrSensorLabel[sensorID] << ") samples [W]" << std::endl;
std::vector<double> samples;
HDEEM::getSamplesList(sensorID, firstVR, lastVR, samples);
for (size_t it = firstVR; it < lastVR; it++)
......
......@@ -140,7 +140,7 @@ template <class TSystem> void TimeStore<TSystem>::saveInterval(std::ofstream &ss
{
if (printSamples)
{
ss << "# Blade samples" << std::endl;
ss << "# Blade (" << TSystem::storeLabel <<") samples [W]"<< std::endl;
std::vector<double> samples;
TSystem::getSamplesList(0, firstBlade, lastBlade, samples);
size_t it = firstBlade;
......
......@@ -16,12 +16,12 @@ const std::string COUNTER_CACHE_ACCESS = "PAPI_L3_TCA";
const std::string COUNTER_HW_INSTRUCTIONS = "PAPI_TOT_INS";
const std::string COUNTER_FREQ = "PAPI_TOT_CYC";
static std::map<std::string, std::string> counterLabel = {
{ "perf_raw::r04C6", "COUNTER_AVX" },
{ "PAPI_L3_TCM", "COUNTER_L3_MISSES" },
{ "PAPI_L3_TCA", "COUNTER_L3_ACCESS" },
{ "PAPI_TOT_INS", "COUNTER_HW_INSTRUCTIONS" },
{ "PAPI_TOT_CYC", "COUNTER_CPU_CYCLES" }
static std::map<const std::string, std::string> counterLabel = {
{ COUNTER_AVX, "COUNTER_AVX" },
{ COUNTER_CACHE_MISSES, "COUNTER_L3_MISSES" },
{ COUNTER_CACHE_ACCESS, "COUNTER_L3_ACCESS" },
{ COUNTER_HW_INSTRUCTIONS, "COUNTER_HW_INSTRUCTIONS" },
{ COUNTER_FREQ, "COUNTER_CPU_CYCLES" }
};
}
......@@ -41,14 +41,37 @@ const std::string COUNTER_CACHE_MISSES = "COUNTER_CACHE_MISSES";
const std::string COUNTER_HW_INSTRUCTIONS = "COUNTER_HW_INSTRUCTIONS";
const std::string COUNTER_FREQ = "PERF_COUNT_HW_CPU_CYCLES";
static std::map<std::string, std::string> counterLabel = {
{ "COUNTER_AVX", "COUNTER_AVX" },
{ "COUNTER_AVX_ALL", "COUNTER_AVX_ALL" },
{ "COUNTER_CACHE_MISSES", "COUNTER_CACHE_MISSES" },
{ "COUNTER_HW_INSTRUCTIONS", "COUNTER_HW_INSTRUCTIONS" },
{ "PERF_COUNT_HW_CPU_CYCLES", "COUNTER_CPU_CYCLES" }
static std::map<const std::string, std::string> counterLabel = {
{ COUNTER_AVX, "COUNTER_AVX" },
{ COUNTER_AVX_ALL, "COUNTER_AVX_ALL" },
{ COUNTER_CACHE_MISSES, "COUNTER_CACHE_MISSES" },
{ COUNTER_HW_INSTRUCTIONS, "COUNTER_HW_INSTRUCTIONS" },
{ COUNTER_FREQ, "COUNTER_CPU_CYCLES" }
};
}
////////////////////////////////////////////////////////////////////////////////
/**
* to add new MSR register to read:
* the class is ready for reading the whole register without any shift or bitwise xor
* the counterLabel map works the opposite way than in case of the others
* a label of the register is a key for the register definition
* adder register must be inited in MSR::initMap(std::map<std::string, uint64_t> & dict)
* accordig it is related to core/socket/node
**/
namespace MSR_COUNTERS {
const std::string APERF = "APERF";
const std::string MPERF = "MPERF";
const std::string UCF_FREQ = "UCF_FREQ_CNT";
#if defined HAVE_MSR_CORE_H && defined SRC_WRAPPER_MSRCOUNTERSWRAPPER_H_
static std::map<const std::string, uint64_t> counterLabel = {
{ APERF, IA32_APERF },
{ MPERF, IA32_MPERF },
{ UCF_FREQ, MSR_U_PMON_UCLK_FIXED_CTR }
};
#endif
}
////////////////////////////////////////////////////////////////////////////////
/**
......@@ -63,27 +86,29 @@ namespace X86ADAPT_RAPL_COUNTERS {
const std::string RAPL_PCKG_ENERGY = "Intel_RAPL_Pckg_Energy";
const std::string RAPL_RAM_ENERGY = "Intel_RAPL_RAM_Energy";
const std::string RAPL_SUM_ENERGY = "Energy summary [J]"; //PCKG+RAM = not a counter to measure
const std::string RAPL_SUM_ENERGY = "Energy consumption [J]"; //PCKG+RAM = not a counter to measure
/*
const std::string RAPL_PP0_ENERGY = "Intel_RAPL_PP0_Energy"; //Taurus doesn't support
const std::string RAPL_PP0_ENERGY = "Intel_RAPL_PP0_Energy"; //Haswell-EP doesn't support
const std::string RAPL_DRAM_CH0 = "Intel_DRAM_ENERGY_STATUS_CH0";
const std::string RAPL_DRAM_CH1 = "Intel_DRAM_ENERGY_STATUS_CH1";
const std::string RAPL_DRAM_CH2 = "Intel_DRAM_ENERGY_STATUS_CH2";
const std::string RAPL_DRAM_CH3 = "Intel_DRAM_ENERGY_STATUS_CH3";
const std::string RAPL_PLATFORM_ENERGY = ?
*/
const std::string RAPL_PCKG_POWER_LIMIT = "Intel_RAPL_PKG_POWER_LIMIT_1";
const std::string RAPL_RAM_POWER_LIMIT = "Intel_RAPL_RAM_POWER_LIMIT";
// const std::string RAPL_PLATFORM_POWER_LIMIT = ?
const std::string RAPL_POWER_LIMIT_TIMEWINDOW = "Intel_RAPL_POWER_UNIT_TIMEWINDOW";
static std::map<std::string, std::string> counterLabel = {
{ "Intel_RAPL_Pckg_Energy", "RAPL_PCKG [J]" },
{ "Intel_RAPL_RAM_Energy", "RAPL_RAM [J]" },
{ "Intel_RAPL_Pckg_Energy_0", "RAPL_PCKG_0 [J]" },
{ "Intel_RAPL_Pckg_Energy_1", "RAPL_PCKG_1 [J]" },
{ "Intel_RAPL_RAM_Energy_0", "RAPL_RAM_0 [J]" },
{ "Intel_RAPL_RAM_Energy_1", "RAPL_RAM_1 [J]" },
{ "Energy summary [J]", "Energy summary [J]" }
static std::map<const std::string, std::string> counterLabel = {
{ RAPL_PCKG_ENERGY, "RAPL_PCKG [J]" },
{ RAPL_RAM_ENERGY, "RAPL_RAM [J]" },
{ RAPL_PCKG_ENERGY+"_0", "RAPL_PCKG_0 [J]" },
{ RAPL_PCKG_ENERGY+"_1", "RAPL_PCKG_1 [J]" },
{ RAPL_RAM_ENERGY+"_0", "RAPL_RAM_0 [J]" },
{ RAPL_RAM_ENERGY+"_1", "RAPL_RAM_1 [J]" },
{ RAPL_SUM_ENERGY, "Energy consumption [J]" }
};
}
////////////////////////////////////////////////////////////////////////////////
......@@ -91,40 +116,68 @@ namespace MSR_RAPL_COUNTERS {
const std::string RAPL_PCKG_ENERGY = "MSR_PKG_ENERGY_STATUS";
const std::string RAPL_RAM_ENERGY = "MSR_DRAM_ENERGY_STATUS";
const std::string RAPL_SUM_ENERGY = "Energy summary [J]"; //PCKG+RAM = not a counter to measure
// const std::string RAPL_PLATFORM_ENERGY = "MSR_PLATFORM_ENERGY_COUNTER";
const std::string RAPL_SUM_ENERGY = "Energy consumption [J]"; //PCKG+RAM = not a counter to measure
/*
const std::string RAPL_PP0_ENERGY = "MSR_PP0_ENERGY_STATUS"; //not available
const std::string RAPL_PP1_ENERGY = "MSR_PP1_ENERGY_STATUS";
*/
const std::string RAPL_PCKG_POWER_LIMIT = "MSR_PKG_POWER_LIMIT";
const std::string RAPL_RAM_POWER_LIMIT = "MSR_DRAM_POWER_LIMIT";
// const std::string RAPL_PLATFORM_POWER_LIMIT = "MSR_PLATFORM_POWER_LIMIT";
const std::string RAPL_POWER_LIMIT_TIMEWINDOW = "MSR_RAPL_POWER_UNIT_TIMEWINDOW";
static std::map<std::string, std::string> counterLabel = {
{ "MSR_PKG_ENERGY_STATUS", "RAPL_PCKG [J]" },
{ "MSR_DRAM_ENERGY_STATUS", "RAPL_RAM [J]" },
{ "MSR_PKG_ENERGY_STATUS_0", "RAPL_PCKG_0 [J]" },
{ "MSR_PKG_ENERGY_STATUS_1", "RAPL_PCKG_1 [J]" },
{ "MSR_DRAM_ENERGY_STATUS_0", "RAPL_RAM_0 [J]" },
{ "MSR_DRAM_ENERGY_STATUS_1", "RAPL_RAM_1 [J]" },
{ "Energy summary [J]", "Energy summary [J]" }
static std::map<const std::string, std::string> counterLabel = {
{ RAPL_PCKG_ENERGY, "RAPL_PCKG [J]" },
{ RAPL_RAM_ENERGY, "RAPL_RAM [J]" },
{ RAPL_PCKG_ENERGY+"_0", "RAPL_PCKG_0 [J]" },
{ RAPL_PCKG_ENERGY+"_1", "RAPL_PCKG_1 [J]" },
{ RAPL_RAM_ENERGY+"_0", "RAPL_RAM_0 [J]" },
{ RAPL_RAM_ENERGY+"_1", "RAPL_RAM_1 [J]" },
{ RAPL_SUM_ENERGY, "Energy consumption [J]" }
};
#ifdef HAVE_MSR_CORE_H
#include <master.h>
static std::map<std::string, uint64_t> counterDefines = {
{ "MSR_PKG_ENERGY_STATUS", MSR_PKG_ENERGY_STATUS },
{ "MSR_DRAM_ENERGY_STATUS", MSR_DRAM_ENERGY_STATUS },
{ "MSR_PKG_ENERGY_STATUS_0", MSR_PKG_ENERGY_STATUS },
{ "MSR_PKG_ENERGY_STATUS_1", MSR_PKG_ENERGY_STATUS },
{ "MSR_DRAM_ENERGY_STATUS_0", MSR_DRAM_ENERGY_STATUS },
{ "MSR_DRAM_ENERGY_STATUS_1", MSR_DRAM_ENERGY_STATUS },
{ "Energy summary [J]", 0x0 }
static std::map<const std::string, uint64_t> counterDefines = {
{ RAPL_PCKG_ENERGY, MSR_PKG_ENERGY_STATUS },
{ RAPL_RAM_ENERGY, MSR_DRAM_ENERGY_STATUS },
{ RAPL_PCKG_ENERGY+"_0", MSR_PKG_ENERGY_STATUS },
{ RAPL_PCKG_ENERGY+"_1", MSR_PKG_ENERGY_STATUS },
{ RAPL_RAM_ENERGY+"_0", MSR_DRAM_ENERGY_STATUS },
{ RAPL_RAM_ENERGY+"_1", MSR_DRAM_ENERGY_STATUS },
{ RAPL_SUM_ENERGY, 0x0 }
};
#endif
}
////////////////////////////////////////////////////////////////////////////////
namespace GEOPM_RAPL_COUNTERS {
const std::string RAPL_PCKG_ENERGY = "MSR::PKG_ENERGY_STATUS#";
const std::string RAPL_RAM_ENERGY = "MSR::DRAM_ENERGY_STATUS#";
// const std::string RAPL_PLATFORM_ENERGY = "MSR::PLATFORM_ENERGY_COUNTER#";
const std::string RAPL_SUM_ENERGY = "Energy consumption [J]"; //PCKG+RAM = not a counter to measure
const std::string RAPL_PCKG_POWER_LIMIT = "MSR::PKG_POWER_LIMIT#";
const std::string RAPL_PCKG_POWER_LIMIT_1 = "MSR::PKG_POWER_LIMIT:PL1_POWER_LIMIT";
// const std::string RAPL_PLATFORM_POWER_LIMIT = "MSR::PLATFORM_POWER_LIMIT#";
const std::string RAPL_RAM_POWER_LIMIT = "MSR::DRAM_POWER_LIMIT:POWER_LIMIT";
const std::string RAPL_POWER_LIMIT_TIMEWINDOW = "MSR::PKG_POWER_LIMIT:PL1_TIME_WINDOW";
static std::map<const std::string, std::string> counterLabel = {
{ RAPL_PCKG_ENERGY, "RAPL_PCKG [J]" },
{ RAPL_RAM_ENERGY, "RAPL_RAM [J]" },
{ RAPL_PCKG_ENERGY+"_0", "RAPL_PCKG_0 [J]" },
{ RAPL_PCKG_ENERGY+"_1", "RAPL_PCKG_1 [J]" },
{ RAPL_RAM_ENERGY+"_0", "RAPL_RAM_0 [J]" },
{ RAPL_RAM_ENERGY+"_1", "RAPL_RAM_1 [J]" },
{ RAPL_SUM_ENERGY, "Energy consumption [J]" }
};
}
#endif /* SRC_WRAPPER_COUNTERS_H_ */
......@@ -24,8 +24,13 @@ public:
static double computationalIntensity(long long instructions, long long miss) {return miss ? instructions/miss : instructions; };
//average CPU core frequency in GHz for a specific time range
static double REAL_CPU_FREQUENCY(long long cycles, double time) {return 1.0E-09*(cycles/time);};
//average CPU core frequency in a specified time range [Hz]
static double CPU_FREQUENCY_FROM_CYCLES(long long cycles, double time) {return cycles/time;};
static double CPU_FREQUENCY_FROM_Pstate_PERF(uint64_t aperf, uint64_t mperf, uint64_t nominal_freq) { return mperf ? (aperf/(double)mperf)*nominal_freq : 0; };
//average CPU uncore frequency in a specified time range [Hz]
static double CPU_UNCORE_FREQUNECY(uint64_t cycles, double time) { return cycles ? cycles/time : 0; };
};
}
......
This diff is collapsed.
......@@ -2,21 +2,14 @@
#ifndef SRC_WRAPPER_DAVIDEWRAPPER_H_
#define SRC_WRAPPER_DAVIDEWRAPPER_H_
#include "../basis/spline.h"
#include "../basis/utils.h"
#include "../basis/json.h"
#include <cstdlib>
#include <iostream>
#include <time.h>
#include <ctime>
#include <array>
#include <vector>
#include <map>
#include <unistd.h>
#include <cmath>
#include <climits>
#ifdef HAVE_RESTCLIENT_CPP_RESTCLIENT_H
// *** KairosDB setup for DAVIDE ponitoring system
// *** KairosDB setup for DAVIDE monitoring system
#define KAIROSDB_SERVER "192.168.1.97"
#define KAIROSDB_PORT "8083"
#define KAIROSDB_USER "admin"
......@@ -33,13 +26,13 @@ class DAVIDE {
public:
static std::string getCountersLabel() { return "DAVIDE";};
static const int FREQUENCY = 1000;
static const int PROBE_NUMBER = 1; //BLADE + {"CPU0", "CPU1", "DDR AB", "DDR CD", "DDR EF", "DDR GH"}; kolik zarizeni merime
static const int PROBE_NUMBER = 1; //no voltage regulators, just blade
static std::vector<std::string> vrSensorLabel; //voltage regulator vector
static std::string storeLabel;
static std::vector<std::string> vrSensorLabel; //Voltage regulator
static void deleteSamples() {};
static std::string getCountersLabel() { return storeLabel;};
static void deleteSamples() {};
static void start(timespec & time)
{
clock_gettime(CLOCK_REALTIME, &time);
......
This diff is collapsed.
......@@ -2,6 +2,7 @@
#define SRC_WRAPPER_ENVIRONMENTWRAPPER_H_
#include "../basis/utils.h"
#include "../basis/json.h"
#ifdef HAVE_CPUFREQ_H
#include <cpufreq.h>
......@@ -32,7 +33,7 @@
#endif
#ifdef HAVE_CILK_CILK_API_H
#include <cilk/cilk_api.h>
#include <cilk/cilk_api.h>
#endif
#ifdef HAVE_OMP_H
......@@ -138,12 +139,14 @@ public:
static void threadNumber(int nthreads);
static void powercap(uint64_t power, uint64_t timeWindow = 0, int socket = -1);
static void init(int system, RegionParameters defaultParameter, int rank);
static void restoreSystemSettings();
static void restoreSystemSettings(bool hardReset = false);
static void close();
static systemLimits getSystemSettings() { return defaultSettings[systemType]; };
private:
static void initHWSizes();
static void getSystemDefaultSettings();
static void storeSystemDefaultSettings();
static systemLimits defaultSettings [5];
static bool usedDVFS;
......
#include "msrcounterswrapper.h"
#include "../basis/utils.h"
using namespace meric;
uint64_t MSR::COUNTERMAX = 0xFFFFFFFFFFFFFFFF;
uint64_t MSR::nominal_freq = 0;
#ifdef HAVE_MSR_CORE_H
std::map<std::string, uint64_t> MSR::counters;
void MSR::init()
{
//msr library has been already initialized in Environment::init(...)
initMap(counters);
//TODO prepare a msr batch
uint64_t PLATFORM_INFO_ADDR_bits;
read_msr_by_idx(0, PLATFORM_INFO_ADDR, &PLATFORM_INFO_ADDR_bits);
nominal_freq = ((PLATFORM_INFO_ADDR_bits & PLATFORM_INFO_ADDR_mask) >> PLATFORM_INFO_ADDR_shift) * 100000000;
}
void MSR::close()
{
//library will be finalized in Environment::close()
}
void MSR::getCounterValues(std::map<std::string, uint64_t> & record)
{
for(std::map<std::string, uint64_t>::iterator iterator = counters.begin(); iterator != counters.end(); iterator++)
{
size_t pos = iterator->first.find_last_of("_");
uint64_t val = 0;
uint64_t reg = MSR_COUNTERS::counterLabel[iterator->first.substr(0,pos)];
read_msr_by_idx(std::stoi(iterator->first.substr(pos+1)), reg, &val);
record[iterator->first] = val;
}
}
#else
#endif
void MSR::getRatios(std::map<std::string, uint64_t>& start, std::map<std::string, uint64_t>& stop, double runtime, std::map <std::string, double> & ratios)
{
int i = 0;
std::string suffix = "_0";
while(stop.count(MSR_COUNTERS::APERF + suffix) && stop.count(MSR_COUNTERS::MPERF + suffix))
{
ratios["CPU_FREQ"+suffix+" [Hz]"] = CountersRates::CPU_FREQUENCY_FROM_Pstate_PERF(
getResultValue(start[MSR_COUNTERS::APERF + suffix], stop[MSR_COUNTERS::APERF + suffix], runtime, ""),
getResultValue(start[MSR_COUNTERS::MPERF + suffix], stop[MSR_COUNTERS::MPERF + suffix], runtime, ""),
nominal_freq);
suffix = "_" +std::to_string(++i);
}
i = 0;
suffix = "_0";
while(stop.count(MSR_COUNTERS::UCF_FREQ + suffix))
{
ratios["CPU_UNCORE_FREQ"+suffix+" [Hz]"] = CountersRates::CPU_UNCORE_FREQUNECY(
getResultValue(start[MSR_COUNTERS::UCF_FREQ + suffix], stop[MSR_COUNTERS::UCF_FREQ + suffix], runtime, ""),
runtime);
suffix = "_" + std::to_string(++i);
}
}
std::string MSR::getCountersLabel()
{
return "MSR";
}
std::string MSR::getCounterLabel(std::string counter)
{
return counter;
}
std::string MSR::getSummaryCounterName()
{
return "";
}
void MSR::getSummaryValue(double time, unsigned long long int * counterSummary)
{
*counterSummary = ULLONG_MAX;
}
// solve counter overflow
uint64_t MSR::getResultValue(uint64_t startValue, uint64_t stopValue, double runtime, std::string counter)
{
if (stopValue < startValue)
{
MERIC_INFO << "MSR OVERFLOW, MAX VALUE: " << COUNTERMAX <<" " <<counter << std::endl
<< "MSR REPAIR " << startValue << " .. " << stopValue << " = " << COUNTERMAX- startValue + stopValue << std::endl;
return COUNTERMAX - startValue + stopValue;
}
else
return stopValue - startValue;
}
void MSR::initMap(std::map<std::string, uint64_t> & dict)
{
uint64_t SOCKET_SIZE_CPU = 0;
uint64_t NODE_SIZE_SOCKET = 0;
#ifdef HAVE_MSR_CORE_H
core_config(&SOCKET_SIZE_CPU, NULL, &NODE_SIZE_SOCKET, NULL);
#endif
for (int i=0; i < NODE_SIZE_SOCKET * SOCKET_SIZE_CPU; i++)
{
std::string suffix = "_" + std::to_string(i);
dict[MSR_COUNTERS::APERF + suffix] = 0;
dict[MSR_COUNTERS::MPERF + suffix] = 0;
}
for (int i=0; i < NODE_SIZE_SOCKET; i++)
dict[MSR_COUNTERS::UCF_FREQ+ "_" + std::to_string(i)] = 0;
}
#ifndef SRC_WRAPPER_MSRCOUNTERSWRAPPER_H_
#define SRC_WRAPPER_MSRCOUNTERSWRAPPER_H_
#include <map>
#include <iostream>
#include <climits>
#include <vector>
#include <omp.h>
#ifdef HAVE_MSR_CORE_H
#include <msr_core.h>
#include <msr_clocks.h>
#include <libmsr_error.h>
#ifndef MSR_U_PMON_UCLK_FIXED_CTR
#define MSR_U_PMON_UCLK_FIXED_CTR 0x704
#endif
#ifndef PLATFORM_INFO_ADDR
#define PLATFORM_INFO_ADDR 0xCE
#endif
const uint64_t PLATFORM_INFO_ADDR_mask = 0xFF00;
const uint64_t PLATFORM_INFO_ADDR_shift = 8;
#endif
#include "counters.h"
#include "countersrates.h"
namespace meric {
#ifdef HAVE_MSR_CORE_H
class MSR{
public:
static void init();
static void close();
static void getCounterValues(std::map<std::string, uint64_t> & record);
static uint64_t getResultValue(uint64_t startValue, uint64_t stopValue, double runtime, std::string counter);
static void getSummaryValue(double time, unsigned long long int * counterSummary);
static std::string getSummaryCounterName();
static std::string getCountersLabel();
static std::string getCounterLabel(std::string counter);
static void getRatios(std::map<std::string, uint64_t>& start, std::map<std::string, uint64_t>& stop, double runtime, std::map <std::string, double> & ratios);
private:
static void initMap(std::map<std::string,uint64_t> & dict);
//list of counters
static std::map<std::string, uint64_t> counters;
static uint64_t COUNTERMAX;
static uint64_t nominal_freq;
};
#else
class MSR {
public:
static void init() {};
static void close() {};
static void getCounterValues(std::map<std::string, uint64_t> & record) {};
static uint64_t getResultValue(uint64_t startValue, uint64_t stopValue, double runtime, std::string counter);
static void getSummaryValue(double time, unsigned long long int * counterSummary);
static std::string getSummaryCounterName();
static std::string getCountersLabel();
static std::string getCounterLabel(std::string counter);
static void getRatios(std::map<std::string, uint64_t>& start, std::map<std::string, uint64_t>& stop, double runtime, std::map <std::string, double> & ratios);
private:
static void initMap(std::map<std::string, uint64_t> & dict);
static uint64_t COUNTERMAX;
static uint64_t nominal_freq;
};
#endif
}
#endif /* SRC_WRAPPER_MSRCOUNTERSWRAPPER_H_ */
......@@ -153,7 +153,7 @@ void PAPI::getRatios(std::map<std::string, unsigned long long int>& start, std::
if (stop.count(PAPI_COUNTERS::COUNTER_FREQ))
{
ratios["CPU frequency [GHz]"] = CountersRates::REAL_CPU_FREQUENCY(
ratios["CPU frequency [Hz]"] = CountersRates::CPU_FREQUENCY_FROM_CYCLES(
stop[PAPI_COUNTERS::COUNTER_FREQ] -
start[PAPI_COUNTERS::COUNTER_FREQ],
runtime
......
......@@ -24,7 +24,6 @@ public:
static void close();
static void getCounterValues(std::map<std::string, unsigned long long int> & record);
static void initMap(std::map<std::string, unsigned long long int> & dict);
static unsigned long long getResultValue(unsigned long long int startValue, unsigned long long int stopValue, double runtime, std::string counter);
static void getSummaryValue(double time, unsigned long long int * counterSummary);
static std::string getSummaryCounterName();
......@@ -32,6 +31,7 @@ public:
static std::string getCounterLabel(std::string counter);
static void getRatios(std::map<std::string, unsigned long long int>& start, std::map<std::string, unsigned long long int>& stop, double runtime, std::map <std::string, double> & ratios);
private:
static void initMap(std::map<std::string, unsigned long long int> & dict);
//list of counters
static std::map<std::string, unsigned long long int> counters;
static int eventSet;
......@@ -48,7 +48,6 @@ public:
static void init() {};
static void close() {};
static void getCounterValues(std::map<std::string, unsigned long long int> & record) {};
static void initMap(std::map<std::string, unsigned long long int> & dict);
static unsigned long long getResultValue(unsigned long long int startValue, unsigned long long int stopValue, double runtime, std::string counter);
static void getSummaryValue(double time, unsigned long long int * counterSummary);
static std::string getSummaryCounterName();
......@@ -56,6 +55,7 @@ public:
static std::string getCounterLabel(std::string counter);
static void getRatios(std::map<std::string, unsigned long long int>& start, std::map<std::string, unsigned long long int>& stop, double runtime, std::map <std::string, double> & ratios);
private:
static void initMap(std::map<std::string, unsigned long long int> & dict);
static unsigned long long int COUNTERMAX;
};
......
......@@ -142,7 +142,7 @@ void PERFEVENT::getRatios(std::map<std::string, unsigned long long int>& start,
if (stop.count(PERFEVENT_COUNTERS::COUNTER_FREQ))
{
ratios["CPU frequency [GHz]"] = CountersRates::REAL_CPU_FREQUENCY(
ratios["CPU frequency [Hz]"] = CountersRates::CPU_FREQUENCY_FROM_CYCLES(
stop[PERFEVENT_COUNTERS::COUNTER_FREQ] -
start[PERFEVENT_COUNTERS::COUNTER_FREQ],
runtime
......
......@@ -24,7 +24,6 @@ public:
static void close();
static void getCounterValues(std::map<std::string, unsigned long long int> & record);
static void initMap(std::map<std::string, unsigned long long int> & dict);
static unsigned long long getResultValue(unsigned long long int startValue, unsigned long long int stopValue, double runtime, std::string counter);
static void getSummaryValue(double time, unsigned long long int * counterSummary);
static std::string getSummaryCounterName();
......@@ -34,6 +33,7 @@ public:
private:
static void start();
static long openCounter(perf_event_attr attr);
static void initMap(std::map<std::string, unsigned long long int> & dict);
//list of counters
static std::map<std::string,unsigned long long int> counters;
static unsigned long long int COUNTERMAX;
......@@ -48,7 +48,6 @@ public:
static void start() {};
static void stop() {};
static void getCounterValues(std::map<std::string, unsigned long long int> & record) {};
static void initMap(std::map<std::string, unsigned long long int> & dict);
static unsigned long long getResultValue(unsigned long long int startValue, unsigned long long int stopValue, double runtime, std::string counter);
static void getSummaryValue(double time, unsigned long long int * counterSummary);
static std::string getSummaryCounterName();
......@@ -56,6 +55,7 @@ public:
static std::string getCounterLabel(std::string counter);
static void getRatios(std::map<std::string, unsigned long long int>& start, std::map<std::string, unsigned long long int>& stop, double runtime, std::map <std::string, double> & ratios);
private:
static void initMap(std::map<std::string, unsigned long long int> & dict);
static unsigned long long int COUNTERMAX;
};
#endif
......
......@@ -81,7 +81,7 @@ unsigned long long int RAPL::COUNTERMAX = pow(2,32);
uint64_t RAPL::NODE_SIZE_SOCKET = 1;
std::map<std::string, double> RAPL::units;
#if defined (HAVE_X86_ADAPT_H) || defined (HAVE_MSR_CORE_H)
#if defined HAVE_X86_ADAPT_H || defined HAVE_MSR_CORE_H || defined HAVE_GEOPM_H
std::map<std::string, unsigned long long int> RAPL::counters;
uint64_t RAPL::SOCKET_SIZE_CPU = 1;
......@@ -120,6 +120,9 @@ void RAPL::init(bool detailed)
#elif defined HAVE_X86_ADAPT_H
NODE_SIZE_SOCKET = x86_adapt_get_nr_avaible_devices(X86_ADAPT_DIE);
//SOCKET_SIZE_CPU is not used when using adapt
#elif defined HAVE_GEOPM_H
const geopm::PlatformTopo::PlatformTopo &topo = geopm::platform_topo();
NODE_SIZE_SOCKET = topo.num_domain(GEOPM_DOMAIN_PACKAGE);
#endif
initMap(counters);
//initCountersUnits() is already called from environmentwrapper
......@@ -141,6 +144,8 @@ void RAPL::initCountersUnits()
x86_adapt_get_setting(fd, itemId, &MSR_RAPL_POWER_UNIT_bits);
if (x86_adapt_put_device(X86_ADAPT_DIE, 0))
std::cerr << "X86ADAPT RAPL INIT error while closing file descriptor\n";
#elif defined HAVE_GEOPM_H
MSR_RAPL_POWER_UNIT_bits = geopm_signal_to_field(pio.read_signal("MSR::RAPL_POWER_UNIT#", pio.signal_domain_type("MSR::RAPL_POWER_UNIT#"), 0));
#endif
if (MSR_RAPL_POWER_UNIT_bits != 0)
{
......@@ -226,7 +231,7 @@ void RAPL::getCounterValues(std::map<std::string, unsigned long long int> & reco
}
////////////////////////////////////////////////////////////////////////////////
#elif defined HAVE_MSR_CORE_H
#elif defined HAVE_MSR_CORE_H || defined HAVE_GEOPM_H
void RAPL::getCounterValues(std::map<std::string, unsigned long long int> & record)
{
for(std::map<std::string, unsigned long long int>::iterator iterator = counters.begin(); iterator != counters.end(); iterator++)
......@@ -243,7 +248,11 @@ void RAPL::getCounterValues(std::map<std::string, unsigned long long int> & reco
if ((iterator->first.back()-'0') != die)
continue;
std::string itemName = iterator->first.substr(0,iterator->first.length() - suffix.length() - 1);
read_msr_by_idx(die * SOCKET_SIZE_CPU, counterDefines[itemName], &dieEnergy);
#ifdef HAVE_MSR_CORE_H
read_msr_by_idx(die * SOCKET_SIZE_CPU, counterDefines[itemName], &dieEnergy);
#elif defined HAVE_GEOPM_H
dieEnergy = geopm_signal_to_field(pio.read_signal(itemName, pio.signal_domain_type(itemName), die * SOCKET_SIZE_CPU));
#endif
record [itemName+suffix+std::to_string(die)] = (dieEnergy & MSR_PKG_ENERGY_STATUS_mask);
}
}
......@@ -255,7 +264,11 @@ void RAPL::getCounterValues(std::map<std::string, unsigned long long int> & reco
for(std::map<std::string, unsigned long long int>::iterator iterator = counters.begin(); iterator != counters.end(); iterator++)
{
read_msr_by_idx(die * SOCKET_SIZE_CPU, counterDefines[iterator->first], &dieEnergy);
#ifdef HAVE_MSR_CORE_H
read_msr_by_idx(die * SOCKET_SIZE_CPU, counterDefines[iterator->first], &dieEnergy);
#elif defined HAVE_GEOPM_H
dieEnergy = geopm_signal_to_field(pio.read_signal(iterator->first, pio.signal_domain_type(iterator->first), die * SOCKET_SIZE_CPU));
#endif
record [iterator->first] += (dieEnergy & MSR_PKG_ENERGY_STATUS_mask);
}
}
......
......@@ -9,9 +9,14 @@
#ifdef HAVE_X86_ADAPT_H
#include <x86_adapt.h>
#elif defined (HAVE_MSR_CORE_H)
#elif defined HAVE_MSR_CORE_H
#include <msr_core.h>
#include <msr_rapl.h>
#elif defined HAVE_GEOPM_H
#include <geopm/PlatformTopo.hpp>
#include <geopm/PlatformIO.hpp>
#include <geopm_hash.h>
static geopm::PlatformIO &pio = geopm::platform_io();
#endif
#include "counters.h"
......@@ -20,8 +25,10 @@
#ifdef HAVE_X86_ADAPT_H
using namespace X86ADAPT_RAPL_COUNTERS;
#elif defined (HAVE_MSR_CORE_H)
#elif defined HAVE_MSR_CORE_H
using namespace MSR_RAPL_COUNTERS;
#elif defined HAVE_GEOPM_H
using namespace GEOPM_RAPL_COUNTERS;
#else
using namespace X86ADAPT_RAPL_COUNTERS;
#endif
......@@ -30,7 +37,7 @@
namespace meric {
class RAPL {
#if defined (HAVE_X86_ADAPT_H) || defined (HAVE_MSR_CORE_H)
#if defined HAVE_X86_ADAPT_H || defined HAVE_MSR_CORE_H || defined HAVE_GEOPM_H
public:
static const int RAPL_BASELINE = 0; // NOT USED at the MERIC side now
static void init(bool detailed = false);
......
......@@ -15,6 +15,7 @@ pin:
DYNINST_INC_PATHS=-I/usr/local/include \
-I${DYNINST_HOME}/build/include/ \
-I${DYNINST_HOME}/build/tbb/include/ \
-I${DYNINST_HOME}/tbb/include \
-I${DYNINST_HOME}/boost/src/boost \
......@@ -27,6 +28,7 @@ DYNINST_INC_PATHS=-I/usr/local/include \
-I${DYNINST_HOME}/dataflowAPI/h/ \
-I${DYNINST_HOME}/instructionAPI/h/
DYNINST_LIB_PATHS=-L/usr/local/lib \
-L${DYNINST_HOME}/build/lib/ \
-L${DYNINST_HOME}/build/instructionAPI/ \
-L${DYNINST_HOME}/build/dyninstAPI/ \
-L${DYNINST_HOME}/build/patchAPI/ \
......
NUMA=-I${HOME}/Software/numactl/usr/local/include/ -L${HOME}/Software/numactl/usr/local/lib/ -lnuma -DHAVE_NUMA_H
MSR=-L${HOME}/Software/libmsr/lib/ -lmsr
MERIC=-L../lib/ -lmeric
all:
icpc -std=c++11 ${NUMA} ${MSR} ${MERIC} wrapper.cpp -o wrapper
......@@ -97,8 +97,8 @@ void printHelp()
<< "\t-c = CPU core frequency [Hz]\n" //, specify value with units [GHz, MHz, kHz or default Hz]\n"
<< "\t-u = CPU uncore frequency [Hz]\n" //, specify value with units [GHz, MHz, kHz or default Hz]\n"
<< "\t-t = #OpenMP threads\n"
<< "\t-p = power capping [W]\n"
<< "\t-w = power capping time window [us]\n"
<< "\t-p = power capping [mW]\n"
<< "\t-w = power capping time window [ms]\n"
<< "\nenergyMeasureStop parameters:\n"
<< "\t-b = node baseline power [W]\n"
<< "\t-q = print the overall consumed energy only [J]\n"
......@@ -128,7 +128,7 @@ int main(int argc, char **argv)
{
try
{
defaultParameter.frequency = std::stoi(argv[++i]);
defaultParameter.frequency = std::stol(argv[++i]);
} catch (std::exception const &e)
{
printHelp();
......@@ -142,7 +142,7 @@ int main(int argc, char **argv)
if (i + 1 < argc)
{
try{
defaultParameter.uncoreFrequency = std::stoul (argv[++i]);
defaultParameter.uncoreFrequency = std::stol (argv[++i]);
} catch (std::exception const &e)
{
printHelp();
......@@ -170,7 +170,7 @@ int main(int argc, char **argv)
if (i + 1 < argc)
{
try{
defaultParameter.powerCapPKG = std::stoul (argv[++i]);
defaultParameter.powerCapPKG = std::stol (argv[++i]);
} catch (std::exception const &e)
{
printHelp();
......@@ -184,7 +184,7 @@ int main(int argc, char **argv)
if (i + 1 < argc)
{
try{
defaultParameter.powerCapPKGtime = std::stoul (argv[++i]);
defaultParameter.powerCapPKGtime = std::stol (argv[++i]);
} catch (std::exception const &e)
{
printHelp();
......@@ -238,7 +238,7 @@ int main(int argc, char **argv)
std::map<std::string, unsigned long long int> recordOld;
double timeOld = readStoredValues(recordOld);
printValues(recordOld, recordNow, mutils::timeToDouble(timeNow)-timeOld, verbose);
Environment::restoreSystemSettings();
Environment::restoreSystemSettings(true);
#endif
Environment::close();
......
This diff is collapsed.
This diff is collapsed.
from waflib import Logs
import os
def configure(ctx):
ctx.load(ctx.options.cpp)
......@@ -8,13 +9,13 @@ def configure(ctx):
ctx.env.append_unique("CXXFLAGS", ctx.options.flags.split( ))
ctx.env.append_unique("CXXFLAGS", [ "-std=c++11", "-fPIC"]) #no openMP
if (ctx.options.includes):
for path in ctx.options.includes.split(' '):
for path in ctx.options.includes.split():
if len(path) > 2 and path[0:2] == "-I":
ctx.env.append_unique("CXXFLAGS",path)
else:
ctx.env.append_unique("CXXFLAGS","-I"+path)
if (ctx.options.libpaths):
for path in ctx.options.libpaths.split(' '):
for path in ctx.options.libpaths.split():
if len(path) > 2 and path[0:2] == "-L":
ctx.env.append_unique("LINKFLAGS", path)
else:
......@@ -35,9 +36,11 @@ def configure(ctx):
else:
ctx.env.append_unique("NOOPENMP", "NOOPENMP" )
if((not ctx.check_cc(header_name="msr_core.h", lib="msr", uselib_store="msr", mandatory=False)) and (not ctx.check_cc(header_name="x86_adapt.h", lib="x86_adapt", uselib_store="x86_adapt", execute=False, mandatory=False))):
if((not ctx.check_cc(header_name="msr_core.h", lib="msr", uselib_store="msr", mandatory=False)) and (not ctx.check_cc(header_n