Thermal simulation can be enabled via environment variable.

mkdir build
cd build
export THERMALSIM=true
qmake ../DRAMSys/dram.vp.system.pro
make [-j16]

Pending:
- README file update
This commit is contained in:
Éder F. Zulian
2015-10-07 15:59:38 +02:00
parent 687f077c8f
commit 8050bad57f
4 changed files with 53 additions and 23 deletions

View File

@@ -1,8 +1,17 @@
TEMPLATE = subdirs
SUBDIRS = simulator/src/common/third_party/icewrapper/3D-ICE-SystemC-Client.pro
thermalsim = $$(THERMALSIM)
$$eval(thermalsim) {
message(Thermal Simulation Feature Enabled)
# build the project sequentially as listed in SUBDIRS
CONFIG += ordered
SUBDIRS += simulator/src/common/third_party/icewrapper/3D-ICE-SystemC-Client.pro
} else {
message(Thermal Simulation Feature Disabled)
}
SUBDIRS += simulator/simulator.pro
SUBDIRS += analyzer/traceAnalyzer.pro
# build the project sequentially as listed in SUBDIRS
CONFIG += ordered

View File

@@ -134,15 +134,28 @@ HEADERS += \
src/controller/core/configuration/ConfigurationLoader.h \
src/error/errormodel.h
thermalsim = $$(THERMALSIM)
$$eval(thermalsim) {
message(Thermal Simulation Feature Enabled)
LIBS += -L/opt/3D-ICE/lib -lthreed-ice-2.2.5
LIBS += -L/opt/SuperLU_4.3/lib -lsuperlu_4.3
LIBS += -lblas
LIBS += -L/opt/3D-ICE/lib -lthreed-ice-2.2.5
LIBS += -L/opt/SuperLU_4.3/lib -lsuperlu_4.3
LIBS += -lblas
message(Libraries: $${LIBS})
INCLUDEPATH += /opt/3D-ICE/include
INCLUDEPATH += /opt/SuperLU_4.3/SRC
INCLUDEPATH += /opt/systemc/include
INCLUDEPATH += src/common/third_party/icewrapper
INCLUDEPATH += /opt/3D-ICE/include
INCLUDEPATH += /opt/SuperLU_4.3/SRC
INCLUDEPATH += /opt/systemc/include
INCLUDEPATH += src/common/third_party/icewrapper
message(Include paths: $${INCLUDEPATH})
OBJECTS += $$(PWD)/src/common/third_party/icewrapper/IceWrapper.o
OBJECTS += $$(PWD)/src/common/third_party/icewrapper/IceWrapper.o
message(Objects: $${OBJECTS})
QMAKE_CXXFLAGS += -DTHERMALSIM
message(Compiler flags: $${QMAKE_CXXFLAGS})
} else {
message(Thermal Simulation Feature Disabled)
}

View File

@@ -43,8 +43,7 @@ double TemperatureController::temperatureConvert(double tKelvin)
{
if (temperatureScale == "Celsius") {
return tKelvin - 273.15;
}
else if (temperatureScale == "Fahrenheit") {
} else if (temperatureScale == "Fahrenheit") {
return (tKelvin - 273.15) * 1.8 + 32;
}
@@ -70,12 +69,14 @@ double TemperatureController::getTemperature(int deviceId, float currentPower)
void TemperatureController::updateTemperatures()
{
#ifdef THERMALSIM
thermalSimulation->sendPowerValues(&currentPowerValues);
thermalSimulation->simulate();
thermalSimulation->getTemperature(temperaturesBuffer, TDICE_OUTPUT_INSTANT_SLOT, TDICE_OUTPUT_TYPE_TCELL, TDICE_OUTPUT_QUANTITY_NONE);
// save values just obtained for posterior use
#endif
// Save values just obtained for posterior use
temperatureValues = temperaturesBuffer;
// clear the buffer, otherwise it will grow every request
// Clear the buffer, otherwise it will grow every request
temperaturesBuffer.clear();
}
@@ -86,7 +87,7 @@ double TemperatureController::adjustThermalSimPeriod()
// 1. Adjustment is requierd when:
//
// 1.1. The power dissipation of one or more devices change considerably
// (reaches the configured threshold for that device in any direction,
// (exceeds the configured threshold for that device in any direction,
// i.e. increases or decreases substantially) during the current
// simulaiton period.
//
@@ -101,9 +102,10 @@ double TemperatureController::adjustThermalSimPeriod()
// 1.2. The current simulation period differs from the target period
// 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
// steps of 'n/2' until it achieves the desired value given by
// 1.2.1 Provided a scenario in which power dissipation changes do not
// exceed the thresholds, the situation period will be kept for a number
// of simulation cycles 'nc' and after 'nc' 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.
bool decreaseSimPeriod = false;
@@ -126,9 +128,9 @@ double TemperatureController::adjustThermalSimPeriod()
if (cyclesSinceLastPeriodAdjust >= nPowStableCyclesToIncreasePeriod) {
cyclesSinceLastPeriodAdjust = 0;
period = period * (periodAdjustFactor / 2);
printDebugMessage("Thermal Simulation period increased to " + std::to_string(period) + ". Target is " + std::to_string(targetPeriod));
if (period > targetPeriod)
period = targetPeriod;
printDebugMessage("Thermal Simulation period increased to " + std::to_string(period) + ". Target is " + std::to_string(targetPeriod));
}
}
}

View File

@@ -44,7 +44,10 @@
#include "../common/DebugManager.h"
#include "../common/Utils.h"
#include "../controller/core/configuration/Configuration.h"
#ifdef THERMALSIM
#include "IceWrapper.h"
#endif
SC_MODULE(TemperatureController) {
public:
@@ -61,13 +64,15 @@ public:
dynamicTempSimEnabled = Configuration::getInstance().DynamicTemperatureSimulation;
if (dynamicTempSimEnabled == true) {
#ifdef THERMALSIM
// 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));
#else
SC_REPORT_FATAL(name(), "Temperature Simulation Disabled");
#endif
// Initial power dissipation values (got from config)
currentPowerValues = Configuration::getInstance().temperatureSim.powerInitialValues;
lastPowerValues = currentPowerValues;
@@ -83,7 +88,6 @@ public:
period = targetPeriod;
t_unit = Configuration::getInstance().temperatureSim.DynTemperatureSimUnit;
SC_THREAD(temperatureThread);
} else {
staticTemperature = Configuration::getInstance().temperatureSim.StaticTemperatureDefaultValue;
printDebugMessage("Static temperature simulation. Temperature set to " + std::to_string(staticTemperature));
@@ -100,7 +104,9 @@ private:
bool dynamicTempSimEnabled;
#ifdef THERMALSIM
IceWrapper *thermalSimulation;
#endif
std::vector<float> temperaturesBuffer;
std::vector<float> temperatureValues;