diff --git a/DRAMSys/simulator/resources/resources.pri b/DRAMSys/simulator/resources/resources.pri index 3de5ec6a..0ae2c6c7 100644 --- a/DRAMSys/simulator/resources/resources.pri +++ b/DRAMSys/simulator/resources/resources.pri @@ -27,6 +27,10 @@ OTHER_FILES += resources/scripts/analyse_trace.pl OTHER_FILES += resources/scripts/video_rendering/temperatur.job.pl OTHER_FILES += resources/scripts/video_rendering/temperatur.pl OTHER_FILES += resources/scripts/video_rendering/Makefile +OTHER_FILES += resources/scripts/dramSylva/LICENSE +OTHER_FILES += resources/scripts/dramSylva/README +OTHER_FILES += resources/scripts/dramSylva/dramSylva.patch +OTHER_FILES += resources/scripts/dramSylva/dramSylva.sh # Trace Files OTHER_FILES += resources/traces/chstone-aes_32.stl diff --git a/DRAMSys/simulator/resources/scripts/dramSylva/LICENSE b/DRAMSys/simulator/resources/scripts/dramSylva/LICENSE new file mode 100644 index 00000000..7803da9e --- /dev/null +++ b/DRAMSys/simulator/resources/scripts/dramSylva/LICENSE @@ -0,0 +1,29 @@ +Copyright (c) 2017, University of Kaiserslautern +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/DRAMSys/simulator/resources/scripts/dramSylva/README b/DRAMSys/simulator/resources/scripts/dramSylva/README new file mode 100644 index 00000000..4b595bb1 --- /dev/null +++ b/DRAMSys/simulator/resources/scripts/dramSylva/README @@ -0,0 +1,64 @@ + +------------------------------------------------------------------------------ +How do I run dramSylva? +------------------------------------------------------------------------------ + +$ chmod u+x dramSylva.sh +$ ./dramSylva.sh + +------------------------------------------------------------------------------ +What about output files? +------------------------------------------------------------------------------ + +Regular output generated by DRAMSys can be found as output*.txt files. + +Additionally, the powerful dramSylva creates a CSV file with relevant output +from DRAMSys allowing people to generate plots using a spreadsheet program! + +The versatile dramSylva patches DRAMSys so that it creates databases with +names based on the trace setup ID. By doing this there is no risk that a +simulation overwrites a database created by a previous one! Hurray! + +$ cd dram.vp.system +$ cd build/simulator +$ vim output* +$ ls *.tdb + +------------------------------------------------------------------------------ +Why is it called dramSylva? +------------------------------------------------------------------------------ + +Because it gathers some logs. + +From WordNet (r) 3.0 (2006) [wn]: + + sylva + n 1: the forest trees growing in a country or region [syn: + {silva}, {sylva}] + +From WordNet (r) 3.0 (2006) [wn]: + + log + n 1: a segment of the trunk of a tree when stripped of branches + 2: the exponent required to produce a given number [syn: + {logarithm}, {log}] + 3: a written record of messages sent or received; "they kept a + log of all transmission by the radio station"; "an email log" + 4: a written record of events on a voyage (of a ship or plane) + 5: measuring instrument that consists of a float that trails + from a ship by a knotted line in order to measure the ship's + speed through the water + v 1: enter into a log, as on ships and planes + 2: cut lumber, as in woods and forests [syn: {log}, {lumber}] + +------------------------------------------------------------------------------ +Can I change dramSylva or translate it to another language? +------------------------------------------------------------------------------ + +Yes, please do that. Translations to python, pearl, etc. are very welcome. + +If you decide to use dramSylva, please give credit and mention that your +script is based on it. + +------------------------------------------------------------------------------ + diff --git a/DRAMSys/simulator/resources/scripts/dramSylva/dramSylva.patch b/DRAMSys/simulator/resources/scripts/dramSylva/dramSylva.patch new file mode 100644 index 00000000..1893c3fa --- /dev/null +++ b/DRAMSys/simulator/resources/scripts/dramSylva/dramSylva.patch @@ -0,0 +1,34 @@ +diff --git a/DRAMSys/simulator/src/simulation/DRAMSys.cpp b/DRAMSys/simulator/src/simulation/DRAMSys.cpp +index ea544ee..9a02a10 100644 +--- a/DRAMSys/simulator/src/simulation/DRAMSys.cpp ++++ b/DRAMSys/simulator/src/simulation/DRAMSys.cpp +@@ -109,9 +109,27 @@ DRAMSys::DRAMSys(sc_module_name __attribute__((unused)) name, + + "configs/thermalsim/" + + thermalconfig); + ++ std::string simName; ++ tinyxml2::XMLDocument simulationdoc; ++ loadXML(simulationToRun, simulationdoc); ++ tinyxml2::XMLElement* simulation = simulationdoc.FirstChildElement("simulation"); ++ tinyxml2::XMLElement *tracesetup = simulation->FirstChildElement("tracesetup"); ++ std::string tsid; ++ auto r = tracesetup->Attribute("id"); ++ if (r != 0) { ++ tsid = r; ++ cout << "Trace Setup ID found: " << tsid.c_str() << endl; ++ simName = Configuration::getInstance().SimulationName + '_' + tsid; ++ cout << "simulation name set to: " << simName << endl; ++ ++ } else { ++ cout << "Trace Setup ID not found" << endl; ++ simName = Configuration::getInstance().SimulationName; ++ cout << "simulation name set to: " << simName << endl; ++ } ++ + // Instantiate all internal DRAMSys modules: +- instantiateModules(Configuration::getInstance().SimulationName, +- pathToResources); ++ instantiateModules(simName, pathToResources); + // Connect all internal DRAMSys modules: + bindSockets(); + diff --git a/DRAMSys/simulator/resources/scripts/dramSylva/dramSylva.sh b/DRAMSys/simulator/resources/scripts/dramSylva/dramSylva.sh new file mode 100755 index 00000000..3c4bc1f0 --- /dev/null +++ b/DRAMSys/simulator/resources/scripts/dramSylva/dramSylva.sh @@ -0,0 +1,120 @@ +#! /bin/bash + +# Copyright (c) 2017, University of Kaiserslautern +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER +# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Author: Éder F. Zulian + +set -x + +simfiles=" +../../DRAMSys/simulator/resources/simulations/ddr3-example.xml +../../DRAMSys/simulator/resources/simulations/ddr3_postpone_test.xml +" + +traces=" +ddr3_example.stl +ddr3_postpone_ref_test_1.stl +" + +clocks="200 1000" + +out_prefix=output +out_ext=txt + +function systole { + local current_time=$(date "+%Y.%m.%d-%H.%M.%S") + local dir="dram.vp.system_$current_time" + `git clone --recursive git@git.rhrk.uni-kl.de:EIT-Wehn/dram.vp.system.git $dir` + cd $dir + git checkout master + git pull + git submodule update --init --recursive + local patchfile=../dramSylva.patch + patch -p1 < $patchfile + rm -rf build + mkdir build + cd build + qmake ../DRAMSys/DRAMSys.pro + make -j8 + cd simulator +} + +function heartbeat { + local elf=DRAMSys + for f in $simfiles; do + + sf=$f + sfnameext=`basename $f` + sfn="${sfnameext%.*}" + + for t in $traces; do + replace=">$t" + `sed -i.bak 's@>.*<\/device>@'"$replace"'@' $sf` + + for c in $clocks; do + clk="clkMhz=\"${c}\"" + `sed -i.bak 's@clkMhz=.*"@'"$clk"'@' $sf` + + tnameext=`basename $t` + tname="${tnameext%.*}" + id="" + `sed -i.bak 's@@'"$id"'@' $sf` + + of="${out_prefix}_${sfn}_$t_${c}MHz.${out_ext}" + printf "$t\n" > $of + ./$elf $sf >> $of & + sleep 1 + done + done + wait + done + wait +} + +function washup { + local csvoutfile="output.csv" + printf "SimulationFile,TotalEnergy[pJ],AveragePower[mW],TotalTime[ps],AverageBandwidth[Gbps],AverageBandwidthWithoutIdle[Gbps],MaximumBandwidth[Gbps]\n" >> $csvoutfile + + ofiles=`ls ${out_prefix}*.${out_ext}` + for f in $ofiles; do + totalenergy=(`fgrep "Total Energy" $f | awk {'print $4'}`) + averagepower=(`fgrep "Average Power" $f | awk {'print $4'}`) + totaltime=(`fgrep "Total Time" $f | awk {'print $4'}`) + averagebw=(`fgrep "AVG BW:" $f | awk {'print $4'}`) + averagebwwoidle=(`fgrep "AVG BW/IDLE" $f | awk {'print $4'}`) + maxbw=(`fgrep "MAX BW:" $f | awk {'print $4'}`) + printf "$f,$totalenergy,$averagepower,$totaltime,$averagebw,$averagebwwoidle,$maxbw\n" >> $csvoutfile + done +} + +systole +heartbeat +washup