The need of period adjustment is now evaluated every time the temperature is requested
This commit is contained in:
@@ -717,12 +717,12 @@ unsigned int errorModel::getNumberOfFlips(double temp, sc_time time)
|
||||
// (saturation) and debug messages are generated to alert the user.
|
||||
if (temp > maxTemperature) {
|
||||
temp = maxTemperature;
|
||||
DebugManager::getInstance().printDebugMessage(name, "errormodel, temperature out of range.");
|
||||
//DebugManager::getInstance().printDebugMessage(name, "errormodel, temperature out of range.");
|
||||
}
|
||||
|
||||
if (time > maxTime) {
|
||||
time = maxTime;
|
||||
DebugManager::getInstance().printDebugMessage(name, "errormodel, time out of range.");
|
||||
//DebugManager::getInstance().printDebugMessage(name, "errormodel, time out of range.");
|
||||
}
|
||||
|
||||
// Find nearest temperature:
|
||||
|
||||
@@ -56,6 +56,7 @@ double TemperatureController::getTemperature(int deviceId, float currentPower)
|
||||
|
||||
if (dynamicTempSimEnabled == true) {
|
||||
currentPowerValues.at(deviceId) = currentPower;
|
||||
checkPowerThreshold(deviceId);
|
||||
|
||||
// FIXME using the static temperature value until the vector of
|
||||
// temperatures is filled
|
||||
@@ -82,6 +83,14 @@ void TemperatureController::updateTemperatures()
|
||||
temperaturesBuffer.clear();
|
||||
}
|
||||
|
||||
void TemperatureController::checkPowerThreshold(int deviceId)
|
||||
{
|
||||
if (std::abs(lastPowerValues.at(deviceId) - currentPowerValues.at(deviceId)) > powerThresholds.at(deviceId)) {
|
||||
decreaseSimPeriod = true;
|
||||
}
|
||||
lastPowerValues.at(deviceId) = currentPowerValues.at(deviceId);
|
||||
}
|
||||
|
||||
double TemperatureController::adjustThermalSimPeriod()
|
||||
{
|
||||
// Temperature Simulation Period Dynamic Adjustment
|
||||
@@ -110,19 +119,10 @@ double TemperatureController::adjustThermalSimPeriod()
|
||||
// again in steps of 'n/2' until it achieves the desired value given by
|
||||
// configuration or the described in 1.1 occurs.
|
||||
|
||||
bool decreaseSimPeriod = false;
|
||||
|
||||
for (unsigned i = 0; i < currentPowerValues.size(); i++) {
|
||||
if (std::abs(lastPowerValues.at(i) - currentPowerValues.at(i)) > powerThresholds.at(i)) {
|
||||
cyclesSinceLastPeriodAdjust = 0;
|
||||
decreaseSimPeriod = true;
|
||||
}
|
||||
}
|
||||
|
||||
lastPowerValues = currentPowerValues;
|
||||
|
||||
if (decreaseSimPeriod == true) {
|
||||
period = period / periodAdjustFactor;
|
||||
cyclesSinceLastPeriodAdjust = 0;
|
||||
decreaseSimPeriod = false;
|
||||
printDebugMessage("Thermal Simulation period reduced to " + std::to_string(period) + ". Target is " + std::to_string(targetPeriod));
|
||||
} else {
|
||||
if (period != targetPeriod) {
|
||||
|
||||
@@ -79,6 +79,7 @@ public:
|
||||
|
||||
// Substantial changes in power will trigger adjustments in the simulaiton period. Get the thresholds from config.
|
||||
powerThresholds = Configuration::getInstance().temperatureSim.powerThresholds;
|
||||
decreaseSimPeriod = false;
|
||||
periodAdjustFactor = Configuration::getInstance().temperatureSim.SimPeriodAdjustFactor;
|
||||
nPowStableCyclesToIncreasePeriod = Configuration::getInstance().temperatureSim.NPowStableCyclesToIncreasePeriod;
|
||||
cyclesSinceLastPeriodAdjust = 0;
|
||||
@@ -120,6 +121,8 @@ private:
|
||||
void temperatureThread();
|
||||
void updateTemperatures();
|
||||
double adjustThermalSimPeriod();
|
||||
void checkPowerThreshold(int deviceId);
|
||||
bool decreaseSimPeriod;
|
||||
unsigned int periodAdjustFactor;
|
||||
unsigned int cyclesSinceLastPeriodAdjust;
|
||||
unsigned int nPowStableCyclesToIncreasePeriod;
|
||||
|
||||
Reference in New Issue
Block a user