Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
convert msg/app-masterworker
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 12 Mar 2020 09:28:58 +0000 (10:28 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 12 Mar 2020 09:28:58 +0000 (10:28 +0100)
13 files changed:
MANIFEST.in
examples/c/CMakeLists.txt
examples/c/app-masterworker/app-masterworker-multicore.tesh [moved from examples/deprecated/msg/app-masterworker/app-masterworker-multicore.tesh with 92% similarity]
examples/c/app-masterworker/app-masterworker-multicore_d.xml [moved from examples/deprecated/msg/app-masterworker/app-masterworker-multicore_d.xml with 100% similarity]
examples/c/app-masterworker/app-masterworker-vivaldi.tesh [moved from examples/deprecated/msg/app-masterworker/app-masterworker-vivaldi.tesh with 91% similarity]
examples/c/app-masterworker/app-masterworker-vivaldi_d.xml [moved from examples/deprecated/msg/app-masterworker/app-masterworker-vivaldi_d.xml with 100% similarity]
examples/c/app-masterworker/app-masterworker.c [new file with mode: 0644]
examples/c/app-masterworker/app-masterworker.tesh [moved from examples/deprecated/msg/app-masterworker/app-masterworker.tesh with 92% similarity]
examples/c/app-masterworker/app-masterworker_d.xml [moved from examples/deprecated/msg/app-masterworker/app-masterworker_d.xml with 100% similarity]
examples/deprecated/msg/CMakeLists.txt
examples/deprecated/msg/app-masterworker/app-masterworker.c [deleted file]
examples/deprecated/msg/trace-link-user-variables/trace-link-user-variables.tesh
examples/deprecated/msg/trace-masterworker/trace-masterworker.tesh

index dcec0f2..2bab98f 100644 (file)
@@ -45,6 +45,13 @@ include examples/c/app-chainsend/broadcaster.c
 include examples/c/app-chainsend/chainsend.c
 include examples/c/app-chainsend/chainsend.h
 include examples/c/app-chainsend/peer.c
+include examples/c/app-masterworker/app-masterworker-multicore.tesh
+include examples/c/app-masterworker/app-masterworker-multicore_d.xml
+include examples/c/app-masterworker/app-masterworker-vivaldi.tesh
+include examples/c/app-masterworker/app-masterworker-vivaldi_d.xml
+include examples/c/app-masterworker/app-masterworker.c
+include examples/c/app-masterworker/app-masterworker.tesh
+include examples/c/app-masterworker/app-masterworker_d.xml
 include examples/c/app-pingpong/app-pingpong.c
 include examples/c/app-pingpong/app-pingpong.tesh
 include examples/c/app-pingpong/app-pingpong_d.xml
@@ -218,13 +225,6 @@ include examples/deprecated/java/trace/pingpong/Receiver.java
 include examples/deprecated/java/trace/pingpong/Sender.java
 include examples/deprecated/java/trace/pingpong/trace-pingpong.tesh
 include examples/deprecated/msg/README.doc
-include examples/deprecated/msg/app-masterworker/app-masterworker-multicore.tesh
-include examples/deprecated/msg/app-masterworker/app-masterworker-multicore_d.xml
-include examples/deprecated/msg/app-masterworker/app-masterworker-vivaldi.tesh
-include examples/deprecated/msg/app-masterworker/app-masterworker-vivaldi_d.xml
-include examples/deprecated/msg/app-masterworker/app-masterworker.c
-include examples/deprecated/msg/app-masterworker/app-masterworker.tesh
-include examples/deprecated/msg/app-masterworker/app-masterworker_d.xml
 include examples/deprecated/msg/dht-kademlia/answer.c
 include examples/deprecated/msg/dht-kademlia/answer.h
 include examples/deprecated/msg/dht-kademlia/common.h
index 78f5ee0..b354060 100644 (file)
@@ -4,7 +4,7 @@
 foreach(x
         actor-create actor-daemon actor-exiting actor-join actor-kill actor-lifetime actor-migrate actor-stacksize
         actor-suspend actor-yield
-        app-pingpong app-token-ring 
+        app-masterworker app-pingpong app-token-ring 
         async-wait async-waitall async-waitany
         cloud-capping cloud-masterworker cloud-migration cloud-simple
         exec-async exec-basic exec-dvfs exec-remote exec-waitany
@@ -41,12 +41,17 @@ set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/app-chainsend/cha
 
 set(teshsuite_src ${teshsuite_src}  PARENT_SCOPE)
 set(tesh_files    ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/app-chainsend/app-chainsend.tesh
+                                ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworker/app-masterworker-multicore.tesh
+                                ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworker/app-masterworker-vivaldi.tesh
                                 PARENT_SCOPE)
 
 set(xml_files     ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/actor-create/actor-create_d.xml
                                ${CMAKE_CURRENT_SOURCE_DIR}/actor-lifetime/actor-lifetime_d.xml
                                ${CMAKE_CURRENT_SOURCE_DIR}/actor-yield/actor-yield_d.xml
                                ${CMAKE_CURRENT_SOURCE_DIR}/app-chainsend/app-chainsend_d.xml
+                               ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworker/app-masterworker_d.xml
+                               ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworker/app-masterworker-multicore_d.xml
+                               ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworker/app-masterworker-vivaldi_d.xml
                                ${CMAKE_CURRENT_SOURCE_DIR}/app-pingpong/app-pingpong_d.xml
                                ${CMAKE_CURRENT_SOURCE_DIR}/async-wait/async-wait_d.xml
                                ${CMAKE_CURRENT_SOURCE_DIR}/async-wait/async-wait2_d.xml
@@ -61,7 +66,7 @@ set(xml_files     ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/actor-create/actor-cr
 foreach(x
         actor-create actor-daemon actor-exiting actor-join actor-kill actor-lifetime actor-migrate actor-stacksize
         actor-suspend actor-yield
-        app-chainsend app-pingpong app-token-ring
+        app-chainsend app-masterworker app-pingpong app-token-ring
         async-wait async-waitall async-waitany
         cloud-capping  cloud-masterworker cloud-migration cloud-simple
         exec-async exec-basic exec-dvfs exec-remote exec-waitany
@@ -74,3 +79,14 @@ foreach(x
                   --cd ${CMAKE_HOME_DIRECTORY}/examples/c/${x}
                   ${CMAKE_HOME_DIRECTORY}/examples/c/${x}/${x}.tesh)
 endforeach()
+
+ADD_TESH_FACTORIES(app-masterworker-multicore   "thread;ucontext;raw;boost" 
+                                                --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/c/app-masterworker 
+                                                --setenv bindir=${CMAKE_BINARY_DIR}/examples/c/app-masterworker
+                                                --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
+                                               ${CMAKE_HOME_DIRECTORY}/examples/c/app-masterworker/app-masterworker-multicore.tesh)
+ADD_TESH_FACTORIES(app-masterworker-vivaldi     "thread;ucontext;raw;boost" 
+                                                --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/c/app-masterworker 
+                                                --setenv bindir=${CMAKE_BINARY_DIR}/examples/c/app-masterworker
+                                                --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
+                                                ${CMAKE_HOME_DIRECTORY}/examples/c/app-masterworker/app-masterworker-vivaldi.tesh)
@@ -2,7 +2,7 @@
 
 p Testing a simple master/worker example application
 
-$ ./app-masterworker/app-masterworker ${platfdir}/multicore_machine.xml ${srcdir}/app-masterworker-multicore_d.xml --cfg=cpu/model:Cas01 --cfg=cpu/optim:Full "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ./app-masterworker/app-masterworker-c ${platfdir}/multicore_machine.xml ${srcdir:=.}/app-masterworker-multicore_d.xml --cfg=cpu/model:Cas01 --cfg=cpu/optim:Full "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
 > [  0.000000] (0:maestro@) Configuration change: Set 'cpu/model' to 'Cas01'
 > [  0.000000] (0:maestro@) Configuration change: Set 'cpu/optim' to 'Full'
 > [  0.000000] (1:master@Tremblay) Got 6 workers and 20 tasks to process
@@ -2,7 +2,7 @@
 
 p Testing a simple master/worker example application
 
-$ ${bindir}/app-masterworker  ${platfdir}/vivaldi.xml ${srcdir}/app-masterworker-vivaldi_d.xml --cfg=network/latency-factor:1.0 --cfg=network/bandwidth-factor:1.0 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir}/app-masterworker-c  ${platfdir}/vivaldi.xml ${srcdir:=.}/app-masterworker-vivaldi_d.xml --cfg=network/latency-factor:1.0 --cfg=network/bandwidth-factor:1.0 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
 > [  0.000000] (0:maestro@) Configuration change: Set 'network/latency-factor' to '1.0'
 > [  0.000000] (0:maestro@) Configuration change: Set 'network/bandwidth-factor' to '1.0'
 > [  0.000000] (1:master@100030591) Got 15 workers and 10 tasks to process
diff --git a/examples/c/app-masterworker/app-masterworker.c b/examples/c/app-masterworker/app-masterworker.c
new file mode 100644 (file)
index 0000000..35b2c75
--- /dev/null
@@ -0,0 +1,102 @@
+/* Copyright (c) 2010-2020. 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/actor.h"
+#include "simgrid/engine.h"
+#include "simgrid/forward.h"
+#include "simgrid/mailbox.h"
+#include "xbt/asserts.h"
+#include "xbt/log.h"
+#include "xbt/str.h"
+
+#define FINALIZE 221297 /* a magic number to tell people to stop working */
+
+#include <stdio.h> /* snprintf */
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(app_masterworker, "Messages specific for this example");
+
+/* Main function of the master process */
+static void master(int argc, char* argv[])
+{
+  xbt_assert(argc == 5, "The master function expects 4 arguments from the XML deployment file");
+  long number_of_tasks = xbt_str_parse_int(argv[1], "Invalid amount of tasks: %s");       /* - Number of tasks      */
+  double comp_size     = xbt_str_parse_double(argv[2], "Invalid computational size: %s"); /* - Compute cost    */
+  double comm_size     = xbt_str_parse_double(argv[3], "Invalid communication size: %s"); /* - Communication size */
+  long workers_count   = xbt_str_parse_int(argv[4], "Invalid amount of workers: %s");     /* - Number of workers    */
+
+  XBT_INFO("Got %ld workers and %ld tasks to process", workers_count, number_of_tasks);
+
+  for (int i = 0; i < number_of_tasks; i++) { /* For each task to be executed: */
+    char mailbox_name[80];
+    char task_name[80];
+    double* payload = (double*)malloc(sizeof(double));
+    snprintf(mailbox_name, 79, "worker-%ld", i % workers_count); /* - Select a @ref worker in a round-robin way */
+    snprintf(task_name, 79, "Task_%d", i);
+
+    sg_mailbox_t mailbox = sg_mailbox_by_name(mailbox_name);
+    *payload             = comp_size;
+
+    if (number_of_tasks < 10000 || i % 10000 == 0)
+      XBT_INFO("Sending \"%s\" (of %ld) to mailbox \"%s\"", task_name, number_of_tasks, mailbox_name);
+
+    sg_mailbox_put(mailbox, payload, comm_size); /* - Send the amount of flops to compute to the @ref worker */
+  }
+
+  XBT_INFO("All tasks have been dispatched. Let's tell everybody the computation is over.");
+  for (int i = 0; i < workers_count; i++) { /* - Eventually tell all the workers to stop by sending a "finalize" task */
+    char mailbox_name[80];
+    snprintf(mailbox_name, 79, "worker-%ld", i % workers_count);
+    double* payload      = (double*)malloc(sizeof(double));
+    sg_mailbox_t mailbox = sg_mailbox_by_name(mailbox_name);
+    *payload             = FINALIZE;
+    sg_mailbox_put(mailbox, payload, 0);
+  }
+}
+
+/* Main functions of the Worker processes */
+static void worker(int argc, char* argv[])
+{
+  xbt_assert(argc == 2,
+             "The worker expects a single argument from the XML deployment file: its worker ID (its numerical rank)");
+  char mailbox_name[80];
+
+  long id = xbt_str_parse_int(argv[1], "Invalid argument %s");
+
+  snprintf(mailbox_name, 79, "worker-%ld", id);
+  sg_mailbox_t mailbox = sg_mailbox_by_name(mailbox_name);
+
+  while (1) { /* The worker wait in an infinite loop for tasks sent by the @ref master */
+    double* payload = (double*)sg_mailbox_get(mailbox);
+
+    if (*payload == FINALIZE) {
+      free(payload); /* - Exit if 'finalize' is received */
+      break;
+    }
+    sg_actor_execute(*payload); /*  - Otherwise, process the received number of flops*/
+    free(payload);
+  }
+  XBT_INFO("I'm done. See you!");
+}
+
+int main(int argc, char* argv[])
+{
+  simgrid_init(&argc, argv);
+  xbt_assert(argc > 2,
+             "Usage: %s platform_file deployment_file\n"
+             "\tExample: %s msg_platform.xml msg_deployment.xml\n",
+             argv[0], argv[0]);
+
+  simgrid_load_platform(argv[1]); /* - Load the platform description */
+
+  simgrid_register_function("master", master); /* - Register the function to be executed by the processes */
+  simgrid_register_function("worker", worker);
+  simgrid_load_deployment(argv[2]); /* - Deploy the application */
+
+  simgrid_run(); /* - Run the simulation */
+
+  XBT_INFO("Simulation time %g", simgrid_get_clock());
+
+  return 0;
+}
@@ -3,7 +3,7 @@
 p Testing a simple master/worker example application (mailbox version)
 
 ! output sort 19
-$ ${bindir:=.}/app-masterworker ${platfdir}/small_platform_with_routers.xml ${srcdir}/app-masterworker_d.xml --cfg=network/crosstraffic:0 --trace "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/app-masterworker-c ${platfdir}/small_platform_with_routers.xml ${srcdir:=.}/app-masterworker_d.xml --cfg=network/crosstraffic:0 --trace "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
 > [  0.000000] (0:maestro@) Configuration change: Set 'network/crosstraffic' to '0'
 > [  0.000000] (1:master@Tremblay) Got 5 workers and 20 tasks to process
 > [  0.000000] (1:master@Tremblay) Sending "Task_0" (of 20) to mailbox "worker-0"
@@ -34,7 +34,7 @@ $ ${bindir:=.}/app-masterworker ${platfdir}/small_platform_with_routers.xml ${sr
 > [  5.094868] (0:maestro@) Simulation time 5.09487
 > [  5.094868] (6:worker@Bourassa) I'm done. See you!
 
-$ ${bindir:=.}/app-masterworker ${platfdir}/small_platform_with_routers.xml ${srcdir}/app-masterworker_d.xml --trace "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ ${bindir:=.}/app-masterworker-c ${platfdir}/small_platform_with_routers.xml ${srcdir:=.}/app-masterworker_d.xml --trace "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
 > [  0.000000] (1:master@Tremblay) Got 5 workers and 20 tasks to process
 > [  0.000000] (1:master@Tremblay) Sending "Task_0" (of 20) to mailbox "worker-0"
 > [  0.002265] (1:master@Tremblay) Sending "Task_1" (of 20) to mailbox "worker-1"
index 90078d8..bd59723 100644 (file)
@@ -1,6 +1,5 @@
 # C examples
-foreach(x app-masterworker
-          dht-pastry
+foreach(x dht-pastry
           synchro-semaphore trace-categories 
           trace-route-user-variables trace-link-user-variables trace-masterworker
           trace-process-migration trace-host-user-variables)
@@ -24,7 +23,7 @@ foreach (file answer dht-kademlia node routing_table task)
   set(examples_src  ${examples_src}  ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/${file}.c  ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/${file}.h)
 endforeach()
 
-foreach (file app-masterworker dht-kademlia dht-pastry)
+foreach (file dht-kademlia dht-pastry)
   set(xml_files    ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/${file}/${file}_d.xml)
 endforeach()
 
@@ -33,28 +32,24 @@ set(bin_files    ${bin_files}     ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/gener
                                   ${CMAKE_CURRENT_SOURCE_DIR}/dht-pastry/generate.py                       PARENT_SCOPE)
 set(examples_src ${examples_src}  ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/common.h                        PARENT_SCOPE)
 set(tesh_files   ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/dht-kademlia/dht-kademlia.tesh
-                                  ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworker/app-masterworker-multicore.tesh
-                                  ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworker/app-masterworker-vivaldi.tesh
-                                  PARENT_SCOPE)
-set(xml_files    ${xml_files}     ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworker/app-masterworker-multicore_d.xml
-                                  ${CMAKE_CURRENT_SOURCE_DIR}/app-masterworker/app-masterworker-vivaldi_d.xml
                                   PARENT_SCOPE)
+set(xml_files    ${xml_files}     PARENT_SCOPE)
 
 if(enable_msg)
-  foreach(x app-masterworker dht-pastry dht-kademlia synchro-semaphore)
+  foreach(x dht-pastry dht-kademlia synchro-semaphore)
     ADD_TESH_FACTORIES(msg-${x} "thread;ucontext;raw;boost" 
                                 --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/${x}
-                               --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/${x} 
-                               --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms 
-                               ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/${x}/${x}.tesh)
+                                --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/${x} 
+                                --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms 
+                                ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/${x}/${x}.tesh)
   endforeach()
 
   foreach (x trace-categories trace-route-user-variables trace-link-user-variables trace-masterworker trace-process-migration trace-host-user-variables)
     ADD_TESH(msg-${x} --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/${x}
-                     --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/${x} 
-                     --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms 
+                      --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/${x} 
+                      --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms 
                       --cd ${CMAKE_BINARY_DIR}/examples/deprecated/msg/${x}
-                     ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/${x}/${x}.tesh)
+                      ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/${x}/${x}.tesh)
   endforeach()
 
   if(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "i386" AND CMAKE_SIZEOF_VOID_P EQUAL 8)
@@ -68,17 +63,5 @@ if(enable_msg)
                                                --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/dht-kademlia
                                                --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/dht-kademlia
                                                --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
-                                              ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/dht-kademlia/dht-kademlia.tesh)
-
-  ADD_TESH_FACTORIES(app-masterworker-multicore   "thread;ucontext;raw;boost" 
-                                                  --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/app-masterworker 
-                                                  --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/app-masterworker
-                                                 --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
-                                                 ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/app-masterworker/app-masterworker-multicore.tesh)
-  ADD_TESH_FACTORIES(app-masterworker-vivaldi     "thread;ucontext;raw;boost" 
-                                                  --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/app-masterworker 
-                                                  --setenv bindir=${CMAKE_BINARY_DIR}/examples/deprecated/msg/app-masterworker
-                                                 --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
-                                                 ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/app-masterworker/app-masterworker-vivaldi.tesh)
-
+                                               ${CMAKE_HOME_DIRECTORY}/examples/deprecated/msg/dht-kademlia/dht-kademlia.tesh)
 endif(enable_msg)
\ No newline at end of file
diff --git a/examples/deprecated/msg/app-masterworker/app-masterworker.c b/examples/deprecated/msg/app-masterworker/app-masterworker.c
deleted file mode 100644 (file)
index 9d3b643..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/* Copyright (c) 2010-2020. 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/msg.h"
-
-#include <stdio.h> /* snprintf */
-
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_app_masterworker, "Messages specific for this msg example");
-
-/* Main function of the master process */
-static int master(int argc, char *argv[])
-{
-  xbt_assert(argc==5, "The master function expects 4 arguments from the XML deployment file");
-  long number_of_tasks = xbt_str_parse_int(argv[1], "Invalid amount of tasks: %s");    /* - Number of tasks      */
-  double comp_size = xbt_str_parse_double(argv[2], "Invalid computational size: %s");  /* - Task compute cost    */
-  double comm_size = xbt_str_parse_double(argv[3], "Invalid communication size: %s");  /* - Task communication size */
-  long workers_count = xbt_str_parse_int(argv[4], "Invalid amount of workers: %s");    /* - Number of workers    */
-
-  XBT_INFO("Got %ld workers and %ld tasks to process", workers_count, number_of_tasks);
-
-  for (int i = 0; i < number_of_tasks; i++) {  /* For each task to be executed: */
-    char mailbox[80];
-    char task_name[80];
-
-    snprintf(mailbox,79, "worker-%ld", i % workers_count); /* - Select a @ref worker in a round-robin way */
-    snprintf(task_name,79, "Task_%d", i);
-    msg_task_t task = MSG_task_create(task_name, comp_size, comm_size, NULL);   /* - Create a task */
-    if (number_of_tasks < 10000 || i % 10000 == 0)
-      XBT_INFO("Sending \"%s\" (of %ld) to mailbox \"%s\"", MSG_task_get_name(task), number_of_tasks, mailbox);
-
-    MSG_task_send(task, mailbox); /* - Send the task to the @ref worker */
-  }
-
-  XBT_INFO("All tasks have been dispatched. Let's tell everybody the computation is over.");
-  for (int i = 0; i < workers_count; i++) { /* - Eventually tell all the workers to stop by sending a "finalize" task */
-    char mailbox[80];
-
-    snprintf(mailbox,79, "worker-%ld", i % workers_count);
-    msg_task_t finalize = MSG_task_create("finalize", 0, 0, 0);
-    MSG_task_send(finalize, mailbox);
-  }
-
-  return 0;
-}
-
-/* Main functions of the Worker processes */
-static int worker(int argc, char *argv[])
-{
-  xbt_assert(argc==2, "The worker expects a single argument from the XML deployment file: its worker ID (its numerical rank)");
-  char mailbox[80];
-
-  long id= xbt_str_parse_int(argv[1], "Invalid argument %s");
-
-  snprintf(mailbox,79, "worker-%ld", id);
-
-  while (1) { /* The worker wait in an infinite loop for tasks sent by the @ref master */
-    msg_task_t task = NULL;
-    int res = MSG_task_receive(&task, mailbox);
-    xbt_assert(res == MSG_OK, "MSG_task_get failed");
-
-    if (strcmp(MSG_task_get_name(task), "finalize") == 0) {
-      MSG_task_destroy(task);  /* - Exit if 'finalize' is received */
-      break;
-    }
-    MSG_task_execute(task);    /*  - Otherwise, process the task */
-    MSG_task_destroy(task);
-  }
-  XBT_INFO("I'm done. See you!");
-  return 0;
-}
-
-int main(int argc, char *argv[])
-{
-  MSG_init(&argc, argv);
-  xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n"
-             "\tExample: %s msg_platform.xml msg_deployment.xml\n", argv[0], argv[0]);
-
-  MSG_create_environment(argv[1]);          /* - Load the platform description */
-
-  MSG_function_register("master", master);  /* - Register the function to be executed by the processes */
-  MSG_function_register("worker", worker);
-  MSG_launch_application(argv[2]);          /* - Deploy the application */
-
-  msg_error_t res = MSG_main();             /* - Run the simulation */
-
-  XBT_INFO("Simulation time %g", MSG_get_clock());
-
-  return res != MSG_OK;
-}
index 7ad6331..e1df638 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/env tesh
 
 p Trace user variables associated to links of the platform file
