Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add an example of speed profile in the platform
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Fri, 8 Feb 2019 10:55:17 +0000 (11:55 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Fri, 8 Feb 2019 11:11:18 +0000 (12:11 +0100)
examples/platforms/small_platform_profile.xml [new file with mode: 0644]
examples/platforms/trace/jupiter_speed.trace
examples/platforms/trace/link1_avail.trace [deleted file]
examples/platforms/trace/link1_bandwidth.trace [new file with mode: 0644]
examples/platforms/trace/link1_latency.trace [new file with mode: 0644]
examples/s4u/CMakeLists.txt
examples/s4u/README.rst
examples/s4u/platform-profile/s4u-platform-profile.cpp [new file with mode: 0644]
examples/s4u/platform-profile/s4u-platform-profile.tesh [new file with mode: 0644]
tools/cmake/DefinePackages.cmake

diff --git a/examples/platforms/small_platform_profile.xml b/examples/platforms/small_platform_profile.xml
new file mode 100644 (file)
index 0000000..efabd6f
--- /dev/null
@@ -0,0 +1,70 @@
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "https://simgrid.org/simgrid.dtd">
+<platform version="4.1">
+  <zone  id="AS0"  routing="Full">
+    <host id="Tremblay" speed="25Mf"/>
+    <host id="Jupiter"  speed="25Mf" availability_file="trace/jupiter_speed.trace" />
+    <host id="Fafard"   speed="25Mf"/>
+    <host id="Ginette"  speed="25Mf"/>
+    <host id="Bourassa" speed="25Mf"/>
+
+    <link id="1" bandwidth="1MBps" latency="10ms" bandwidth_file="trace/link1_bandwidth.trace" latency_file="trace/link1_latency.trace" />
+    <link id="2" bandwidth="1MBps" latency="10ms"/>
+    <link id="3" bandwidth="1MBps" latency="10ms"/>
+    <link id="4" bandwidth="1MBps" latency="10ms"/>
+    <link id="5" bandwidth="1MBps" latency="10ms"/>
+    <link id="6" bandwidth="1MBps" latency="10ms"/>
+    <link id="7" bandwidth="1MBps" latency="10ms"/>
+    <link id="8" bandwidth="1MBps" latency="10ms"/>
+    <link id="9" bandwidth="1MBps" latency="10ms"/>
+    <link id="10" bandwidth="1MBps" latency="10ms"/>
+    <link id="loopback_FATPIPE" bandwidth="10MBps" latency="0" sharing_policy="FATPIPE"/>
+    <link id="loopback" bandwidth="100MBps" latency="0"/>
+
+    <route src="Tremblay" dst="Tremblay">
+      <link_ctn id="loopback"/>
+    </route>
+    <route src="Jupiter" dst="Jupiter">
+      <link_ctn id="loopback"/>
+    </route>
+    <route src="Fafard" dst="Fafard">
+      <link_ctn id="loopback"/>
+    </route>
+    <route src="Ginette" dst="Ginette">
+      <link_ctn id="loopback"/>
+    </route>
+    <route src="Bourassa" dst="Bourassa">
+      <link_ctn id="loopback"/>
+    </route>
+    <route src="Tremblay" dst="Jupiter">
+      <link_ctn id="1"/>
+    </route>
+    <route src="Tremblay" dst="Fafard">
+      <link_ctn id="2"/>
+    </route>
+    <route src="Tremblay" dst="Ginette">
+      <link_ctn id="3"/>
+    </route>
+    <route src="Tremblay" dst="Bourassa">
+      <link_ctn id="4"/>
+    </route>
+    <route src="Jupiter" dst="Fafard">
+      <link_ctn id="5"/>
+    </route>
+    <route src="Jupiter" dst="Ginette">
+      <link_ctn id="6"/>
+    </route>
+    <route src="Jupiter" dst="Bourassa">
+      <link_ctn id="7"/>
+    </route>
+    <route src="Fafard" dst="Ginette">
+      <link_ctn id="8"/>
+    </route>
+    <route src="Fafard" dst="Bourassa">
+      <link_ctn id="9"/>
+    </route>
+    <route src="Ginette" dst="Bourassa">
+      <link_ctn id="10"/>
+    </route>
+  </zone>
+</platform>
index 33719c8..4b0a723 100644 (file)
@@ -1,2 +1,6 @@
 0 0.5
 0 0.5
-2 1.0
\ No newline at end of file
+2 1.0
+4 0.7
+6 0.1
+8 4
+LOOPAFTER 10
\ No newline at end of file
diff --git a/examples/platforms/trace/link1_avail.trace b/examples/platforms/trace/link1_avail.trace
deleted file mode 100644 (file)
index fd47a86..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-2 62500000
-4 31250000
-LOOPAFTER 6
diff --git a/examples/platforms/trace/link1_bandwidth.trace b/examples/platforms/trace/link1_bandwidth.trace
new file mode 100644 (file)
index 0000000..46b3c52
--- /dev/null
@@ -0,0 +1,3 @@
+2 2000000
+4 3000000
+LOOPAFTER 6
diff --git a/examples/platforms/trace/link1_latency.trace b/examples/platforms/trace/link1_latency.trace
new file mode 100644 (file)
index 0000000..c56791b
--- /dev/null
@@ -0,0 +1,3 @@
+1 0.003
+3 0.015
+LOOPAFTER 6
index 6b476fa..ec13f74 100644 (file)
@@ -11,7 +11,8 @@ foreach (example actor-create actor-daemon actor-exiting actor-join actor-kill
                  engine-filtering
                  exec-async exec-basic exec-dvfs exec-monitor exec-ptask exec-remote
                  io-async io-file-system io-file-remote io-storage-raw
                  engine-filtering
                  exec-async exec-basic exec-dvfs exec-monitor exec-ptask exec-remote
                  io-async io-file-system io-file-remote io-storage-raw
-                 platform-failures platform-properties plugin-hostload 
+                 platform-failures platform-profile platform-properties
+                 plugin-hostload
                  replay-comm replay-storage
                  routing-get-clusters
                  synchro-barrier synchro-mutex synchro-semaphore)
                  replay-comm replay-storage
                  routing-get-clusters
                  synchro-barrier synchro-mutex synchro-semaphore)
