Improvements

This commit is contained in:
Éder F. Zulian
2015-10-03 19:56:20 +02:00
parent 63eae4d1ee
commit 995a18e648
9 changed files with 86 additions and 87 deletions

View File

@@ -0,0 +1,32 @@
<powerInfo>
<CPUs id="0" init_pow="0" threshold="1.0" />
<GPU id="1" init_pow="0" threshold="1.0" />
<BASEBAND1 id="2" init_pow="1" threshold="1.0" />
<BASEBAND2 id="3" init_pow="0" threshold="1.0" />
<LLCACHE id="4" init_pow="0" threshold="1.0" />
<DRAMCTRL1 id="5" init_pow="0" threshold="1.0" />
<DRAMCTRL2 id="6" init_pow="0" threshold="1.0" />
<TSVs id="7" init_pow="0" threshold="1.0" />
<ACELLERATORS id="8" init_pow="0" threshold="1.0" />
<C0 id="9" init_pow="1" threshold="1.0" />
<C1 id="10" init_pow="0" threshold="1.0" />
<C2 id="11" init_pow="0" threshold="1.0" />
<C3 id="12" init_pow="0" threshold="1.0" />
<TSVs id="13" init_pow="0" threshold="1.0" />
<C0 id="14" init_pow="0" threshold="1.0" />
<C1 id="15" init_pow="0" threshold="1.0" />
<C2 id="16" init_pow="0" threshold="1.0" />
<C3 id="17" init_pow="0" threshold="1.0" />
<TSVs id="18" init_pow="0" threshold="1.0" />
<C0 id="19" init_pow="0" threshold="1.0" />
<C1 id="20" init_pow="0" threshold="1.0" />
<C2 id="21" init_pow="0" threshold="1.0" />
<C3 id="22" init_pow="0" threshold="1.0" />
<TSVs id="23" init_pow="0" threshold="1.0" />
<C0 id="24" init_pow="0" threshold="1.0" />
<C1 id="25" init_pow="0" threshold="1.0" />
<C2 id="26" init_pow="0" threshold="1.0" />
<C3 id="27" init_pow="0" threshold="1.0" />
<TSVs id="28" init_pow="0" threshold="1.0" />
</powerInfo>

View File

@@ -1,33 +0,0 @@
<power_thresholds>
<!-- TODO Maybe change this file format -->
<CPUs id="0" value="1.0" />
<GPU id="1" value="1.0" />
<BASEBAND1 id="2" value="1.0" />
<BASEBAND2 id="3" value="1.0" />
<LLCACHE id="4" value="1.0" />
<DRAMCTRL1 id="5" value="1.0" />
<DRAMCTRL2 id="6" value="1.0" />
<TSVs id="7" value="1.0" />
<ACELLERATORS id="8" value="1.0" />
<C0 id="9" value="1.0" />
<C1 id="10" value="1.0" />
<C2 id="11" value="1.0" />
<C3 id="12" value="1.0" />
<TSVs id="13" value="1.0" />
<C0 id="14" value="1.0" />
<C1 id="15" value="1.0" />
<C2 id="16" value="1.0" />
<C3 id="17" value="1.0" />
<TSVs id="18" value="1.0" />
<C0 id="19" value="1.0" />
<C1 id="20" value="1.0" />
<C2 id="21" value="1.0" />
<C3 id="22" value="1.0" />
<TSVs id="23" value="1.0" />
<C0 id="24" value="1.0" />
<C1 id="25" value="1.0" />
<C2 id="26" value="1.0" />
<C3 id="27" value="1.0" />
<TSVs id="28" value="1.0" />
</power_thresholds>

View File

@@ -15,9 +15,11 @@
<StaticTemperatureDefaultValue value="89" />
<DynTemperatureSimPeriod value="100" />
<DynTemperatureSimUnit value="us" />
<PowerThresholdsFile value="../../DRAMSys/simulator/resources/configs/temperature_sim/power_thresholds.xml"/>
<PowerInfoFile value="../../DRAMSys/simulator/resources/configs/temperature_sim/powerInfo.xml"/>
<IceServerIp value="127.0.0.1" />
<IceServerPort value="11880" />
<SimPeriodAdjustFactor value="10" />
<NPowStableCyclesToIncreasePeriod value="5" />
</temperature_simconfig>
<memspecs>

View File

