Commit d0940c58 authored by Ondrej Vysocky's avatar Ondrej Vysocky
Browse files

ENH when using dynamic tuning the data will be stored for each region...

ENH when using dynamic tuning the data will be stored for each region according its real configuration #61
parent 694d77c3
......@@ -58,7 +58,6 @@ int Meric::getDefaultParameters()
else if (defaultParameter.frequency != 0)
{
Meric::outputFilenameInfo +="CF_";
Meric::OUTPUT_FILENAME += std::to_string((int)defaultParameter.frequency)+"_";
}
#endif
......@@ -71,7 +70,6 @@ int Meric::getDefaultParameters()
else if (defaultParameter.uncoreFrequency != 0)
{
Meric::outputFilenameInfo +="UnCF_";
Meric::OUTPUT_FILENAME += std::to_string(defaultParameter.uncoreFrequency)+"_";
}
#endif
......@@ -85,7 +83,6 @@ int Meric::getDefaultParameters()
else if (defaultParameter.nthreads != 0)
{
Meric::outputFilenameInfo +="thrds_";
Meric::OUTPUT_FILENAME += std::to_string(defaultParameter.nthreads)+"_";
}
#endif
......@@ -104,14 +101,13 @@ int Meric::getDefaultParameters()
std::string outputFilenameSuffix = mutils::getenv("MERIC_OUTPUT_FILENAME", "");
if (outputFilenameSuffix.size() == 0)
{
if (Meric::OUTPUT_FILENAME.size() == 0)
if (Meric::outputFilenameInfo.size() == 0)
{
Meric::OUTPUT_FILENAME = "log";
Meric::outputFilenameInfo = "CFG";
}
else
{
Meric::OUTPUT_FILENAME.pop_back();
Meric::outputFilenameInfo.pop_back();
}
}
......@@ -158,7 +154,8 @@ int Meric::getDefaultParameters()
{
if (Meric::COUNTERS != "papi" && Meric::COUNTERS != "perfevent")
{
std::cerr << "MERIC WARNING: unknown counter type "<<Meric::COUNTERS<<std::endl;
if (Meric::COUNTERS != "")
std::cerr << "MERIC WARNING: unknown counter type "<<Meric::COUNTERS<<std::endl;
Meric::COUNTERS = "none";
}
}
......@@ -305,13 +302,22 @@ RegionParameters Meric::getRegionSettings(json_object_element_s * data)
do
{
if ("FREQUENCY" == std::string(set->name->string))
{
if (defaultParameter.frequency != 0)
param.frequency = std::stoi(std::string(((struct json_string_s*)set->value->payload)->string));
}
else if ("UNCORE_FREQUENCY" == std::string(set->name->string))
{
if (defaultParameter.uncoreFrequency != 0)
param.uncoreFrequency = std::stoi(std::string(((struct json_string_s*)set->value->payload)->string));
}
else if ("NUM_THREADS" == std::string(set->name->string))
{
if (defaultParameter.nthreads != 0)
param.nthreads = std::stoi(std::string(((struct json_string_s*)set->value->payload)->string));
}
else
std::cerr << "MERIC ERROR: invalid region options key - " << set->name->string << std::endl;
std::cerr << "MERIC ERROR: invalid region options key - " << set->name->string << std::endl;
set = set->next;
}while (set != NULL);
......
......@@ -50,7 +50,7 @@ public:
for (int i=0; i<_storeList.size(); i++)
{
if (_storeList[i]->getMPIWrite())
_storeList[i]->addStart(getRegionID(region));
_storeList[i]->addStart(getRegionID(region), currentState.socket[0]); //data storing into file with name according socket#0
}
MERIC_INFO << "region '" << region << "' started\n";
}
......
......@@ -33,9 +33,10 @@ public:
MPI_Comm_size(_comm, &_size);
}
void addStart(int region) { _store->addStart(region); }
void addStart(int region, RegionParameters configuration) { _store->addStart(region, configuration); }
void addEnd(int region) { _store->addEnd(region); };
double getRegionDuration() { return _store->getRegionDuration(); };
RegionParameters* getConfiguration(size_t id) { return _store->getConfiguration(id); }
void save(const std::string outputDir, const std::string outputFilename, std::vector<std::string> regionNames, const std::string prefix = "")
{
......
......@@ -13,7 +13,7 @@
using namespace meric;
template <class TCounter, typename TType> void CountersStore<TCounter, TType>::addStart(int region)
template <class TCounter, typename TType> void CountersStore<TCounter, TType>::addStart(int region, RegionParameters configuration)
{
std::map<std::string, TType> record;
struct timespec time;
......@@ -21,7 +21,7 @@ template <class TCounter, typename TType> void CountersStore<TCounter, TType>::a
TCounter::getCounterValues(record);
clock_gettime(CLOCK_REALTIME, &time);
_records.push_back(CountersRecord<TType>(region, record, time));
_records.push_back(CountersRecord<TType>(region, record, time, configuration));
}
template <class TCounter, typename TType> void CountersStore<TCounter, TType>::addEnd(int region)
......@@ -32,7 +32,7 @@ template <class TCounter, typename TType> void CountersStore<TCounter, TType>::a
clock_gettime(CLOCK_REALTIME, &time);
TCounter::getCounterValues(record);
_records.push_back(CountersRecord<TType>(region, record, time));
_records.push_back(CountersRecord<TType>(region, record, time, _records.back().configuration));
}
template <class TCounter, typename TType> void CountersStore<TCounter, TType>::fillRegionStats(std::vector<TType> &stats, double *time, size_t iStarts, size_t iEnd)
......
......@@ -10,13 +10,14 @@ namespace meric {
template <typename TType>
struct CountersRecord {
CountersRecord(int region, std::map <std::string, TType> record, timespec time)
: region(region), record(record), time(time){};
CountersRecord(int region, std::map <std::string, TType> record, timespec time, RegionParameters configuration)
: region(region), record(record), time(time), configuration(configuration) {};
CountersRecord() : region(-1){};
int region;
std::map <std::string, TType> record;
timespec time;
RegionParameters configuration;
};
template <class TStore>
......@@ -28,7 +29,7 @@ template <class TCounter, typename TType> class CountersStore: public Store {
public:
typedef TType dataType;
typedef TCounter counterType;
void addStart(int region);
void addStart(int region, RegionParameters configuration);
void addEnd(int region);
double getRegionDuration() {return 0.0;};
void fillRegionStats(std::vector<TType> &stats, double *time, size_t iStarts, size_t iEnd);
......
......@@ -3,7 +3,7 @@
using namespace meric;
void DetailedEnergyStore::addStart(int region)
void DetailedEnergyStore::addStart(int region, RegionParameters configuration)
{
std::array<double, HDEEM::PROBE_NUMBER> energy;
struct timespec time;
......@@ -11,7 +11,7 @@ void DetailedEnergyStore::addStart(int region)
HDEEM::getDetailedCounterValues(energy);
clock_gettime(CLOCK_REALTIME, &time);
_records.push_back(DetailedEnergyRecord(region, energy, time));
_records.push_back(DetailedEnergyRecord(region, energy, time, configuration));
}
void DetailedEnergyStore::addEnd(int region)
......@@ -22,7 +22,7 @@ void DetailedEnergyStore::addEnd(int region)
clock_gettime(CLOCK_REALTIME, &time);
HDEEM::getDetailedCounterValues(energy);
_records.push_back(DetailedEnergyRecord(region, energy, time));
_records.push_back(DetailedEnergyRecord(region, energy, time, _records.back().configuration));
}
void DetailedEnergyStore::saveInterval(std::ofstream &ss, std::vector<size_t> &iStarts, size_t iEnd)
......
......@@ -7,12 +7,13 @@
namespace meric {
struct DetailedEnergyRecord {
DetailedEnergyRecord(int region, std::array<double, HDEEM::PROBE_NUMBER> &energy, timespec &time)
: time(time), energy(energy), region(region) {};
DetailedEnergyRecord(int region, std::array<double, HDEEM::PROBE_NUMBER> &energy, timespec &time, RegionParameters configuration)
: time(time), energy(energy), region(region), configuration(configuration) {};
std::array<double, HDEEM::PROBE_NUMBER> energy;
timespec time;
int region;
RegionParameters configuration;
};
template <class TStore>
......@@ -26,7 +27,7 @@ class DetailedEnergyStore: public Store {
friend class AggregateStore<DetailedEnergyStore>;
friend class DetailedAggregateStore<DetailedEnergyStore>;
public:
void addStart(int region);
void addStart(int region, RegionParameters configuration);
void addEnd(int region);
double getRegionDuration() {return 0.0;};
......@@ -69,6 +70,16 @@ public:
MERIC_INFO << "Create DetailedEnergyStore\n";
}
RegionParameters* getConfiguration(size_t id)
{
if (_records.size()-1 >= id)
return &(_records[id].configuration);
else
{
return NULL;
}
}
protected:
void saveInterval(std::ofstream &ss, std::vector<size_t> &iStarts, size_t iEnd);
......
......@@ -5,7 +5,7 @@
using namespace meric;
void EnergyStore::addStart(int region)
void EnergyStore::addStart(int region, RegionParameters configuration)
{
double energy;
struct timespec time;
......@@ -13,7 +13,7 @@ void EnergyStore::addStart(int region)
HDEEM::getCounterValues(energy);
clock_gettime(CLOCK_REALTIME, &time);
_records.push_back(EnergyRecord(region, time, energy));
_records.push_back(EnergyRecord(region, time, energy, configuration));
}
void EnergyStore::addEnd(int region)
......@@ -24,7 +24,7 @@ void EnergyStore::addEnd(int region)
clock_gettime(CLOCK_REALTIME, &time);
HDEEM::getCounterValues(energy);
_records.push_back(EnergyRecord(region, time, energy));
_records.push_back(EnergyRecord(region, time, energy, _records.back().configuration));
}
void EnergyStore::fillRegionStats(RegionStats &stats, size_t iStarts, size_t iEnd)
......
......@@ -7,12 +7,13 @@
namespace meric {
struct EnergyRecord {
EnergyRecord(int region, timespec &time, double energy)
: time(time), energy(energy), region(region) {};
EnergyRecord(int region, timespec &time, double energy, RegionParameters configuration)
: time(time), energy(energy), region(region), configuration(configuration) {};
double energy;
timespec time;
int region;
RegionParameters configuration;
};
template <class TStore>
......@@ -26,7 +27,7 @@ class EnergyStore: public Store {
friend class AggregateStore<EnergyStore>;
friend class DetailedAggregateStore<EnergyStore>;
public:
void addStart(int region);
void addStart(int region, RegionParameters configuration);
void addEnd(int region);
double getRegionDuration() {return 0.0;};
void fillRegionStats(RegionStats &stats, size_t iStarts, size_t iEnd);
......@@ -67,6 +68,7 @@ public:
MERIC_INFO << "Create EnergyStore\n";
}
*/
protected:
void saveInterval(std::ofstream &ss, std::vector<size_t> &iStarts, size_t iEnd);
......
......@@ -4,12 +4,12 @@
using namespace meric;
void InfoStore::addStart(int region)
void InfoStore::addStart(int region, RegionParameters configuration)
{
struct timespec time;
clock_gettime(CLOCK_REALTIME, &time);
_records.push_back(InfoRecord(region, time));
_records.push_back(InfoRecord(region, time, configuration));
_timeStack.push_back(time);
}
......@@ -18,7 +18,7 @@ void InfoStore::addEnd(int region)
struct timespec time;
clock_gettime(CLOCK_REALTIME, &time);
_records.push_back(InfoRecord(region, time));
_records.push_back(InfoRecord(region, time, _records.back().configuration)); //this configuration is not relevant - must be used configuration of the region start
}
double InfoStore::getRegionDuration()
......
......@@ -7,11 +7,12 @@
namespace meric {
struct InfoRecord {
InfoRecord(int region, timespec &time)
: time(time), region(region) {};
InfoRecord(int region, timespec &time, RegionParameters configuration)
: time(time), region(region), configuration(configuration) {};
timespec time;
int region;
RegionParameters configuration;
};
......@@ -29,7 +30,7 @@ class InfoStore: public Store {
friend class InfoAggregateStore<InfoStore>;
public:
void addStart(int region);
void addStart(int region, RegionParameters configuration);
void addEnd(int region);
double getRegionDuration();
void fillRegionStats(RegionStats &stats, size_t iStarts, size_t iEnd);
......
......@@ -16,6 +16,7 @@
#include <iomanip>
#include <exception>
#include "../wrapper/environmentwrapper.h"
#include "../wrapper/hdeemwrapper.h"
#include "../wrapper/jetsonwrapper.h"
#include "../wrapper/thunderwrapper.h"
......@@ -44,7 +45,7 @@ struct DebugRegionStats {
class StoreBase
{
public:
virtual void addStart(int region) = 0;
virtual void addStart(int region, RegionParameters configuration) = 0;
virtual void addEnd(int region) = 0;
virtual double getRegionDuration() = 0;
virtual void loadSchedulerEnvironment() = 0;
......@@ -133,12 +134,10 @@ protected:
_levels.resize(_name.size());
timespec time1, time2;
clock_gettime(CLOCK_REALTIME, &time1);
std::vector<std::ofstream> ss(_name.size());
for (int i=0; i<_name.size(); i++)
{
std::string folderName = _name[i].c_str();
mutils::createDir(outputDir + "/" + folderName);
ss[i].open(outputDir + "/" + folderName + "/" + (prefix.size() ? prefix + "_" : "" ) + outputFilename + ".csv", std::ios::app);
}
clock_gettime(CLOCK_REALTIME, &time2);
MERIC_INFO << "MERIC open csv files in: " << mutils::timeToDouble(time2 - time1) <<" s\n";
......@@ -155,14 +154,23 @@ protected:
}
else
{
processInterval(ss[records[i].region], starts, i);
_counters[records[i].region]++;
std::string filenamePrefix = (prefix.size() ? prefix + "_" : "" )
+ ((int)records[starts.back()].configuration.frequency == 0 ? "" : std::to_string((int)records[starts.back()].configuration.frequency) +"_" )
+ (records[starts.back()].configuration.uncoreFrequency == 0 ? "" : std::to_string(records[starts.back()].configuration.uncoreFrequency) +"_" )
+ (records[starts.back()].configuration.nthreads == 0 ? "" : std::to_string(records[starts.back()].configuration.nthreads) +"_" )
+ outputFilename;
if (filenamePrefix.back() == '_')
filenamePrefix.pop_back();
std::ofstream ss(outputDir + "/" + _name[records[i].region] + "/" + filenamePrefix + ".csv", std::ios::app);
processInterval(ss, starts, i);
_counters[records[i].region]++;
for(size_t j=0; j<_levels.size(); j++)
{
if (_levels[j] > _levels[records[i].region])
_counters[j] = 0;
}
starts.pop_back();
ss.close();
}
}
}
......
......@@ -4,7 +4,7 @@
using namespace meric;
void TimeEnergyStore::addStart(int region)
void TimeEnergyStore::addStart(int region, RegionParameters configuration)
{
struct timespec time;
std::array<double, HDEEM::PROBE_NUMBER> energy;
......@@ -12,7 +12,7 @@ void TimeEnergyStore::addStart(int region)
HDEEM::getDetailedCounterValues(energy);
clock_gettime(CLOCK_REALTIME, &time);
_records.push_back(TimeEnergyRecord(region, time, energy));
_records.push_back(TimeEnergyRecord(region, time, energy, configuration));
}
void TimeEnergyStore::addEnd(int region)
......@@ -23,7 +23,7 @@ void TimeEnergyStore::addEnd(int region)
clock_gettime(CLOCK_REALTIME, &time);
HDEEM::getDetailedCounterValues(energy);
_records.push_back(TimeEnergyRecord(region, time, energy));
_records.push_back(TimeEnergyRecord(region, time, energy, _records.back().configuration));
}
......
......@@ -8,12 +8,13 @@
namespace meric {
struct TimeEnergyRecord {
TimeEnergyRecord(int region, timespec &clockTime, std::array<double, HDEEM::PROBE_NUMBER> &energy)
: region(region), clockTime(clockTime), energy(energy) {};
TimeEnergyRecord(int region, timespec &clockTime, std::array<double, HDEEM::PROBE_NUMBER> &energy, RegionParameters configuration)
: region(region), clockTime(clockTime), energy(energy), configuration(configuration) {};
timespec clockTime;
std::array<double, HDEEM::PROBE_NUMBER> energy;
int region;
RegionParameters configuration;
};
template <class TStore>
......@@ -23,7 +24,7 @@ class TimeEnergyStore: public TimeStore <HDEEM> {
friend class DebugAggregateStore<TimeEnergyStore>;
public:
void addStart(int region);
void addStart(int region, RegionParameters configuration);
void addEnd(int region);
double getRegionDuration() {return 0.0;};
void fillRegionStats(DebugRegionStats &stats, size_t iStarts, size_t iEnd);
......@@ -78,6 +79,7 @@ public:
MERIC_INFO << "Create TimeEnergyStore\n";
}
*/
protected:
void saveInterval(std::ofstream &ss, std::vector<size_t> &iStarts, size_t iEnd);
......
......@@ -4,18 +4,18 @@
using namespace meric;
template <class TSystem> void TimeStore<TSystem>::addStart(int region)
template <class TSystem> void TimeStore<TSystem>::addStart(int region, RegionParameters configuration)
{
timespec time;
clock_gettime(CLOCK_REALTIME, &time);
_records.push_back(TimeRecord(region, time));
_records.push_back(TimeRecord(region, time, configuration));
}
template <class TSystem> void TimeStore<TSystem>::addEnd(int region)
{
timespec time;
clock_gettime(CLOCK_REALTIME, &time);
_records.push_back(TimeRecord(region, time));
_records.push_back(TimeRecord(region, time, _records.back().configuration));
}
template <class TSystem> void TimeStore<TSystem>::computePeriods()
......
......@@ -8,11 +8,12 @@
namespace meric {
struct TimeRecord {
TimeRecord(int region, timespec &time)
: time(time), region(region) {};
TimeRecord(int region, timespec &time, RegionParameters configuration)
: time(time), region(region), configuration(configuration) {};
timespec time;
int region;
RegionParameters configuration;
};
template <class TStore>
......@@ -28,7 +29,7 @@ template <class TSystem> class TimeStore: public Store {
friend class AggregateStore<TimeStore>;
friend class DetailedAggregateStore<TimeStore>;
public:
virtual void addStart(int region);
virtual void addStart(int region, RegionParameters configuration);
virtual void addEnd(int region);
double getRegionDuration() {return 0.0;};
......@@ -111,6 +112,7 @@ public:
clock_gettime(CLOCK_REALTIME, &_start);
}
*/
protected:
void saveInterval(std::ofstream &ss, std::vector<size_t> &iStarts, size_t iEnd);
void computePeriods();
......
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