-add_executable (ms ms.c)
-target_link_libraries(ms simgrid)
-add_executable (categories categories.c)
-target_link_libraries(categories simgrid)
-add_executable (procmig procmig.c)
-target_link_libraries(procmig simgrid)
+foreach (example ms categories procmig trace_platform user_variables link_user_variables link_srcdst_user_variables)
+ add_executable (${example} ${example}.c)
+ target_link_libraries(${example} simgrid)
+ set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/${example}.c)
+ set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${example}.tesh)
+
+ ADD_TESH(tracing-${example} --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg --cd ${CMAKE_HOME_DIRECTORY}/examples/msg tracing/${example}.tesh)
+endforeach()
+
add_executable (simple simple.c)
target_link_libraries(simple simgrid)
-add_executable (trace_platform trace_platform.c)
-target_link_libraries(trace_platform simgrid)
-add_executable (user_variables user_variables.c)
-target_link_libraries(user_variables simgrid)
-add_executable (link_user_variables link_user_variables.c)
-target_link_libraries(link_user_variables simgrid)
-add_executable (link_srcdst_user_variables link_srcdst_user_variables.c)
-target_link_libraries(link_srcdst_user_variables simgrid)
## Clean generated files
get_directory_property(extra_clean_files ADDITIONAL_MAKE_CLEAN_FILES)
-set_directory_properties(
- PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES
- "${extra_clean_files};${CMAKE_CURRENT_BINARY_DIR}/ms.cat.plist;${CMAKE_CURRENT_BINARY_DIR}/ms.trace;${CMAKE_CURRENT_BINARY_DIR}/ms.uncat.plist;"
- )
+set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${extra_clean_files};${CMAKE_CURRENT_BINARY_DIR}/ms.cat.plist;${CMAKE_CURRENT_BINARY_DIR}/ms.trace;${CMAKE_CURRENT_BINARY_DIR}/ms.uncat.plist;")
-set(tesh_files
- ${tesh_files}
- ${CMAKE_CURRENT_SOURCE_DIR}/categories.tesh
- ${CMAKE_CURRENT_SOURCE_DIR}/link_srcdst_user_variables.tesh
- ${CMAKE_CURRENT_SOURCE_DIR}/link_user_variables.tesh
- ${CMAKE_CURRENT_SOURCE_DIR}/ms.tesh
- ${CMAKE_CURRENT_SOURCE_DIR}/procmig.tesh
- ${CMAKE_CURRENT_SOURCE_DIR}/trace_platform.tesh
- ${CMAKE_CURRENT_SOURCE_DIR}/user_variables.tesh
- PARENT_SCOPE)
-set(xml_files
- ${xml_files}
- ${CMAKE_CURRENT_SOURCE_DIR}/deployment.xml
- ${CMAKE_CURRENT_SOURCE_DIR}/procmig-deploy.xml
- PARENT_SCOPE)
-set(examples_src
- ${examples_src}
- ${CMAKE_CURRENT_SOURCE_DIR}/categories.c
- ${CMAKE_CURRENT_SOURCE_DIR}/link_srcdst_user_variables.c
- ${CMAKE_CURRENT_SOURCE_DIR}/link_user_variables.c
- ${CMAKE_CURRENT_SOURCE_DIR}/ms.c
- ${CMAKE_CURRENT_SOURCE_DIR}/procmig.c
- ${CMAKE_CURRENT_SOURCE_DIR}/simple.c
- ${CMAKE_CURRENT_SOURCE_DIR}/trace_platform.c
- ${CMAKE_CURRENT_SOURCE_DIR}/user_variables.c
- PARENT_SCOPE)
+set(tesh_files ${tesh_files} PARENT_SCOPE)
+set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/simple.c PARENT_SCOPE)
+set(xml_files ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/deployment.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/procmig-deploy.xml PARENT_SCOPE)
/** @addtogroup MSG_examples
*
- * - <b>tracing/categories.c</b> This is a master/slave program where the master creates
- * tasks, send them to the slaves. For each task received, the slave executes
- * it and then destroys it. This program declares several tracing categories that are
- * used to classify tasks. When the program is executed, the tracing mechanism registers
- * the resource utilization of hosts and links according to these categories. You might
- * want to run this program with the following parameters:
+ * - <b>tracing/categories.c</b> This is a master/slave program where the master creates tasks, send them to the slaves.
+ * For each task received, the slave executes it and then destroys it. This program declares several tracing categories
+ * that are used to classify tasks. When the program is executed, the tracing mechanism registers the resource
+ * utilization of hosts and links according to these categories. You might want to run this program with the following
+ * parameters:
* --cfg=tracing:yes
* --cfg=tracing/categorized:yes
* --cfg=tracing/uncategorized:yes
#include <stdio.h>
#include "simgrid/msg.h"
-#include "xbt/sysdep.h" /* calloc, printf */
-
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-#include "xbt/asserts.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
- "Messages specific for this msg example");
-int master(int argc, char *argv[]);
-int slave(int argc, char *argv[]);
-
-/** sender function */
-int master(int argc, char *argv[])
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
+
+static int master(int argc, char *argv[])
{
long number_of_tasks = xbt_str_parse_int(argv[1], "Invalid amount of tasks: %s");
long slaves_count = xbt_str_parse_int(argv[4], "Invalid amount of slaves: %s");
return 0;
}
-/** Receiver function */
-int slave(int argc, char *argv[])
+static int slave(int argc, char *argv[])
{
msg_task_t task = NULL;
return 0;
}
-/** Main function */
int main(int argc, char *argv[])
{
MSG_init(&argc, argv);
exit(1);
}
- char *platform_file = argv[1];
- char *deployment_file = argv[2];
- MSG_create_environment(platform_file);
+ MSG_create_environment(argv[1]);
//declaring user categories with RGB colors
TRACE_category_with_color ("compute", "1 0 0"); //red
MSG_function_register("master", master);
MSG_function_register("slave", slave);
- MSG_launch_application(deployment_file);
+ MSG_launch_application(argv[2]);
MSG_main();
return 0;
<argument value="1000000"/> <!-- Communication size of tasks -->
<argument value="5"/> <!-- Number of slaves -->
</process>
- <!-- The slave processes (with mailbox to listen on as argument) -->
<process host="Tremblay" function="slave"/>
<process host="Jupiter" function="slave"/>
<process host="Fafard" function="slave"/>
/** @addtogroup MSG_examples
*
- * - <b>tracing/link_srcdst_user_variables.c</b>: This program demonstrates how to
- * trace user variables associated to the links of the platform file. Instead of
- * providing the name of the link to update one of its variable, this example shows
- * how to provide two hosts as parameter (source and destination, use their names as
- * defined in the platform file). The tracing mechanism will get the route between
- * these two hosts, if there is one defined in the platform file, and update the variable
- * of all the links of that route to the value provided.
+ * - <b>tracing/link_srcdst_user_variables.c</b>: This program demonstrates how to trace user variables associated to
+ * the links of the platform file. Instead of providing the name of the link to update one of its variable, this
+ * example shows how to provide two hosts as parameter (source and destination, use their names as defined in the
+ * platform file). The tracing mechanism will get the route between these two hosts, if there is one defined in the
+ * platform file, and update the variable of all the links of that route to the value provided.
* You might want to run this program with the following parameters:
* --cfg=tracing:yes
* --cfg=tracing/platform:yes
* (See \ref tracing_tracing_options for details)
*/
-int master(int argc, char *argv[]);
-
//dump function to create and execute a task
static void create_and_execute_task (void)
{
MSG_task_destroy (task);
}
-int master(int argc, char *argv[])
+static int master(int argc, char *argv[])
{
- int i;
-
//Set initial values for the link user variables
- //
- //This example uses source and destination where
- //source and destination are the name of hosts in
- //the platform file.
- //
- //The functions will set/change the value of the variable
- //for all links in the route between source and destination.
+ //This example uses source and destination wheresource and destination are the name of hosts inthe platform file.
+ //The functions will set/change the value of the variablefor all links in the route between source and destination.
//Set the Link_Capacity variable
TRACE_link_srcdst_variable_set("Tremblay", "Bourassa", "Link_Capacity", 12.34);
TRACE_link_srcdst_variable_set("Fafard", "Ginette", "Link_Utilization", 3.4);
//run the simulation, update my variables accordingly
- for (i = 0; i < 10; i++) {
+ for (int i = 0; i < 10; i++) {
create_and_execute_task ();
//Add to link user variables
TRACE_link_srcdst_variable_add ("Fafard", "Ginette", "Link_Utilization", 7.8);
}
- for (i = 0; i < 10; i++) {
+ for (int i = 0; i < 10; i++) {
create_and_execute_task ();
//Subtract from link user variables
return 0;
}
-/** Main function */
int main(int argc, char *argv[])
{
MSG_init(&argc, argv);
exit(1);
}
- char *platform_file = argv[1];
- char *deployment_file = argv[2];
- MSG_create_environment(platform_file);
+ MSG_create_environment(argv[1]);
//declaring link user variables (one without, another with a RGB color)
TRACE_link_variable_declare("Link_Capacity");
//register "master" and "slave" functions and launch deployment
MSG_function_register("master", master);
MSG_function_register("slave", master);
- MSG_launch_application(deployment_file);
+ MSG_launch_application(argv[2]);
MSG_main();
return 0;
/** @addtogroup MSG_examples
*
- * - <b>tracing/link_user_variables.c</b>: This program demonstrates how to
- * trace user variables associated to the links of the platform file. You need
- * to provide the name of the link to update the value of the variable associated
- * to that link.
- * You might want to run this program with the following parameters:
+ * - <b>tracing/link_user_variables.c</b>: This program demonstrates how to trace user variables associated to the
+ * links of the platform file. You need to provide the name of the link to update the value of the variable associated
+ * to that link. You might want to run this program with the following parameters:
* --cfg=tracing:yes
* --cfg=tracing/platform:yes
* (See \ref tracing_tracing_options for details)
*/
-int master(int argc, char *argv[]);
-
//dump function to create and execute a task
static void create_and_execute_task (void)
{
MSG_task_destroy (task);
}
-int master(int argc, char *argv[])
+static int master(int argc, char *argv[])
{
- int i;
-
- //set initial values for the link user variables
- //this example only shows for links
- //identified by "6" and "3" in the platform file
+ //set initial values for the link user variables this example only shows for links identified by "6" and "3" in the
+ //platform file
//Set the Link_Capacity variable
TRACE_link_variable_set("6", "Link_Capacity", 12.34);
TRACE_link_variable_set("6", "Link_Utilization", 3.4);
//run the simulation, update my variables accordingly
- for (i = 0; i < 10; i++) {
+ for (int i = 0; i < 10; i++) {
create_and_execute_task ();
//Add to link user variables
TRACE_link_variable_add ("6", "Link_Utilization", 7.8);
}
- for (i = 0; i < 10; i++) {
+ for (int i = 0; i < 10; i++) {
create_and_execute_task ();
//Subtract from link user variables
return 0;
}
-/** Main function */
int main(int argc, char *argv[])
{
MSG_init(&argc, argv);
exit(1);
}
- char *platform_file = argv[1];
- char *deployment_file = argv[2];
- MSG_create_environment(platform_file);
+ MSG_create_environment(argv[1]);
//declaring link user variables (one without, another with a RGB color)
TRACE_link_variable_declare("Link_Capacity");
//register "master" and "slave" functions and launch deployment
MSG_function_register("master", master);
MSG_function_register("slave", master);
- MSG_launch_application(deployment_file);
+ MSG_launch_application(argv[2]);
MSG_main();
return 0;
/** @addtogroup MSG_examples
*
- * - <b>tracing/ms.c</b> This is a master/slave program where the master creates
- * tasks, send them to the slaves. For each task received, the slave executes
- * it and then destroys it. This program uses several tracing functions that
- * enable the tracing of categorized resource utilization, the use of trace marks,
- * and user variables associated to the hosts of the platform file.
- * You might want to run this program with the following parameters:
+ * - <b>tracing/ms.c</b> This is a master/slave program where the master creates tasks, send them to the slaves. For
+ * each task received, the slave executes it and then destroys it. This program uses several tracing functions that
+ * enable the tracing of categorized resource utilization, the use of trace marks, and user variables associated to the
+ * hosts of the platform file. You might want to run this program with the following parameters:
* --cfg=tracing/categorized:yes
* --cfg=tracing/uncategorized:yes
* --cfg=viva/categorized:viva_cat.plist
* (See \ref tracing_tracing_options for details)
*/
-#include <stdio.h>
#include "simgrid/msg.h"
-#include "xbt/sysdep.h" /* calloc, printf */
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-#include "xbt/asserts.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
- "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
-int master(int argc, char *argv[]);
-int slave(int argc, char *argv[]);
-
-/** sender function */
-int master(int argc, char *argv[])
+static int master(int argc, char *argv[])
{
long number_of_tasks = xbt_str_parse_int(argv[1], "Invalid amount of tasks: %s");
double task_comp_size = xbt_str_parse_double(argv[2], "Invalid computational size: %s");
return 0;
}
-/** Receiver function */
-int slave(int argc, char *argv[])
+static int slave(int argc, char *argv[])
{
msg_task_t task = NULL;
TRACE_host_variable_set(MSG_host_get_name(MSG_host_self()), "is_slave", 1);
- TRACE_host_variable_set(MSG_host_get_name(MSG_host_self()),
- "task_computation",
- 0);
+ TRACE_host_variable_set(MSG_host_get_name(MSG_host_self()), "task_computation", 0);
while (1) {
MSG_task_receive(&(task), "master_mailbox");
}
//adding the value returned by MSG_task_get_compute_duration(task)
//to the variable "task_computation"
- TRACE_host_variable_add(MSG_host_get_name(MSG_host_self()),
- "task_computation",
- MSG_task_get_flops_amount(task));
+ TRACE_host_variable_add(MSG_host_get_name(MSG_host_self()), "task_computation", MSG_task_get_flops_amount(task));
MSG_task_execute(task);
MSG_task_destroy(task);
task = NULL;
return 0;
}
-/** Main function */
int main(int argc, char *argv[])
{
MSG_init(&argc, argv);
exit(1);
}
- char *platform_file = argv[1];
- char *deployment_file = argv[2];
- MSG_create_environment(platform_file);
+ MSG_create_environment(argv[1]);
//declaring user variables
TRACE_host_variable_declare("is_slave");
//declaring user categories with RGB colors (values from 0 to 1)
TRACE_category_with_color ("compute", "1 0 0"); //compute is red
TRACE_category_with_color ("finalize", "0 1 0"); //finalize is green
- //categories without user-defined colors receive
- //random colors generated by the tracing system
+ //categories without user-defined colors receive random colors generated by the tracing system
TRACE_category ("request");
TRACE_category_with_color ("report", NULL);
MSG_function_register("master", master);
MSG_function_register("slave", slave);
- MSG_launch_application(deployment_file);
+ MSG_launch_application(argv[2]);
MSG_main();
}
return 0;
-} /* end_of_main */
+}
/** @addtogroup MSG_examples
*
- * - <b>tracing/procmig.c</b> This program shows a process migration. Tracing
- * this program with the options below enables a gantt-chart visualization
- * of where the process has been during its execution. Migrations are represented by
- * arrows from the origin to the destination host.
- * You might want to run this program with the following parameters:
+ * - <b>tracing/procmig.c</b> This program shows a process migration. Tracing this program with the options below
+ * enables a gantt-chart visualization of where the process has been during its execution. Migrations are represented by
+ * arrows from the origin to the destination host. You might want to run this program with the following parameters:
* --cfg=tracing:yes
* --cfg=tracing/msg/process:yes
* (See \ref tracing_tracing_options for details)
*/
-#include "simgrid/msg.h" /* core library */
-#include "xbt/sysdep.h" /* calloc */
+#include "simgrid/msg.h"
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
- "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
/** The guy we will move from host to host. It move alone and then is moved by policeman back */
static int emigrant(int argc, char *argv[])
return 0;
}
-/** Main function */
int main(int argc, char *argv[])
{
- /* Argument checking */
MSG_init(&argc, argv);
if (argc < 3) {
XBT_CRITICAL("Usage: %s platform_file deployment_file\n", argv[0]);
exit(1);
}
- char *platform_file = argv[1];
- char *deployment_file = argv[2];
- MSG_create_environment(platform_file);
+ MSG_create_environment(argv[1]);
TRACE_category ("migration_order");
/* Application deployment */
MSG_function_register("emigrant", emigrant);
MSG_function_register("master", master);
- MSG_launch_application(deployment_file);
+ MSG_launch_application(argv[2]);
MSG_main();
return 0;
/* Create a log channel to have nice outputs. */
#include "xbt/log.h"
#include "xbt/asserts.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
- "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
-int simple_func(int argc, char *argv[]);
-
-/** Emitter function */
-int simple_func(int argc, char *argv[])
+static int simple_func(int argc, char *argv[])
{
msg_task_t task = MSG_task_create("task", 100, 0, NULL);
MSG_task_execute (task);
return 0;
}
-/** Main function */
int main(int argc, char *argv[])
{
MSG_init(&argc, argv);
exit(1);
}
- char *platform_file = argv[1];
- char *deployment_file = argv[2];
- MSG_create_environment(platform_file);
+ MSG_create_environment(argv[1]);
MSG_function_register("master", simple_func);
MSG_function_register("slave", simple_func);
- MSG_launch_application(deployment_file);
+ MSG_launch_application(argv[2]);
MSG_main();
return 0;
/** @addtogroup MSG_examples
*
- * - <b>tracing/trace_platform.c</b>: This program demonstrates how a
- * platform file is traced to a Paje trace file format using the tracing
- * mechanism of Simgrid.
- * You might want to run this program with the following parameters:
+ * - <b>tracing/trace_platform.c</b>: This program demonstrates how a platform file is traced to a Paje trace file
+ * format using the tracing mechanism of Simgrid. You might want to run this program with the following parameters:
* --cfg=tracing:yes
* --cfg=tracing/categorized:yes
* (See \ref tracing_tracing_options for details)
*/
-#include <stdio.h>
#include "simgrid/msg.h"
-#include "xbt/sysdep.h" /* calloc, printf */
-#include "xbt/log.h"
-#include "xbt/asserts.h"
XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
-/** Main function */
int main(int argc, char *argv[])
{
MSG_init(&argc, argv);
exit(1);
}
- char *platform_file = argv[1];
- MSG_create_environment(platform_file);
+ MSG_create_environment(argv[1]);
MSG_main();
return 0;
}
/** @addtogroup MSG_examples
*
- * - <b>tracing/user_variables.c</b>: This program demonstrates how to
- * trace user variables associated to the hosts of the platform file.
- * You might want to run this program with the following parameters:
+ * - <b>tracing/user_variables.c</b>: This program demonstrates how to trace user variables associated to the hosts of
+ * the platform file. You might want to run this program with the following parameters:
* --cfg=tracing:yes
* --cfg=tracing/platform:yes
* (See \ref tracing_tracing_options for details)
*/
-#include <stdio.h>
#include "simgrid/msg.h"
-#include "xbt/sysdep.h" /* calloc, printf */
-/* Create a log channel to have nice outputs. */
-#include "xbt/log.h"
-#include "xbt/asserts.h"
XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
-int master(int argc, char *argv[]);
-
-int master(int argc, char *argv[])
+static int master(int argc, char *argv[])
{
const char *hostname = MSG_host_get_name(MSG_host_self());
int i;
return 0;
}
-/** Main function */
int main(int argc, char *argv[])
{
MSG_init(&argc, argv);
exit(1);
}
- char *platform_file = argv[1];
- char *deployment_file = argv[2];
- MSG_create_environment(platform_file);
+ MSG_create_environment(argv[1]);
//declaring user variables
TRACE_host_variable_declare("HDD_capacity");
//register functions and launch deployment
MSG_function_register("master", master);
MSG_function_register("slave", master);
- MSG_launch_application(deployment_file);
+ MSG_launch_application(argv[2]);
MSG_main();
ENDIF()
## INTERFACES ##
- ### MSG ###
- # BEGIN TESH TESTS
- ADD_TESH(tracing-ms --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg --cd ${CMAKE_HOME_DIRECTORY}/examples/msg tracing/ms.tesh)
- ADD_TESH(tracing-trace-platform --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg --cd ${CMAKE_HOME_DIRECTORY}/examples/msg tracing/trace_platform.tesh)
- ADD_TESH(tracing-user-variables --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg --cd ${CMAKE_HOME_DIRECTORY}/examples/msg tracing/user_variables.tesh)
- ADD_TESH(tracing-link-user-variables --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg --cd ${CMAKE_HOME_DIRECTORY}/examples/msg tracing/link_user_variables.tesh)
- ADD_TESH(tracing-link-srcdst-user-variables --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg --cd ${CMAKE_HOME_DIRECTORY}/examples/msg tracing/link_srcdst_user_variables.tesh)
- ADD_TESH(tracing-categories --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg --cd ${CMAKE_HOME_DIRECTORY}/examples/msg tracing/categories.tesh)
- ADD_TESH(tracing-process-migration --setenv bindir=${CMAKE_BINARY_DIR}/examples/msg --cd ${CMAKE_HOME_DIRECTORY}/examples/msg tracing/procmig.tesh)
- # END TESH TESTS
-
### SIMDAG ###
# BEGIN TESH TESTS
# these tests need the assertion mechanism