index a01e332..e8378dc 100644 (file)
@@ -281,6 +281,19 @@ Interacting with the Platform
    |br| `examples/s4u/platform-properties/s4u-platform-properties_d.xml <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/platform-properties/s4u-platform-properties_d.xml>`_
    |br| `examples/platforms/prop.xml <https://framagit.org/simgrid/simgrid/tree/master/examples/platforms/prop.xml>`_
 
    |br| `examples/s4u/platform-properties/s4u-platform-properties_d.xml <https://framagit.org/simgrid/simgrid/tree/master/examples/s4u/platform-properties/s4u-platform-properties_d.xml>`_
    |br| `examples/platforms/prop.xml <https://framagit.org/simgrid/simgrid/tree/master/examples/platforms/prop.xml>`_
 
+ - **Specifying state profiles:** shows how to specify when the
+   resources must be turned off and on again, and how to react to such
+   failures in your code.
+   
+   |br| `examples/platforms/small_platform_with_failure.xml <https://framagit.org/simgrid/simgrid/tree/master/examples/platforms/small_platform_with_failure.xml>`_
+   |br| The state profiles in `examples/platforms/trace <https://framagit.org/simgrid/simgrid/tree/master/examples/platforms/trace>`_
+
+ - **Specifying speed profiles:** shows how to specify an external
+   load to resources, variating their peak speed over time.
+   
+   |br| `examples/platforms/small_platform_profile.xml <https://framagit.org/simgrid/simgrid/tree/master/examples/platforms/small_platform_profile.xml>`_
+   |br| The speed, bandwidth and latency profiles in `examples/platforms/trace <https://framagit.org/simgrid/simgrid/tree/master/examples/platforms/trace>`_
+
 =================
 Energy Simulation
 =================
 =================
 Energy Simulation
 =================