@@ -159,14 +159,18 @@ void Configuration::setParameter(std::string name, std::string value)
temperatureSim.DynTemperatureSimPeriod = std::stod(value.c_str());
else if (name == "DynTemperatureSimUnit")
temperatureSim.DynTemperatureSimUnit = string2TimeUnit(value);
else if (name == "PowerThresholdsFile") {
temperatureSim.powerThresholdsFile = value;
temperatureSim.parsePowerThresholdsFile();
else if (name == "PowerInfoFile") {
temperatureSim.powerInfoFile = value;
temperatureSim.parsePowerInfoFile();
}
else if (name == "IceServerIp")
temperatureSim.IceServerIp = value;
else if (name == "IceServerPort")
temperatureSim.IceServerPort = string2int(value);
else if (name == "SimPeriodAdjustFactor")
temperatureSim.SimPeriodAdjustFactor = std::stoi(value.c_str());
else if (name == "NPowStableCyclesToIncreasePeriod")
temperatureSim.NPowStableCyclesToIncreasePeriod = std::stoi(value.c_str());
else
{
SC_REPORT_FATAL("Configuration", ("Parameter " + name + " not defined in Configuration").c_str());

View File

@@ -55,29 +55,38 @@ struct TemperatureSimConfig {
enum sc_time_unit DynTemperatureSimUnit;
std::string IceServerIp;
unsigned int IceServerPort;
unsigned int SimPeriodAdjustFactor;
unsigned int NPowStableCyclesToIncreasePeriod;
std::string powerThresholdsFile;
// Power related information
std::string powerInfoFile;
std::vector<float> powerInitialValues;
std::vector<float> powerThresholds;
void parsePowerThresholdsFile()
void parsePowerInfoFile()
{
printDebugMessage("Power Thresholds File: " + powerThresholdsFile);
printDebugMessage("Power Info File: " + powerInfoFile);
// Load the XML file into memory and parse it
tinyxml2::XMLDocument xml;
loadXML(powerThresholdsFile, xml);
tinyxml2::XMLElement *powThrElem = xml.FirstChildElement("power_thresholds");
loadXML(powerInfoFile, xml);
tinyxml2::XMLElement *powInfoElem = xml.FirstChildElement("powerInfo");
if (powThrElem == NULL) {
if (powInfoElem == NULL) {
// Invalid file
std::string errormsg = "Invalid Power Thresholds File " + powerThresholdsFile;
std::string errormsg = "Invalid Power Info File " + powerInfoFile;
printDebugMessage(errormsg);
SC_REPORT_FATAL("Temperature Sim Config", errormsg.c_str());
throw;
}
for (tinyxml2::XMLElement *e = powThrElem->FirstChildElement(); e != NULL; e = e->NextSiblingElement()) {
std::string thr_str = e->Attribute("value");
for (tinyxml2::XMLElement *e = powInfoElem->FirstChildElement(); e != NULL; e = e->NextSiblingElement()) {
std::string init_pow_str = e->Attribute("init_pow");
float pow = std::stof(init_pow_str);
powerInitialValues.push_back(pow);
std::string thr_str = e->Attribute("threshold");
float thr = std::stof(thr_str);
powerThresholds.push_back(thr);
}
@@ -88,6 +97,10 @@ struct TemperatureSimConfig {
void showTemperatureSimConfig()
{
int i = 0;
for (auto e : powerInitialValues) {
printDebugMessage("powerInitialValues[" + std::to_string(i++) + "]: " + std::to_string(e));
}
i = 0;
for (auto e : powerThresholds) {
printDebugMessage("powerThreshold[" + std::to_string(i++) + "]: " + std::to_string(e));
}

View File

@@ -495,6 +495,9 @@ unsigned int errorModel::getBit(int row, int column, int byteInColumn, int bitIn
double errorModel::getTemperature()
{
// TODO here we need to get the current power value from DRAMPower (and
// make adjusts if necessary) and pass it to the Temperature Controller
// with the correct ID for this device.
double temperature = TemperatureController::getInstance().getTemperature(0, 0);
return temperature;
}

View File

@@ -42,8 +42,9 @@
double TemperatureController::getTemperature(int deviceId, float currentPower)
{
if (dynamicTempSimEnabled == true) {
// XXX do I need a mutex here?
currentPowerValues.at(deviceId) = currentPower;
if (temperatureValues.empty())
return staticTemperature;
return temperatureValues.at(deviceId);
} else {
printDebugMessage("Temperature is " + std::to_string(staticTemperature));
@@ -85,7 +86,7 @@ double TemperatureController::adjustThermalSimPeriod()
// defined in the configuration by the user.
//
// 1.2.1 The situation period will be kept for a number of simulation
// executions 'ne' and after ne' the period will be increased again in
// executions 'ne' and after 'ne' the period will be increased again in
// steps of 'n/2' until it achieves the desired value given by
// configuration or the described in 1.1 occurs.

View File

@@ -59,53 +59,24 @@ public:
dynamicTempSimEnabled = Configuration::getInstance().DynamicTemperatureSimulation;
if (dynamicTempSimEnabled == true) {
// Connect to the server
std::string ip = Configuration::getInstance().temperatureSim.IceServerIp;
unsigned int port = Configuration::getInstance().temperatureSim.IceServerPort;
thermalSimulation = new IceWrapper(ip, port);
printDebugMessage("Dynamic temperature simulation. Server @ " + ip + ":" + std::to_string(port));
// get from config the initial power dissipation value
currentPowerValues = {
0, // 1: CPUs
0, // 2: GPU
1, // 3: BASEBAND1
0, // 4: BASEBAND2
0, // 5: LLCACHE
0, // 6: DRAMCTRL1
0, // 7: DRAMCTRL2
0, // 8: TSVs
0, // 9: ACELLERATORS
1, //10: C0
0, //11: C1
0, //12: C2
0, //13: C3
0, //14: TSVs
0, //10: C0
0, //11: C1
0, //12: C2
0, //13: C3
0, //14: TSVs
0, //10: C0
0, //11: C1
0, //12: C2
0, //13: C3
0, //14: TSVs
0, //10: C0
0, //11: C1
0, //12: C2
0, //13: C3
0 //14: TSVs
};
// Initial power dissipation values (got from config)
currentPowerValues = Configuration::getInstance().temperatureSim.powerInitialValues;
lastPowerValues = currentPowerValues;
// Substantial changes in power will trigger adjustments in the simulaiton period. Get the thresholds from config.
powerThresholds = Configuration::getInstance().temperatureSim.powerThresholds;
periodAdjustFactor = 10;
nPowStableCyclesToIncreasePeriod = 5;
periodAdjustFactor = Configuration::getInstance().temperatureSim.SimPeriodAdjustFactor;
nPowStableCyclesToIncreasePeriod = Configuration::getInstance().temperatureSim.NPowStableCyclesToIncreasePeriod;
cyclesSinceLastPeriodAdjust = 0;
// Get the target period for the thermal simulation from config.
targetPeriod = Configuration::getInstance().temperatureSim.DynTemperatureSimPeriod;
period = targetPeriod;
t_unit = Configuration::getInstance().temperatureSim.DynTemperatureSimUnit;

View File

@@ -140,9 +140,11 @@ The XML code below shows a typic configuration:
<StaticTemperatureDefaultValue value="89" />
<DynTemperatureSimPeriod value="100" />
<DynTemperatureSimUnit value="ms" />
<PowerThresholdsFile value="../../DRAMSys/simulator/resources/configs/temperature_sim/power_thresholds.xml"/>
<PowerInfoFile value="../../DRAMSys/simulator/resources/configs/temperature_sim/power_thresholds.xml"/>
<IceServerIp value="127.0.0.1" />
<IceServerPort value="11880" />
<SimPeriodAdjustFactor value="10" />
<NPowStableCyclesToIncreasePeriod value="5" />
</temperature_simconfig>
<!-- Memory Specifications -->
@@ -258,12 +260,16 @@ Below are listed the configuration sections and configuration fields.
- "ns": nanoseconds
- "ps": picoseconds
- "fs": femtoseconds
- *PowerThresholdsFile* (string)
- File containing the power thresholds that trigger the temperature simulation
- *PowerInfoFile* (string)
- File containing power related information: devices identifiers, initial power values and power thresholds.
- *IceServerIp* (string)
- 3D-Ice server IP address
- *IceServerPort* (unsigned int)
- 3D-Ice server port
- *SimPeriodAdjustFactor* (unsigned int)
- When substantial changes in power occur (i.e., changes that exceed the thresholds), then the simulation period will be divided by this number causing the thermal simulation to be executed more often.
- *NPowStableCyclesToIncreasePeriod* (unsigned int)
- Wait this number of thermal simulation executions or cycles with power stability (i.e., changes that do not exceed the thresholds) to start increasing the simulation period back to its configured value.
- **Memory Specification**