Commit 93b2e8f5 authored by Ondrej Vysocky's avatar Ondrej Vysocky
Browse files

FIX wring freq division, wrong string reading from the env #59 #62

parent f2d688e7
...@@ -47,10 +47,10 @@ int Meric::getDefaultParameters() ...@@ -47,10 +47,10 @@ int Meric::getDefaultParameters()
int ret=0; int ret=0;
//OBLIGATORY SECTION //OBLIGATORY SECTION
defaultParameter.nthreads = mutils::getenv("MERIC_NUM_THREADS", -1); defaultParameter.nthreads = mutils::getenv("MERIC_NUM_THREADS", -1);
defaultParameter.frequency = mutils::frequencyToHz(mutils::getenv("MERIC_FREQUENCY", "")); defaultParameter.frequency = mutils::frequencyToHz(mutils::getenv("MERIC_FREQUENCY", std::string("")));
defaultParameter.uncoreFrequency = mutils::frequencyToHz(mutils::getenv("MERIC_UNCORE_FREQUENCY", "")); defaultParameter.uncoreFrequency = mutils::frequencyToHz(mutils::getenv("MERIC_UNCORE_FREQUENCY", std::string("")));
#if defined (HAVE_CPUFREQ_H) || HAVE_X86_ADAPT_H #if defined (HAVE_CPUFREQ_H) || defined (HAVE_X86_ADAPT_H) || defined (HAVE_MSR_DORE_H)
if (defaultParameter.frequency < 0) if (defaultParameter.frequency < 0)
{ {
std::cerr << "MERIC ERROR: set MERIC_FREQUENCY [Hz]\n"; std::cerr << "MERIC ERROR: set MERIC_FREQUENCY [Hz]\n";
...@@ -63,7 +63,7 @@ int Meric::getDefaultParameters() ...@@ -63,7 +63,7 @@ int Meric::getDefaultParameters()
#endif #endif
#ifdef HAVE_X86_ADAPT_H #if defined (HAVE_X86_ADAPT_H) || defined (HAVE_MSR_CORE_H)
if (defaultParameter.uncoreFrequency < 0) if (defaultParameter.uncoreFrequency < 0)
{ {
std::cerr << "MERIC ERROR: set MERIC_UNCORE_FREQUENCY [Hz]\n"; std::cerr << "MERIC ERROR: set MERIC_UNCORE_FREQUENCY [Hz]\n";
......
...@@ -345,7 +345,7 @@ void Environment::init(int system, RegionParameters defaultParameter, int rank) ...@@ -345,7 +345,7 @@ void Environment::init(int system, RegionParameters defaultParameter, int rank)
MERIC_INFO << "Disable scaling frequency of Intel P-state driver and set maximum P-state to all cores and set energy performance bias to maximum performance\n"; MERIC_INFO << "Disable scaling frequency of Intel P-state driver and set maximum P-state to all cores and set energy performance bias to maximum performance\n";
read_msr_by_idx(0, IA32_ENERGY_PERF_BIAS, &IA32_ENERGY_PERF_BIAS_default); read_msr_by_idx(0, IA32_ENERGY_PERF_BIAS, &IA32_ENERGY_PERF_BIAS_default);
uint64_t REG_MAX_PSTATE = (FreqLimits[systemType].maxCoreFreq/100000)*MSR_FREQ_MULT; uint64_t REG_MAX_PSTATE = (FreqLimits[systemType].maxCoreFreq/100000000) << 8;
for (int cpu=0; cpu<NODE_SIZE_CPU; cpu++) for (int cpu=0; cpu<NODE_SIZE_CPU; cpu++)
{ {
defaultSettings.open ("/sys/devices/system/cpu/cpu"+std::to_string(cpu)+"/cpufreq/scaling_max_freq"); defaultSettings.open ("/sys/devices/system/cpu/cpu"+std::to_string(cpu)+"/cpufreq/scaling_max_freq");
...@@ -442,7 +442,7 @@ void Environment::frequency(uint64_t freq, int socket) ...@@ -442,7 +442,7 @@ void Environment::frequency(uint64_t freq, int socket)
for (; cpu<nodeSize; cpu++) for (; cpu<nodeSize; cpu++)
{ {
write_msr_by_idx(cpu, IA32_PERF_CTL, (freq/100000) << 8); write_msr_by_idx(cpu, IA32_PERF_CTL, (freq/100000000) << 8);
} }
#else #else
#ifdef HAVE_CPUFREQ_H #ifdef HAVE_CPUFREQ_H
...@@ -489,7 +489,7 @@ void Environment::frequency(uint64_t freq, int socket) ...@@ -489,7 +489,7 @@ void Environment::frequency(uint64_t freq, int socket)
// exit(2); // exit(2);
} }
if(x86_adapt_set_setting(fd, adaptHandler, (freq/100000)*MSR_FREQ_MULT) != 8) if(x86_adapt_set_setting(fd, adaptHandler, (freq/100000000)*MSR_FREQ_MULT) != 8)
{ {
std::cerr << "X86ADAPT ERROR: error while setting core frequecy\n"; std::cerr << "X86ADAPT ERROR: error while setting core frequecy\n";
// exit(3); // exit(3);
......
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