ADD_TESH_FACTORIES(msg-ptask "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/parallel_task/parallel_task.tesh)
+ADD_TESH_FACTORIES(msg-ptask-energy "thread;ucontext;raw" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/parallel_task/parallel_task_energy.tesh)
+
+set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/parallel_task.tesh PARENT_SCOPE)
set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/parallel_task.tesh PARENT_SCOPE)
set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/parallel_task.c PARENT_SCOPE)
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "simgrid/msg.h"
+#include "simgrid/plugins/energy.h"
XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
MSG_init(&argc, argv);
MSG_config("host/model", "ptask_L07");
- xbt_assert(argc > 1, "Usage: %s <platform file>", argv[0]);
+ xbt_assert(argc <= 3, "1Usage: %s <platform file> [--energy]", argv[0]);
+ xbt_assert(argc >= 2, "2Usage: %s <platform file> [--energy]", argv[0]);
+
+ if(argc == 3 && argv[2][2] == 'e')
+ sg_energy_plugin_init();
+
MSG_create_environment(argv[1]);
/* Pick a process, no matter which, from the platform file */
--- /dev/null
+#! ./tesh
+
+$ $SG_TEST_EXENV parallel_task/parallel_task$EXEEXT ${srcdir:=.}/../platforms/energy_platform.xml --energy "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+> [ 0.000000] (0:maestro@) Switching to the L07 model to handle parallel tasks.
+> [ 0.000000] (1:test@MyHost1) First, build a classical parallel task, with 1 Gflop to execute on each node, and 10MB to exchange between each pair
+> [300.000000] (1:test@MyHost1) Then, build a parallel task involving only computations and no communication (1 Gflop per node)
+> [310.000000] (1:test@MyHost1) Finally, trick the ptask to do a 'remote execution', on host MyHost2
+> [320.000000] (1:test@MyHost1) Goodbye now!
+> [320.000000] (0:maestro@) Simulation done.
+> [320.000000] (0:maestro@) Total energy of host MyHost1: 34000.000000 Joules
+> [320.000000] (0:maestro@) Total energy of host MyHost2: 35000.000000 Joules
+> [320.000000] (0:maestro@) Total energy of host MyHost3: 34000.000000 Joules