diff --git a/examples/s4u/platform-profile/s4u-platform-profile.cpp b/examples/s4u/platform-profile/s4u-platform-profile.cpp
new file mode 100644 (file)
index 0000000..0da24ff
--- /dev/null
@@ -0,0 +1,45 @@
+/* Copyright (c) 2017-2019. The SimGrid Team. All rights reserved.          */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include "simgrid/s4u.hpp"
+
+/* This example demonstrates how to attach a profile to an host or a link,
+ * to specify external changes to the resource speed. The first way to do
+ * so is to use a file in the XML, while the second is to use the programmatic interface.
+ */
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_platform_profile, "Messages specific for this s4u example");
+
+/* Main function of the Yielder process */
+static void watcher()
+{
+  simgrid::s4u::Host* jupiter = simgrid::s4u::Host::by_name("Jupiter");
+  simgrid::s4u::Host* fafard  = simgrid::s4u::Host::by_name("Fafard");
+  simgrid::s4u::Link* link1   = simgrid::s4u::Link::by_name("1");
+  simgrid::s4u::Link* link2   = simgrid::s4u::Link::by_name("2");
+
+  for (int i = 0; i < 10; i++) {
+    XBT_INFO("Fafard: %.0fGflops, Jupiter: % 3.0fGflops, Link1: (%.2fMB/s %.0fms), Link2: (%.2fMB/s %.0fms)",
+             fafard->get_speed() * fafard->get_available_speed() / 1000000,
+             jupiter->get_speed() * jupiter->get_available_speed() / 1000000, link1->get_bandwidth() / 1000,
+             link1->get_latency() * 1000, link2->get_bandwidth() / 1000, link2->get_latency() * 1000);
+    simgrid::s4u::this_actor::sleep_for(1);
+  }
+};
+
+int main(int argc, char* argv[])
+{
+  simgrid::s4u::Engine e(&argc, argv);
+
+  xbt_assert(argc > 1, "Usage: %s platform_file\n\tExample: %s platform.xml deployment.xml\n", argv[0], argv[0]);
+
+  e.load_platform(argv[1]);
+
+  simgrid::s4u::Actor::create("watcher", simgrid::s4u::Host::by_name("Tremblay"), watcher);
+
+  e.run(); /* - Run the simulation */
+
+  return 0;
+}
diff --git a/examples/s4u/platform-profile/s4u-platform-profile.tesh b/examples/s4u/platform-profile/s4u-platform-profile.tesh
new file mode 100644 (file)
index 0000000..11b0d00
--- /dev/null
@@ -0,0 +1,13 @@
+#!/usr/bin/env tesh
+
+$ $SG_TEST_EXENV ${bindir:=.}/s4u-platform-profile ${platfdir}/small_platform_profile.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+> [  0.000000] (1:watcher@Tremblay) Fafard: 25Gflops, Jupiter:  12Gflops, Link1: (1000.00MB/s 10ms), Link2: (1000.00MB/s 10ms)
+> [  1.000000] (1:watcher@Tremblay) Fafard: 25Gflops, Jupiter:  12Gflops, Link1: (1000.00MB/s 3ms), Link2: (1000.00MB/s 10ms)
+> [  2.000000] (1:watcher@Tremblay) Fafard: 25Gflops, Jupiter:  25Gflops, Link1: (2000.00MB/s 3ms), Link2: (1000.00MB/s 10ms)
+> [  3.000000] (1:watcher@Tremblay) Fafard: 25Gflops, Jupiter:  25Gflops, Link1: (2000.00MB/s 15ms), Link2: (1000.00MB/s 10ms)
+> [  4.000000] (1:watcher@Tremblay) Fafard: 25Gflops, Jupiter:  18Gflops, Link1: (3000.00MB/s 15ms), Link2: (1000.00MB/s 10ms)
+> [  5.000000] (1:watcher@Tremblay) Fafard: 25Gflops, Jupiter:  18Gflops, Link1: (3000.00MB/s 15ms), Link2: (1000.00MB/s 10ms)
+> [  6.000000] (1:watcher@Tremblay) Fafard: 25Gflops, Jupiter:   2Gflops, Link1: (3000.00MB/s 15ms), Link2: (1000.00MB/s 10ms)
+> [  7.000000] (1:watcher@Tremblay) Fafard: 25Gflops, Jupiter:   2Gflops, Link1: (3000.00MB/s 15ms), Link2: (1000.00MB/s 10ms)
+> [  8.000000] (1:watcher@Tremblay) Fafard: 25Gflops, Jupiter:  100Gflops, Link1: (3000.00MB/s 15ms), Link2: (1000.00MB/s 10ms)
+> [  9.000000] (1:watcher@Tremblay) Fafard: 25Gflops, Jupiter:  100Gflops, Link1: (3000.00MB/s 15ms), Link2: (1000.00MB/s 10ms)
index c6b9e8f..2e41255 100644 (file)
@@ -1115,7 +1115,8 @@ set(PLATFORMS_EXAMPLES
   examples/platforms/trace/ginette_state.trace
   examples/platforms/trace/jupiter_speed.trace
   examples/platforms/trace/jupiter_state.trace
   examples/platforms/trace/ginette_state.trace
   examples/platforms/trace/jupiter_speed.trace
   examples/platforms/trace/jupiter_state.trace
-  examples/platforms/trace/link1_avail.trace
+  examples/platforms/trace/link1_bandwidth.trace
+  examples/platforms/trace/link1_latency.trace
   examples/platforms/trace/link3_state.trace
   examples/platforms/trace/link4_state.trace
   examples/platforms/trace/linkBandwidth7.bw
   examples/platforms/trace/link3_state.trace
   examples/platforms/trace/link4_state.trace
   examples/platforms/trace/linkBandwidth7.bw
@@ -1147,6 +1148,7 @@ set(PLATFORMS_EXAMPLES
   examples/platforms/small_platform_constant.xml
   examples/platforms/small_platform_fatpipe.xml
   examples/platforms/small_platform_one_link_routes.xml
   examples/platforms/small_platform_constant.xml
   examples/platforms/small_platform_fatpipe.xml
   examples/platforms/small_platform_one_link_routes.xml
+  examples/platforms/small_platform_profile.xml
   examples/platforms/small_platform_with_failures.xml
   examples/platforms/small_platform_with_routers.xml
   examples/platforms/syscoord/generate_peer_platform.pl
   examples/platforms/small_platform_with_failures.xml
   examples/platforms/small_platform_with_routers.xml
   examples/platforms/syscoord/generate_peer_platform.pl