-$ ${bindir:=.}/trace-link-user-variables --cfg=tracing:yes --cfg=tracing/platform:yes ${platfdir}/small_platform.xml ${srcdir}/../app-masterworker/app-masterworker_d.xml
+$ ${bindir:=.}/trace-link-user-variables --cfg=tracing:yes --cfg=tracing/platform:yes ${platfdir}/small_platform.xml ${srcdir:=.}/../../../c/app-masterworker/app-masterworker_d.xml
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing' to 'yes'
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing/platform' to 'yes'
 
index b46083d..9ab5b23 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/env tesh
 
 p Tracing master/worker application
-$ ${bindir:=.}/trace-masterworker --cfg=tracing:yes --cfg=tracing/filename:trace-masterworker.trace --cfg=tracing/categorized:yes --cfg=tracing/uncategorized:yes ${platfdir}/small_platform.xml ${srcdir}/../app-masterworker/app-masterworker_d.xml
+$ ${bindir:=.}/trace-masterworker --cfg=tracing:yes --cfg=tracing/filename:trace-masterworker.trace --cfg=tracing/categorized:yes --cfg=tracing/uncategorized:yes ${platfdir}/small_platform.xml ${srcdir:=.}/../../../c/app-masterworker/app-masterworker_d.xml
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing' to 'yes'
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing/filename' to 'trace-masterworker.trace'
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing/categorized' to 'yes'
@@ -15,7 +15,7 @@ $ ${bindir:=.}/trace-masterworker --cfg=tracing:yes --cfg=tracing/filename:trace
 > [4.214821] [msg_trace_masterworker/INFO] msmark
 
 p Tracing master/worker application with xml config
-$ ${bindir:=.}/trace-masterworker ${platfdir}/config_tracing.xml ${srcdir}/../app-masterworker/app-masterworker_d.xml
+$ ${bindir:=.}/trace-masterworker ${platfdir}/config_tracing.xml ${srcdir:=.}/../../../c/app-masterworker/app-masterworker_d.xml
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing' to 'yes'
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing/categorized' to 'yes'
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing/filename' to 'trace-masterworker.trace'
@@ -29,10 +29,10 @@ $ ${bindir:=.}/trace-masterworker ${platfdir}/config_tracing.xml ${srcdir}/../ap
 > [4.214821] [msg_trace_masterworker/INFO] msmark
 
 p Not tracing master/worker application
-$ ${bindir:=.}/trace-masterworker ${platfdir}/small_platform.xml ${srcdir}/../app-masterworker/app-masterworker_d.xml
+$ ${bindir:=.}/trace-masterworker ${platfdir}/small_platform.xml ${srcdir:=.}/../../../c/app-masterworker/app-masterworker_d.xml
 
 p Testing tracing by process
-$ ${bindir:=.}/trace-masterworker --cfg=tracing:yes --cfg=tracing/msg/process:yes --cfg=tracing/filename:trace-masterworker.trace --cfg=tracing/categorized:yes --cfg=tracing/uncategorized:yes ${platfdir}/small_platform.xml ${srcdir}/../app-masterworker/app-masterworker_d.xml
+$ ${bindir:=.}/trace-masterworker --cfg=tracing:yes --cfg=tracing/msg/process:yes --cfg=tracing/filename:trace-masterworker.trace --cfg=tracing/categorized:yes --cfg=tracing/uncategorized:yes ${platfdir}/small_platform.xml ${srcdir:=.}/../../../c/app-masterworker/app-masterworker_d.xml
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing' to 'yes'
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing/msg/process' to 'yes'
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing/filename' to 'trace-masterworker.trace'