Commit 429938c7 authored by Antoine El Hokayem's avatar Antoine El Hokayem
Browse files

Update artifact to new DRBIP version, include new data for SEFM

parent 422f21f4
PACK?=platoon
SYS?=SYS()
V?=0.0.2
N?=10
TOOLS=../tools
BIP=${TOOLS}/bipc/bin/bipc.sh
DR_PATH=${TOOLS}/drbip
TVIEWER=${TOOLS}/trace-viewer
BIPEXEC?=./exec.sh
VER?=
TFILE=${PACK}-$(shell date +"%s")
TPREFIX?=
TFILE=${TPREFIX}${PACK}-$N-$(shell date +"%s")
VIEWER?=show
......@@ -48,21 +51,23 @@ genbip:
gendrbip:
${DR_PATH}/drbip model${PRE}/${PACK}${VER}.drbip output/Deploy model${PRE}
${DR_PATH}/scripts/mktemplates ${PACK} output/Deploy
cp model/*.cpp output/Deploy
cp -f model/*.cpp output/Deploy 2>/dev/null || true
cp -f model/*.h output/Deploy 2>/dev/null || true
cp -f model/*.hpp output/Deploy 2>/dev/null || true
execute:
./exec.sh
${BIPEXEC}
bench:
./exec.sh "--limit ${N}" "-DPERFMODE"
${BIPEXEC} "--limit ${N}" "-DPERFMODE"
limit:
./exec.sh "--limit ${N}"
${BIPEXEC} "--limit ${N}"
trace:
./exec.sh "--limit ${N}" | grep "<TRACE>" | tee ${PACK}.txt
java -jar ${DR_PATH}/converttrace.jar ${PACK}.txt ${PACK}
rm ${PACK}.txt
${BIPEXEC} "--limit ${N}" | grep "<TRACE>" | tee ${PACK}.txt
java -cp ${DR_PATH}/drbip-trace-${V}.jar ujf.verimag.drbip.trace.JSON ${PACK}.txt ${PACK}
mv ${PACK}.txt last-raw.txt
mv ${PACK}.json ${TFILE}.json
viewtraces:
......
......@@ -112,6 +112,32 @@ cd ../tools/trace-viewer
And run `make`.
**Replicating the Scenarios from the Paper**
To replicate the traces provided in the paper for the two scenarios, proceed as follows.
*Scenario 1*: Cars are initially separated by less than the merge distance.
```
make genmodel dyn=1 cars=1000 dist=0.3f movemin=150 movemax=200 mergedist=0.5f
make gencode
make trace N=25000 TPREFIX=S1-
```
*Scenario 2*: Cars are initially separated by twice the merge distance.
```
make genmodel dyn=1 cars=1000 dist=1.0f movemin=150 movemax=200 mergedist=0.5f
make gencode
make trace N=3000 TPREFIX=S2-
```
You can now view both traces with:
```
make viewtraces
```
#### Performance Analysis
The system can be run in performance mode, hiding all print statements and logging information in counters that are printed at the end of the execution stopping after `N` BIP executions.
......
#!/bin/bash
BLOG=bench.log
FREQ=("low;500;700" "med;300;500" "high;150;200")
rm -rf $BLOG
echo "--Starting bench" > $BLOG
echo "freq,cars,dist,dynamic,n,timebip,interactions,timetotal,timedrbip,reconfigurations,imr,rr,ir,comps_created,comps_destroyed,motifs_created,motifs_destroyed,max_motifs,max_comps,max_conditions"
for fline in ${FREQ[@]}
do
IFS=';' read -ra freq <<< "$fline"
FLBL=${freq[0]}
FMIN=${freq[1]}
FMAX=${freq[2]}
for car in 10 100 500 1000
do
for dist in "0.5f" "1.0f"
for dist in "0.3f" "1.0f"
do
for tgl in 0 1
do
make clean >> $BLOG 2>> $BLOG
make cleanmodel > $BLOG 2>> $BLOG
echo "### cars=$car dist=$dist dyn=$tgl movemin=500 movemax=700 mergedist=0.5f" >> $BLOG
make genmodel cars=$car dist=$dist dyn=$tgl movemin=500 movemax=700 mergedist=0.5f >> $BLOG 2>> $BLOG
echo "### cars=$car dist=$dist dyn=$tgl movemin=$FMIN movemax=$FMAX mergedist=0.5f" >> $BLOG
make genmodel cars=$car dist=$dist dyn=$tgl movemin=$FMIN movemax=$FMAX mergedist=0.5f >> $BLOG 2>> $BLOG
make gencode >> $BLOG 2>> $BLOG
for n in 5001
do
for k in $(seq 1 $1)
do
res=`make bench N=$n 2> /dev/null | tail -n 15 | cut -d":" -f2 | cut -d " " -f2 | paste -s -d","`
echo "low,$car,$dist,$tgl,$((n - 1)),$res"
echo "$FLBL,$car,$dist,$tgl,$((n - 1)),$res"
done
done
done
done
done
done
echo "--End bench" > $BLOG
......@@ -56,7 +56,7 @@ motif Platoon<PlatoonMap, PlatoonAddressing> {
rule interaction SplitIR(CAR leader, CAR follower)
when (
(C.size() > 3) && S.isLeader(@leader),
(C.size() >= 3) && S.isLeader(@leader),
follower != leader && S.validSplit(@follower))
{
new Splitstep(leader, follower)
......
......@@ -2,25 +2,25 @@
#define PLATOONUTILS 1
#include<cstdlib>
#include<iostream>
using namespace std;
const float MAX_SPEED = 0.25f;
const float MIN_SPEED = 0.15f;
const float DELTA_INC = 1.02f;
const float DELTA_DEC = 0.98f;
const int MAX_SPEED = 0.25;
const int MIN_SPEED = 0.15;
const double DELTA_INC = 1.02;
const double DELTA_DEC = 0.98;
//const int IDLE_MOVE = 150;
//const int IDLE_MIN = 50;
const int IDLE_MOVE = %movemin%;
const int IDLE_MIN = %movemax%;
double mergeDist() {
float mergeDist() {
return %mergedist%;
}
int getRandomNumber(int min, int max)
{
static constexpr double fraction { 1.0 / (RAND_MAX + 1.0) }; // static used for efficiency, so we only calculate this value once
// evenly distribute the random number across our range
static constexpr double fraction { 1.0 / (RAND_MAX + 1.0) };
return min + static_cast<int>((max - min + 1) * (std::rand() * fraction));
}
......@@ -31,17 +31,18 @@ int updateStep(int step) {
if(step > 0) return step - 1;
else return 0;
}
double speedLead(double speed) {
double sp2 = speed * DELTA_INC;
if(sp2 > MAX_SPEED) return MAX_SPEED * DELTA_DEC;
else return sp2;
//return speed * 1.02;
float speedLead(float speed) {
float sp2 = speed * DELTA_INC;
float res;
if(sp2 > MAX_SPEED) res = MAX_SPEED;
else res = sp2;
return res;
}
double speedSplit(double speed) {
double sp2 = speed * DELTA_DEC;
if(sp2 < MIN_SPEED) return MIN_SPEED * DELTA_INC;
else return sp2;
//return speed * 0.98;
float speedSplit(float speed) {
float sp2 = speed * DELTA_DEC;
float res;
if(sp2 < MIN_SPEED) res = MIN_SPEED;
else res = sp2;
return res;
}
#endif
......@@ -5,11 +5,13 @@
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>README</title>
<style type="text/css">
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
</style>
<link rel="stylesheet" href="../pandoc/github.css" />
<!--[if lt IE 9]>
......@@ -32,7 +34,7 @@
<li>A <code>.drbip</code> model that includes the relevant motifs, interaction, reconfiguration and global inter-motif rules.</li>
<li>A <code>.cpp</code> file which include conditions, structures (maps) and addressing function implementations for usage with motifs.</li>
</ol>
<p>The Platoon System model can be found in <a href="model/core" class="uri">model/core</a> and its’ parameters are instantiated to fit our execution.</p>
<p>The Platoon System model can be found in <a href="model/core">model/core</a> and its’ parameters are instantiated to fit our execution.</p>
<p>To instantiate a test model perform:</p>
<pre><code>make gentestmodel</code></pre>
<p>The parameters of the Platoon System are as follows:</p>
......@@ -70,7 +72,7 @@
<p>This outputs a new <code>.json</code> file with structured information about the trace.</p>
<p>To view all traces (if you have Python3) it is possible to use the <a href="../tools/trace-viewer">web tool</a> automatically using:</p>
<pre><code>make viewtraces</code></pre>
<p>Then opening a browser on: <a href="http://0.0.0.0:8000" class="uri">http://0.0.0.0:8000</a>.</p>
<p>Then opening a browser on: <a href="http://0.0.0.0:8000">http://0.0.0.0:8000</a>.</p>
<p>The score graph is shown first, by clicking on it, it closes allowing you to explore the other graphs:</p>
<ul>
<li>Press <code>s</code> to view the action trace – sequence of actions applied. Clicking on a red bar on top displays the global view, while clicking on a green bar displays the reconfiguration view of the system (after the reconfiguration). You can use arrows to navigate snapshots. Clicking on interaction rules displays the created connector.</li>
......@@ -80,13 +82,25 @@
<p>A set of example traces is provided with the <a href="../tools/trace-viewer/">web tool</a>. To view them go to the folder:</p>
<pre><code>cd ../tools/trace-viewer</code></pre>
<p>And run <code>make</code>.</p>
<p><strong>Replicating the Scenarios from the Paper</strong></p>
<p>To replicate the traces provided in the paper for the two scenarios, proceed as follows.</p>
<p><em>Scenario 1</em>: Cars are initially separated by less than the merge distance.</p>
<pre><code>make genmodel dyn=1 cars=1000 dist=0.3f movemin=150 movemax=200 mergedist=0.5f
make gencode
make trace N=25000 TPREFIX=S1-</code></pre>
<p><em>Scenario 2</em>: Cars are initially separated by twice the merge distance.</p>
<pre><code>make genmodel dyn=1 cars=1000 dist=1.0f movemin=150 movemax=200 mergedist=0.5f
make gencode
make trace N=3000 TPREFIX=S2-</code></pre>
<p>You can now view both traces with:</p>
<pre><code>make viewtraces</code></pre>
<h4 id="performance-analysis">Performance Analysis</h4>
<p>The system can be run in performance mode, hiding all print statements and logging information in counters that are printed at the end of the execution stopping after <code>N</code> BIP executions.</p>
<pre><code>make bench N=1000</code></pre>
<p>A full benchmark script (<a href="bench.sh" class="uri">bench.sh</a>) is provided to execute benchmarking for various number of parameters and outputs CSV data.</p>
<p>A full benchmark script (<a href="bench.sh">bench.sh</a>) is provided to execute benchmarking for various number of parameters and outputs CSV data.</p>
<p>To execute the benchmark script (which may take <strong>30-60</strong> minutes) you need to provide a number of executions per combinations of parameters, and you can optionally use <code>tee</code> to store the output in a file:</p>
<pre><code>./bench.sh 10 | tee bench.csv</code></pre>
<p>The generated CSV file can be analyzed and plotted in <a href="../plot" class="uri">../plot</a>.</p>
<p>The generated CSV file can be analyzed and plotted in <a href="../plot">../plot</a>.</p>
<h3 id="general-implementation-details-when-writing-dr-bip-models">General Implementation Details when Writing DR-BIP models</h3>
<blockquote>
<p><strong>Note:</strong> This section is intended for those wanting to write their own models or rules.</p>
......
This diff is collapsed.
......@@ -5,11 +5,13 @@
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>README</title>
<style type="text/css">
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
</style>
<link rel="stylesheet" href="../pandoc/github.css" />
<!--[if lt IE 9]>
......@@ -33,11 +35,11 @@
<p><strong>Note:</strong> If an error related to dependencies occurs when running the R script, modify <code>dep.r</code> by forcing the installation of all needed plugins (commenting and uncommenting lines).</p>
</blockquote>
<h3 id="data-source">Data Source</h3>
<p>The plotting scripts will utilize data generated by benchmarking <a href="../platoon" class="uri">../platoon</a>. For more details see the folder for information. An existing data file is provided <a href="bench.csv" class="uri">bench.csv</a></p>
<p>The plotting scripts will utilize data generated by benchmarking <a href="../platoon">../platoon</a>. For more details see the folder for information. An existing data file is provided <a href="bench.csv">bench.csv</a></p>
<h3 id="generating-plots">Generating Plots</h3>
<p>To generate the plots execute:</p>
<pre><code>Rscript plot.r</code></pre>
<p>PDFs are created with the plots, additional plots can be found in the generated <a href="Rplots.pdf" class="uri">Rplots.pdf</a>. The benchmark table is created as a <code>.tex</code> file: <a href="benchtable.tex" class="uri">benchtable.tex</a>.</p>
<p>PDFs are created with the plots, additional plots can be found in the generated <a href="Rplots.pdf">Rplots.pdf</a>. The benchmark table is created as a <code>.tex</code> file: <a href="benchtable.tex">benchtable.tex</a>.</p>
<p>You can use <code>make clean</code> to remove all created files.</p>
</body>
</html>
......@@ -5,11 +5,13 @@
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>README</title>
<style type="text/css">
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
</style>
<link rel="stylesheet" href="pandoc/github.css" />
<!--[if lt IE 9]>
......@@ -22,9 +24,9 @@
<p>The repository is self-contained and requires Java and CMAKE to be installed with optional dependencies on Python3 (for visualizing traces) and R (for benchmark analysis and plotting).</p>
<p>Check the sub-folder README.md files for further instructions. All README.md files are pre-rendered as HTML for convenience. In each directory (including this one), the readme.html file corresponds to a rendered README.md.</p>
<ol type="1">
<li><a href="platoon" class="uri">platoon</a> contains the main platoon case study model and executions to execute and simulate it.</li>
<li><a href="plot" class="uri">plot</a> contains data for the performance analysis as well as the R scripts used to process and plot it.</li>
<li><a href="tools" class="uri">tools</a> contains the tools needed to run DR-BIP and view traces.</li>
<li><a href="platoon">platoon</a> contains the main platoon case study model and executions to execute and simulate it.</li>
<li><a href="plot">plot</a> contains data for the performance analysis as well as the R scripts used to process and plot it.</li>
<li><a href="tools">tools</a> contains the tools needed to run DR-BIP and view traces.</li>
</ol>
<blockquote>
<p>The artifact is intended to be run on Linux systems. However the tools should work on most systems, check Makefile and adapt scripts accordingly.</p>
......
......@@ -8,6 +8,5 @@ if [ -z "${BIP2_HOME}" ]; then
BIP2_HOME=${DRBIP_HOME}/../bipc
fi
java -cp "${DRBIP_HOME}/lib/*:${BIP2_HOME}/lib/*:${DRBIP_HOME}/drbip-core-0.0.1.jar" \
java -cp "${DRBIP_HOME}/lib/*:${BIP2_HOME}/lib/*:${DRBIP_HOME}/drbip-core-0.0.2.jar" \
ujf.verimag.drbip.Loader $*
......@@ -16,14 +16,14 @@ namespace reconfigure {
clock_t drbipbegin, drbipend;
int maxexec = 0;
#ifdef PERFMODE
unsigned int max_motifs = 0;
unsigned int max_components = 0;
unsigned int max_conditions = 0;
#endif
void snapshot() {
void snapshotDRBIP() {
for(auto motif = motifs.begin(); motif != motifs.end(); ++motif) {
cout << "<TRACE> <DRBIP> snapshot motif ";
(*motif)->tracename(cout);
......@@ -31,14 +31,13 @@ namespace reconfigure {
(*motif)->tracestate(cout);
cout << endl;
}
snapshotBIP();
}
void loop() {
bool updated = true;
#ifndef PERFMODE
snapshot();
snapshotBIP("BIP");
#endif
//Reconfigure Fixpoint
......@@ -84,7 +83,8 @@ namespace reconfigure {
(*imr)->addTriggers();
#ifndef PERFMODE
snapshot();
snapshotDRBIP();
snapshotBIP("DRBIP");
#endif
//Increment number of reconfiguration steps
bipscheduler::TRACE_SID = (bipscheduler::TRACE_SID + 1) % INT_MAX;
......@@ -96,12 +96,13 @@ namespace reconfigure {
#ifndef PERFMODE
cout << "<TRACE> <DRBIP> init begin" << endl;
cout << "<TRACE> <DRBIP> init begin " << PACK_NAME << endl;
#endif
//cout << "[DRBIP] Init : Applying initializer rule" << endl;
initializer();
#ifndef PERFMODE
snapshot();
snapshotDRBIP();
snapshotBIP("DRBIP");
#endif
//cout << "[DRBIP] Init : Reconfiguring" << endl;
loop();
......@@ -137,25 +138,25 @@ namespace reconfigure {
cout << " " << (*niter);
cout << endl;
#endif
#ifdef PERFMODE
drbipbegin = clock();
#endif
loop();
#ifdef PERFMODE
drbipend = clock();
time_drbip += (double)(drbipend - drbipbegin) / CLOCKS_PER_SEC;
if(motifs.size() > max_motifs) max_motifs = motifs.size();
if(root->components.size() > max_components) max_components = root->components.size();
unsigned int cond = 0;
for(auto topcond = root->conditions.begin(); topcond != root->conditions.end(); ++topcond)
cond += (*topcond)->conditions.size();
if(cond > max_conditions) max_conditions = cond;
#endif
//dumpConditions();
......@@ -168,24 +169,24 @@ namespace reconfigure {
// Go back to evaluate conditions
return SKIP_CYCLE;
}
void complete() {
#ifdef PERFMODE
cout << "drbip-time: " << fixed
<< time_drbip << setprecision(5);
cout << " sec" << endl;
cout << "drbip-time: " << fixed
<< time_drbip << setprecision(5);
cout << " sec" << endl;
cout << "drbip-phases: " << bipscheduler::TRACE_SID - 1 << endl;
cout << "drbip-imr: " << nrules_imr << endl;
cout << "drbip-rr: " << nrules_rr << endl;
cout << "drbip-ir: " << nrules_ir << endl;
cout << "drbip-create-comps: " << nobj_create_atoms << endl;
cout << "drbip-destroy-comps: " << nobj_destroy_atoms << endl;
cout << "drbip-create-motifs: " << nobj_create_motifs << endl;
cout << "drbip-destroy-motifs: " << nobj_destroy_motifs << endl;
cout << "drbip-max-motifs: " << max_motifs << endl;
cout << "drbip-max-comps: " << max_components << endl;
cout << "drbip-max-conditions: " << max_conditions << endl;
......
......@@ -204,9 +204,9 @@ namespace reconfigure {
connectors->clear();
}
void snapshotBIP() {
void snapshotBIP(char * prefix) {
for(auto iter = root->components.begin(); iter != root->components.end(); ++iter) {
cout << "<TRACE> <BIP> snapshot component ";
cout << "<TRACE> <" << prefix << "> snapshot component ";
(*iter)->tracename(cout);
cout << " { ";
(*iter)->dumpState(cout);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment