diff --git a/DRAMSys/dram.vp.system.pro b/DRAMSys/dram.vp.system.pro index d1a3d29f..37b7397b 100644 --- a/DRAMSys/dram.vp.system.pro +++ b/DRAMSys/dram.vp.system.pro @@ -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 diff --git a/DRAMSys/simulator/simulator.pro b/DRAMSys/simulator/simulator.pro index a3c59a0d..9f18dd15 100644 --- a/DRAMSys/simulator/simulator.pro +++ b/DRAMSys/simulator/simulator.pro @@ -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) +} diff --git a/DRAMSys/simulator/src/simulation/TemperatureController.cpp b/DRAMSys/simulator/src/simulation/TemperatureController.cpp index 2eb3bbe0..370c4195 100644 --- a/DRAMSys/simulator/src/simulation/TemperatureController.cpp +++ b/DRAMSys/simulator/src/simulation/TemperatureController.cpp @@ -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(¤tPowerValues); 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)); } } } diff --git a/DRAMSys/simulator/src/simulation/TemperatureController.h b/DRAMSys/simulator/src/simulation/TemperatureController.h index 372f2ac8..10913ce7 100644 --- a/DRAMSys/simulator/src/simulation/TemperatureController.h +++ b/DRAMSys/simulator/src/simulation/TemperatureController.h @@ -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 temperaturesBuffer; std::vector temperatureValues;