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

ENH small cleaning #59 #62

parent 6d748551
......@@ -168,7 +168,7 @@ void Environment::init(int system, RegionParameters defaultParameter, int rank)
#ifdef HAVE_MSR_CORE_H
if (init_msr())
{
libmsr_error_handler("Unable to initialize libmsr", LIBMSR_ERROR_MSR_INIT, getenv("HOSTNAME"), __FILE__, __LINE__);
std::cerr << "LIBMSR ERROR: Unable to initialize\n";
// exit(1);
}
#endif
......@@ -229,7 +229,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";
read_msr_by_idx(0, IA32_ENERGY_PERF_BIAS, &IA32_ENERGY_PERF_BIAS_default);
uint64_t REG_MAX_PSTATE = (FreqLimits[systemType].maxCoreFreq/100000)*256;
uint64_t REG_MAX_PSTATE = (FreqLimits[systemType].maxCoreFreq/100000)*MSR_FREQ_MULT;
for (int cpu=0; cpu<NODE_SIZE_CPU; cpu++)
{
defaultSettings.open ("/sys/devices/system/cpu/cpu"+std::to_string(cpu)+"/cpufreq/scaling_max_freq");
......@@ -326,7 +326,7 @@ void Environment::frequency(uint64_t freq, int socket)
for (; cpu<nodeSize; cpu++)
{
write_msr_by_idx(cpu, IA32_PERF_CTL, (freq/CPUFREQ_FREQ_MULT) << 8);
write_msr_by_idx(cpu, IA32_PERF_CTL, (freq/100000) << 8);
}
#else
#ifdef HAVE_CPUFREQ_H
......@@ -342,7 +342,7 @@ void Environment::frequency(uint64_t freq, int socket)
{
ret = cpufreq_set_frequency(cpu,freq);
if(ret != 0) // || freq*CPUFREQ_FREQ_MULT != cpufreq_get_freq_kernel(cpu)) //TODO test turbo freq setting
if(ret != 0) // || freq*100000 != cpufreq_get_freq_kernel(cpu)) //TODO test turbo freq setting
{
std::cerr << "CPUFREQ ERROR: failed to set frequency for cpu "<< cpu << std::endl;
}
......@@ -373,7 +373,7 @@ void Environment::frequency(uint64_t freq, int socket)
// exit(2);
}
if(x86_adapt_set_setting(fd, adaptHandler, (freq/CPUFREQ_FREQ_MULT) *X86ADAPT_FREQ_MULT) != 8)
if(x86_adapt_set_setting(fd, adaptHandler, (freq/100000)*MSR_FREQ_MULT) != 8)
{
std::cerr << "X86ADAPT ERROR: error while setting core frequecy\n";
// exit(3);
......
......@@ -36,7 +36,6 @@
#include <iostream>
#include <fstream>
namespace meric {
enum mode {MODE_HDEEM, MODE_RAPL, MODE_BOTH, MODE_RUN, MODE_JETSON, MODE_THUNDER, MODE_DAVIDE, MODE_TIME, MODE_LIMIT}; //keep MODE_LIMIT always as the last MODE in the list
......@@ -59,10 +58,7 @@ struct systemLimits{ //Hz
uint64_t minUncoreFreq;
};
const int CPUFREQ_FREQ_MULT = 100000;
const int X86ADAPT_FREQ_MULT = 256;
const int CPUFREQ_MAX_FREQ = 25;
const int X86ADAPT_MAX_FREQ = 33;
const int MSR_FREQ_MULT = 256;
class Environment {
......
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