Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[s4u] XML deployment example
authorGabriel Corona <gabriel.corona@loria.fr>
Fri, 1 Jul 2016 13:18:37 +0000 (15:18 +0200)
committerGabriel Corona <gabriel.corona@loria.fr>
Fri, 1 Jul 2016 13:18:52 +0000 (15:18 +0200)
examples/s4u/CMakeLists.txt
examples/s4u/basic/deployment.xml [new file with mode: 0644]
examples/s4u/basic/s4u_basic.tesh
examples/s4u/basic/s4u_basic_deployment.cpp [new file with mode: 0644]

index bd0ad11..8255bbd 100644 (file)
@@ -11,7 +11,14 @@ add_executable       (s4u_basic_function  basic/s4u_basic_function.cpp)
 target_link_libraries(s4u_basic_function  simgrid)
 set_target_properties(s4u_basic_function  PROPERTIES RUNTIME_OUTPUT_DIRECTORY
  ${CMAKE_CURRENT_BINARY_DIR}/basic)
+
+add_executable       (s4u_basic_deployment  basic/s4u_basic_deployment.cpp)
+target_link_libraries(s4u_basic_deployment  simgrid)
+set_target_properties(s4u_basic_deployment  PROPERTIES RUNTIME_OUTPUT_DIRECTORY
+ ${CMAKE_CURRENT_BINARY_DIR}/basic)
+
 set(examples_src  ${examples_src}  ${CMAKE_CURRENT_SOURCE_DIR}/basic/s4u_basic_function.cpp
+                                   ${CMAKE_CURRENT_SOURCE_DIR}/basic/s4u_basic_deployment.cpp
                                    ${CMAKE_CURRENT_SOURCE_DIR}/basic/s4u_basic.h)
 
 set(examples_src  ${examples_src}                                     PARENT_SCOPE)
diff --git a/examples/s4u/basic/deployment.xml b/examples/s4u/basic/deployment.xml
new file mode 100644 (file)
index 0000000..4004253
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid/simgrid.dtd">
+<platform version="4">
+  <process host="Tremblay" function="worker">
+  </process>
+  <process host="Jupiter" function="master">
+  </process>
+</platform>
index 627fb9d..9370b2e 100644 (file)
@@ -13,3 +13,10 @@ $ $SG_TEST_EXENV ${bindir:=.}/s4u_basic_function
 > [Tremblay:worker:(0) 0.001301] [s4u_test/INFO] I received 'GaBuZoMeu'
 > [Tremblay:worker:(0) 0.001301] [s4u_test/INFO] I'm done. See you.
 > [Jupiter:master:(0) 0.001301] [s4u_test/INFO] I'm done. See you.
+
+$ $SG_TEST_EXENV ${bindir:=.}/s4u_basic_deployment deployment.xml
+> [Tremblay:worker:(0) 0.000000] [s4u_test/INFO] Hello s4u, I'm ready to serve
+> [Jupiter:master:(0) 0.000000] [s4u_test/INFO] Hello s4u, I have something to send
+> [Tremblay:worker:(0) 0.001301] [s4u_test/INFO] I received 'GaBuZoMeu'
+> [Tremblay:worker:(0) 0.001301] [s4u_test/INFO] I'm done. See you.
+> [Jupiter:master:(0) 0.001301] [s4u_test/INFO] I'm done. See you.
diff --git a/examples/s4u/basic/s4u_basic_deployment.cpp b/examples/s4u/basic/s4u_basic_deployment.cpp
new file mode 100644 (file)
index 0000000..f40b9aa
--- /dev/null
@@ -0,0 +1,23 @@
+/* Copyright (c) 2006-2016. 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 <string>
+#include <vector>
+
+#include <xbt/sysdep.h>
+
+#include <simgrid/s4u.h>
+
+#include "s4u_basic.h"
+
+int main(int argc, char **argv) {
+  simgrid::s4u::Engine *e = new simgrid::s4u::Engine(&argc,argv);
+  e->loadPlatform("../../platforms/two_hosts.xml");
+  e->registerFunction<Worker>("worker");
+  e->registerFunction<Master>("master");
+  e->loadDeployment(argv[1]);
+  e->run();
+  return 0;
+}