aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2021-05-14 10:25:51 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2021-05-14 10:25:51 +0200
commitc757315893fdf5d951d4cad12775ee60a2de141f (patch)
treeea3b2833c8752802ed599e369f3986ee45e3f258 /src
parent9365501740d04d7b8251ef73046f013f5bcf9f76 (diff)
Debug network model
Diffstat (limited to 'src')
-rw-r--r--src/Inputs.cc14
-rw-r--r--src/Inputs.hpp1
-rw-r--r--src/scenarios.cc6
-rw-r--r--src/simulator.cc25
4 files changed, 30 insertions, 16 deletions
diff --git a/src/Inputs.cc b/src/Inputs.cc
index 9220e36..8c3ac9c 100644
--- a/src/Inputs.cc
+++ b/src/Inputs.cc
@@ -20,6 +20,7 @@ Inputs::Inputs(std::string node_name){
seed=d["seed"].GetInt();
hint_size=d["hint_size"].GetInt();
n_nodes=d["nodes"].MemberCount();
+ latency=d["latency"].GetDouble();
// Instantiate wake_ts
for(auto& v:d["nodes"][node_name.c_str()]["wake_ts"].GetArray()){
@@ -155,8 +156,8 @@ void Inputs::GeneratePlatform(std::string p){
pf.open (p);
pf << "<?xml version='1.0'?>\n";
pf << "<!DOCTYPE platform SYSTEM \"http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd\">\n";
- pf << "<platform version=\"4.1\">\n <AS id=\"AS0\" routing=\"Cluster\">\n";
- pf << " <link id=\"link\" bandwidth=\""<<d["bitrate"].GetString()<<"\" latency=\""<<d["latency"].GetString()<<"\" sharing_policy=\"SHARED\"></link>\n";
+ pf << "<platform version=\"4.1\">\n <AS id=\"AS0\" routing=\"Full\">\n";
+ pf << " <link id=\"link\" bandwidth=\""<<d["bitrate"].GetString()<<"\" latency=\"0ms\" sharing_policy=\"SHARED\"></link>\n";
for (Value::ConstMemberIterator itr = d["nodes"].MemberBegin(); itr != d["nodes"].MemberEnd(); ++itr)
{
std::string name=itr->name.GetString();
@@ -169,7 +170,14 @@ void Inputs::GeneratePlatform(std::string p){
pf << " <host id=\""<<name<<"\" speed=\"100.0f,100.0f,100.0f,100.0f\" pstate=\"0\">\n";
pf << " <prop id=\"wattage_per_state\" value=\""<< power_off<<":"<<power_off<<", "<< power_on<<":"<<power_on<<", "<<power_rx<<":"<<power_rx<<", "<<power_tx<<":"<<power_tx<<"\" />\n";
pf << " <prop id=\"wattage_off\" value=\"0\" />\n </host>\n";
- pf << " <host_link id=\""<<name<<"\" up=\"link\" down=\"link\"/>\n";
+ }
+ for (Value::ConstMemberIterator src = d["nodes"].MemberBegin(); src != d["nodes"].MemberEnd(); ++src)
+ {
+ for (Value::ConstMemberIterator dst = d["nodes"].MemberBegin(); dst != d["nodes"].MemberEnd(); ++dst)
+ {
+ if(src->name.GetString() != dst->name.GetString())
+ pf << " <route src=\""<<src->name.GetString()<<"\" dst=\""<<dst->name.GetString()<<"\" symmetrical=\"no\"><link_ctn id=\"link\"/></route>\n";
+ }
}
pf << " </AS>\n</platform>\n";
pf.close();
diff --git a/src/Inputs.hpp b/src/Inputs.hpp
index 34f75b6..487686f 100644
--- a/src/Inputs.hpp
+++ b/src/Inputs.hpp
@@ -80,4 +80,5 @@ public:
int hint_size;
int seed;
int n_nodes;
+ double latency;
}; \ No newline at end of file
diff --git a/src/scenarios.cc b/src/scenarios.cc
index 2c839d1..140696c 100644
--- a/src/scenarios.cc
+++ b/src/scenarios.cc
@@ -40,7 +40,7 @@ int main(int argc, char **argv){
unsigned int datasize=atoi(argv[12]);
string bitrate(argv[13]);
unsigned int hintsize=atoi(argv[14]);
- string latency(argv[15]);
+ double latency=stod(argv[15]);
// Setup seed
@@ -53,9 +53,7 @@ int main(int argc, char **argv){
Value bitrateValue;
bitrateValue.SetString(bitrate.c_str(),bitrate.size(),d.GetAllocator());
d.AddMember("bitrate",bitrateValue,d.GetAllocator());
- Value latencyValue;
- latencyValue.SetString(latency.c_str(),latency.size(),d.GetAllocator());
- d.AddMember("latency",latencyValue,d.GetAllocator());
+ d.AddMember("latency",latency,d.GetAllocator());
d.AddMember("extended",extended,d.GetAllocator());
d.AddMember("hint_size",hintsize,d.GetAllocator());
diff --git a/src/simulator.cc b/src/simulator.cc
index d27de1b..9322a2b 100644
--- a/src/simulator.cc
+++ b/src/simulator.cc
@@ -24,7 +24,14 @@
uptimeTrack=CLOCK-uptimeTrack; \
uptime-=uptimeTrack; \
uptime=uptime > 0 ? uptime : 0; \
- }
+ }
+/// @brief Note that we need to simulate latency our self since we need to send instantaneous messages
+#define SEND(instruction) \
+ { \
+ simgrid::s4u::this_actor::sleep_for(i.latency); \
+ instruction; \
+ }
+
/// @brief Required by SimGrid
XBT_LOG_NEW_DEFAULT_CATEGORY(simulator, "[DAO] Loosely Coupled DSS");
@@ -123,25 +130,26 @@ static void obs_node(std::vector<std::string> args) {
p->duration=i.GetNextDuration();
p->hint=i.GetNextTS();
}
- MODE_ON();
try {
// First we send and instantaneous message
// This allow first to detect if their is a receiver
// (to not cause deadlock for the extended mode) and second
// to inform the receiver if he should get a hint first
+ MODE_TX();
TRACK_UPTIME(m->put(p,0,uptime));
simgrid::s4u::Mailbox *m_ded= simgrid::s4u::Mailbox::by_name(p->DedicatedMailbox);
// First send hint if it is required
- MODE_TX();
if(p->HasHint){
- TRACK_UPTIME(m_ded->put(p,i.hint_size,uptime));
+ TRACK_UPTIME(SEND(m_ded->put(p,i.hint_size,uptime)));
XBT_INFO("%s sent a hint successfully",CNAME);
}
// Then try sending the data
- if(i.extended)
- m_ded->put(p,i.data_size);
- else
- m_ded->put(p,i.data_size,uptime);
+ if(i.extended){
+ SEND(m_ded->put(p,i.data_size));
+ }
+ else{
+ SEND(m_ded->put(p,i.data_size,uptime));
+ }
// If we reach here, data has been sent successfully
XBT_INFO("%s sent data successfully",CNAME);
nSend++;
@@ -157,7 +165,6 @@ static void obs_node(std::vector<std::string> args) {
Payload *p; // Received data
Payload *hint; // To Save the received hint
bool hintReceived=false; // In case of error during data rx this will be use to check if we could use the *hint Payload object
- MODE_ON();
try {
// Get the instantaneous message
TRACK_UPTIME(p=m->get<Payload>(uptime));