Commit 5553fb69 authored by Ondrej Vysocky's avatar Ondrej Vysocky
Browse files

NEW self-describing data and output filename #52

parent 1be37305
......@@ -191,7 +191,7 @@ public:
{
if (!_MPInodeRank)
{
initCounter = _storeList[i]->initStore(initCounter, Meric::OUTPUT_DIR, Meric::OUTPUT_FILENAME, _nodeName);
initCounter = _storeList[i]->initStore(initCounter, Meric::OUTPUT_DIR, Meric::OUTPUT_FILENAME, Meric::outputFilenameInfo, _nodeName);
}
if (_storeList[i]->getMPIWrite())
{
......
......@@ -12,7 +12,6 @@ bool Meric::SAMPLES = mutils::getenv("MERIC_SAMPLES" , false);
std::string Meric::COUNTERS = mutils::getenv("MERIC_COUNTERS" , std::string("none"));
std::string Meric::BARRIERS = mutils::getenv("MERIC_BARRIERS" , std::string("all"));
std::string Meric::OUTPUT_DIR = mutils::getenv("MERIC_OUTPUT_DIR", std::string("mericMeasurement"));
std::string Meric::OUTPUT_FILENAME = mutils::getenv("MERIC_OUTPUT_FILENAME", std::string("log"));
std::string Meric::REGION_OPTIONS = mutils::getenv("MERIC_REGION_OPTIONS", std::string(""));
std::map<std::string, std::map<std::pair<int, int>, struct RegionParameters > > Meric::parameter;
......@@ -28,7 +27,8 @@ timespec Meric::_stopTime;
bool Meric::IGNORE = false;
bool Meric::MPIbarriers = true;
bool Meric::OMPbarriers = true;
std::string Meric::outputFilenameInfo = "";
std::string Meric::OUTPUT_FILENAME = "";
void Meric::readRegionParameters()
......@@ -54,6 +54,11 @@ int Meric::getDefaultParameters()
std::cerr << "MERIC ERROR: set MERIC_FREQUENCY\n";
ret = 1;
}
else if (defaultParameter.frequency != 0)
{
Meric::outputFilenameInfo +="CF_";
Meric::OUTPUT_FILENAME += std::to_string(defaultParameter.frequency)+"_";
}
#endif
#ifdef HAVE_X86_ADAPT_H
......@@ -62,6 +67,11 @@ int Meric::getDefaultParameters()
std::cerr << "MERIC ERROR: set MERIC_UNCORE_FREQUENCY\n";
ret = 1;
}
else if (defaultParameter.uncoreFrequency != 0)
{
Meric::outputFilenameInfo +="UnCF_";
Meric::OUTPUT_FILENAME += std::to_string(defaultParameter.uncoreFrequency)+"_";
}
#endif
#ifdef HAVE_OMP_H
......@@ -71,6 +81,11 @@ int Meric::getDefaultParameters()
<< "MERIC INFO: if the application doesn't use openMP, export MERIC_NUM_THREADS=0\n";
ret = 1;
}
else if (defaultParameter.nthreads != 0)
{
Meric::outputFilenameInfo +="thrds_";
Meric::OUTPUT_FILENAME += std::to_string(defaultParameter.nthreads)+"_";
}
#endif
if (ret)
......@@ -81,6 +96,33 @@ int Meric::getDefaultParameters()
MERIC_INFO << "Default frequency: " << defaultParameter.frequency << "\n";
MERIC_INFO << "Default uncore frequency: " << defaultParameter.uncoreFrequency << "\n";
std::string outputFilenameSuffix = mutils::getenv("MERIC_OUTPUT_FILENAME", "");
if (outputFilenameSuffix.size() == 0)
{
if (Meric::OUTPUT_FILENAME.size() == 0)
{
Meric::OUTPUT_FILENAME = "log";
Meric::outputFilenameInfo = "CFG";
}
else
{
Meric::OUTPUT_FILENAME.pop_back();
Meric::outputFilenameInfo.pop_back();
}
}
else
{
for (size_t i = 0; i < std::count(outputFilenameSuffix.begin(), outputFilenameSuffix.end(), '_'); i++)
{
Meric::outputFilenameInfo +="APP"+std::to_string(i)+"_";
}
if (Meric::outputFilenameInfo.size() > 0) //remove the last underscore
{
Meric::outputFilenameInfo.pop_back();
}
Meric::OUTPUT_FILENAME += outputFilenameSuffix;
}
if (Meric::MODE < MODE_HDEEM || Meric::MODE >= MODE_LIMIT)
{
std::cerr << "MERIC WARNING: MERIC MODE unknown value - default "<< MODE_HDEEM <<std::endl;
......
......@@ -350,6 +350,7 @@ protected:
static timespec _startTime, _stopTime;
static bool MPIbarriers;
static bool OMPbarriers;
static std::string outputFilenameInfo;
};
}
......
......@@ -158,7 +158,7 @@ public:
int initCounter = -1;
for(int i=0; i<_storeList.size(); i++)
{
initCounter = _storeList[i]->initStore(initCounter, Meric::OUTPUT_DIR, Meric::OUTPUT_FILENAME);
initCounter = _storeList[i]->initStore(initCounter, Meric::OUTPUT_DIR, Meric::OUTPUT_FILENAME, Meric::outputFilenameInfo);
try
{
_storeList[i]->save(Meric::OUTPUT_DIR, Meric::OUTPUT_FILENAME, _name);
......
......@@ -69,6 +69,7 @@ public:
int initStore( int counter,
const std::string outputDir,
const std::string outputFilename,
const std::string outputFilenameInfo, //node_CF_UnCF_config
const std::string prefix = "")
{
loadSchedulerEnvironment();
......@@ -79,6 +80,28 @@ public:
return counter;
}
mutils::createDir(outputDir);
std::string dataInfoFileName = outputDir + "/measurementInfo.json";
struct stat info;
if(stat(dataInfoFileName.c_str(), &info ) != 0)
{
std::ofstream oFile(dataInfoFileName);
char hostname[50];
gethostname(hostname, 50);
time_t now_t = time(0);
std::string now_s = std::string(ctime(&now_t));
now_s.pop_back();
oFile << "{\n"
<< "\t\"Timestamp\" : \"" << now_s << "\",\n"
<< "\t\"System\" : \"" << std::string(hostname) << "\",\n"
<< "\t\"DataFormat\": \"" << (prefix.size() ? "node_" : "") << outputFilenameInfo << "\",\n"
<< "\t\"Note\" : \"\"\n"
<< "}";
oFile.close();
}
//CALLTREE init counter
mutils::createDir(outputDir + "Counters");
return storeCounter(outputDir + "Counters/" + "startCounter_" + (prefix.size() ? prefix + "_" : "" ) + outputFilename + ".tmp");
......
Supports Markdown
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