set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
-add_executable(ex_sd_test sd_test.c)
+add_executable(sd_test sd_test.c)
add_executable(sd_test2 sd_test2.c)
add_executable(sd_fail sd_fail.c)
add_executable(sd_avail sd_avail.c)
add_executable(sd_typed_tasks_test sd_typed_tasks_test.c)
add_executable(sd_comm_throttling sd_comm_throttling.c)
-### Add definitions for compile
-if(NOT WIN32)
- target_link_libraries(ex_sd_test simgrid pthread )
- target_link_libraries(sd_test2 simgrid pthread )
- target_link_libraries(sd_fail simgrid pthread )
- target_link_libraries(sd_avail simgrid pthread )
- target_link_libraries(sd_typed_tasks_test simgrid pthread )
- target_link_libraries(sd_comm_throttling simgrid pthread )
-
- add_custom_command(TARGET ex_sd_test
- POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/ex_sd_test ${CMAKE_CURRENT_BINARY_DIR}/sd_test
- WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
- )
- 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}/sd_test")
-
-else()
- target_link_libraries(ex_sd_test simgrid)
- target_link_libraries(sd_test2 simgrid)
- target_link_libraries(sd_fail simgrid)
- target_link_libraries(sd_avail simgrid)
- target_link_libraries(sd_typed_tasks_test simgrid)
- target_link_libraries(sd_comm_throttling simgrid)
-
- add_custom_command(TARGET ex_sd_test
- POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/ex_sd_test.exe ${CMAKE_CURRENT_BINARY_DIR}/sd_test.exe
- WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
- )
- 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}/sd_test.exe")
-endif()
+target_link_libraries(sd_test simgrid)
+target_link_libraries(sd_test2 simgrid)
+target_link_libraries(sd_fail simgrid)
+target_link_libraries(sd_avail simgrid)
+target_link_libraries(sd_typed_tasks_test simgrid)
+target_link_libraries(sd_comm_throttling simgrid)
set(tesh_files
${tesh_files}
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
add_executable(dax_test dax_test.c)
-
-### Add definitions for compile
-if(NOT WIN32)
- target_link_libraries(dax_test simgrid pthread )
-else()
- target_link_libraries(dax_test simgrid)
-endif()
+target_link_libraries(dax_test simgrid)
set(tesh_files
${tesh_files}
PARENT_SCOPE)
set(xml_files
${xml_files}
- ${CMAKE_CURRENT_SOURCE_DIR}/Montage_50.xml
${CMAKE_CURRENT_SOURCE_DIR}/simple_dax_with_cycle.xml
${CMAKE_CURRENT_SOURCE_DIR}/smalldax.xml
PARENT_SCOPE)
/* 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 <stdlib.h>
#include <stdio.h>
#include "simgrid/simdag.h"
#include "xbt/log.h"
-#include "xbt/ex.h"
#include <string.h>
-XBT_LOG_NEW_DEFAULT_CATEGORY(test,
- "Logging specific to this SimDag example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Logging specific to this SimDag example");
static int name_compare_hosts(const void *n1, const void *n2)
{
- return strcmp(
- sg_host_get_name(*(sg_host_t *) n1),
- sg_host_get_name(*(sg_host_t *) n2)
- );
+ return strcmp(sg_host_get_name(*(sg_host_t *) n1), sg_host_get_name(*(sg_host_t *) n2));
}
int main(int argc, char **argv)
/* Check our arguments */
xbt_assert(argc > 2, "Usage: %s platform_file dax_file [jedule_file]\n"
- "\tExample: %s simulacrum_7_hosts.xml Montage_25.xml Montage_25.jed",
- argv[0], argv[0]);
+ "\tExample: %s simulacrum_7_hosts.xml Montage_25.xml Montage_25.jed", argv[0], argv[0]);
char *last = strrchr(argv[2], '.');
- char * tracefilename = bprintf("%.*s.trace",(int) (last == NULL ?
- strlen(argv[2]) :
- last - argv[2]), argv[2]);
+ char * tracefilename = bprintf("%.*s.trace",(int) (last == NULL ? strlen(argv[2]):last - argv[2]), argv[2]);
if (argc == 4)
tracefilename = xbt_strdup(argv[3]);
-
+
/* creation of the environment */
SD_create_environment(argv[1]);
}
/* Display all the tasks */
- XBT_INFO
- ("------------------- Display all tasks of the loaded DAG ---------------------------");
+ XBT_INFO("------------------- Display all tasks of the loaded DAG ---------------------------");
xbt_dynar_foreach(dax, cursor, task) {
SD_task_dump(task);
}
fprintf(dotout, "}\n");
fclose(dotout);
- /* Schedule them all on the first workstation */
+ /* Schedule them all on the first host */
XBT_INFO("------------------- Schedule tasks ---------------------------");
const sg_host_t *ws_list = sg_host_list();
int hosts_count = sg_host_count();
- qsort((void *) ws_list, hosts_count, sizeof(sg_host_t),
- name_compare_hosts);
+ qsort((void *) ws_list, hosts_count, sizeof(sg_host_t), name_compare_hosts);
xbt_dynar_foreach(dax, cursor, task) {
if (SD_task_get_kind(task) == SD_TASK_COMP_SEQ) {
}
}
- XBT_INFO
- ("------------------- Run the schedule ---------------------------");
+ XBT_INFO("------------------- Run the schedule ---------------------------");
SD_simulate(-1);
- XBT_INFO
- ("------------------- Produce the trace file---------------------------");
+ XBT_INFO("------------------- Produce the trace file---------------------------");
XBT_INFO("Producing the trace of the run into %s", tracefilename);
FILE *out = fopen(tracefilename, "w");
xbt_assert(out, "Cannot write to %s", tracefilename);
sg_host_t *wsl = SD_task_get_workstation_list(task);
switch (kind) {
case SD_TASK_COMP_SEQ:
- fprintf(out, "[%f] %s compute %f # %s\n",
- SD_task_get_start_time(task),
- sg_host_get_name(wsl[0]), SD_task_get_amount(task),
- SD_task_get_name(task));
+ fprintf(out, "[%f] %s compute %f # %s\n", SD_task_get_start_time(task), sg_host_get_name(wsl[0]),
+ SD_task_get_amount(task), SD_task_get_name(task));
break;
case SD_TASK_COMM_E2E:
- fprintf(out, "[%f] %s send %s %f # %s\n",
- SD_task_get_start_time(task),
- sg_host_get_name(wsl[0]),
- sg_host_get_name(wsl[1]), SD_task_get_amount(task),
- SD_task_get_name(task));
- fprintf(out, "[%f] %s recv %s %f # %s\n",
- SD_task_get_finish_time(task),
- sg_host_get_name(wsl[1]),
- sg_host_get_name(wsl[0]), SD_task_get_amount(task),
- SD_task_get_name(task));
+ fprintf(out, "[%f] %s send %s %f # %s\n", SD_task_get_start_time(task), sg_host_get_name(wsl[0]),
+ sg_host_get_name(wsl[1]), SD_task_get_amount(task), SD_task_get_name(task));
+ fprintf(out, "[%f] %s recv %s %f # %s\n", SD_task_get_finish_time(task), sg_host_get_name(wsl[1]),
+ sg_host_get_name(wsl[0]), SD_task_get_amount(task), SD_task_get_name(task));
break;
default:
- xbt_die("Task %s is of unknown kind %d", SD_task_get_name(task),
- SD_task_get_kind(task));
+ xbt_die("Task %s is of unknown kind %d", SD_task_get_name(task), SD_task_get_kind(task));
}
SD_task_destroy(task);
}
fclose(out);
xbt_dynar_free_container(&dax);
- /* exit */
+
SD_exit();
return 0;
}
add_executable(simulate_dot simulate_dot.c)
add_executable(dot_test2 dot_test2.c)
- if(NOT WIN32)
- target_link_libraries(dot_test simgrid pthread m)
- target_link_libraries(ptg_test simgrid pthread m)
- target_link_libraries(simulate_dot simgrid pthread m)
- target_link_libraries(dot_test2 simgrid pthread m)
- else()
- target_link_libraries(dot_test simgrid)
- target_link_libraries(ptg_test simgrid)
- target_link_libraries(simulate_dot simgrid)
- target_link_libraries(dot_test2 simgrid)
- endif()
- 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}/dot_test; ${CMAKE_CURRENT_BINARY_DIR}/simulate_dot;")
+ target_link_libraries(dot_test simgrid)
+ target_link_libraries(ptg_test simgrid)
+ target_link_libraries(simulate_dot simgrid)
+ target_link_libraries(dot_test2 simgrid)
endif()
set(tesh_files
/* 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 <stdlib.h>
#include <stdio.h>
#include "simgrid/simdag.h"
#include "xbt/log.h"
-#include "xbt/ex.h"
#include <string.h>
#include <libgen.h>
/* 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 <stdlib.h>
-#include <stdio.h>
#include "simgrid/simdag.h"
#include "xbt/log.h"
-#include "xbt/ex.h"
-#include <string.h>
XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Logging specific to this SimDag example");
/* 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 <stdlib.h>
#include <stdio.h>
#include "simgrid/simdag.h"
#include "xbt/log.h"
-#include "xbt/ex.h"
-#include <string.h>
-#include <libgen.h>
XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Logging specific to this SimDag example");
/* 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 <stdlib.h>
#include <stdio.h>
#include "simgrid/simdag.h"
#include "xbt/log.h"
-#include "xbt/ex.h"
#include <string.h>
#include <libgen.h>
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
add_executable(goal_test goal_test.c)
-
-### Add definitions for compile
-if(NOT WIN32)
- target_link_libraries(goal_test simgrid pthread )
-else()
- target_link_libraries(goal_test simgrid)
-endif()
+target_link_libraries(goal_test simgrid)
set(examples_src
${examples_src}
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
add_executable(sd_io sd_io.c)
-
-### Add definitions for compile
-if(NOT WIN32)
- target_link_libraries(sd_io simgrid pthread m)
-else()
- target_link_libraries(sd_io simgrid)
-endif()
+target_link_libraries(sd_io simgrid)
set(tesh_files
${tesh_files}
/* 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 <stdio.h>
-#include <stdlib.h>
#include "simgrid/simdag.h"
-#include "xbt/ex.h"
#include "xbt/log.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(sd_io,
- "Logging specific to this SimDag example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(sd_io, "Logging specific to this SimDag example");
+
int main(int argc, char **argv)
{
unsigned int ctr;
xbt_dict_cursor_t cursor = NULL;
SD_init(&argc, argv);
- /* Set the workstation model to default, as storage is not supported by the
- * ptask_L07 model yet.
- */
+ /* Set the workstation model to default, as storage is not supported by the ptask_L07 model yet. */
SD_config("host/model", "default");
SD_create_environment(argv[1]);
workstations = sg_host_list();
for (ctr=0; ctr<total_nworkstations;ctr++){
current_storage_list = sg_host_get_mounted_storage_list(workstations[ctr]);
xbt_dict_foreach(current_storage_list,cursor,mount_name,storage_name)
- XBT_INFO("Workstation '%s' mounts '%s'",
- sg_host_get_name(workstations[ctr]), mount_name);
+ XBT_INFO("Workstation '%s' mounts '%s'", sg_host_get_name(workstations[ctr]), mount_name);
xbt_dict_free(¤t_storage_list);
}
+
SD_exit();
return 0;
}
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
add_executable(sd_prop sd_prop.c)
-
-### Add definitions for compile
-if(NOT WIN32)
- target_link_libraries(sd_prop simgrid pthread )
-else()
- target_link_libraries(sd_prop simgrid)
-endif()
+target_link_libraries(sd_prop simgrid)
set(tesh_files
${tesh_files}
-/* Copyright (c) 2007-2015. The SimGrid Team.
+/* Copyright (c) 2007-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 <stdio.h>
-#include <stdlib.h>
#include "simgrid/simdag.h"
-#include "xbt/ex.h"
#include "xbt/log.h"
-#include "xbt/dynar.h"
#include "xbt/dict.h"
XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Property test");
int main(int argc, char **argv)
{
- sg_host_t w1;
- sg_host_t w2;
- const char *name1;
- const char *name2;
+ sg_host_t h1, h2;
+ const char *name1, *name2;
xbt_dict_t props;
xbt_dict_cursor_t cursor = NULL;
char *key, *data;
/* SD initialization */
SD_init(&argc, argv);
- xbt_assert(argc > 1,
- "Usage: %s platform_file\n\tExample: %s ../two_hosts.xml",
- argv[0], argv[0]);
+ xbt_assert(argc > 1, "Usage: %s platform_file\n\tExample: %s ../../platforms/prop.xml", argv[0], argv[0]);
SD_create_environment(argv[1]);
/* init of platform elements */
- w1 = sg_host_by_name("host1");
- w2 = sg_host_by_name("host2");
- name1 = sg_host_get_name(w1);
- name2 = sg_host_get_name(w2);
-
-
- /* The host properties can be retrieved from all interfaces */
+ h1 = sg_host_by_name("host1");
+ h2 = sg_host_by_name("host2");
+ name1 = sg_host_get_name(h1);
+ name2 = sg_host_get_name(h2);
+ /* Get the property list of 'host1' */
XBT_INFO("Property list for host %s", name1);
- /* Get the property list of the workstation 1 */
- props = sg_host_get_properties(w1);
-
+ props = sg_host_get_properties(h1);
/* Trying to set a new property */
xbt_dict_set(props, "NewProp", strdup("newValue"), xbt_free_f);
- /* Print the properties of the workstation 1 */
+ /* Print the properties of 'host1' */
xbt_dict_foreach(props, cursor, key, data) {
XBT_INFO("\tProperty: %s has value: %s", key, data);
}
/* Try to get a property that does not exist */
-
- value = sg_host_get_property_value(w1, noexist);
+ value = sg_host_get_property_value(h1, noexist);
XBT_INFO("\tProperty: %s has value: %s", noexist, value?value:"Undefined (NULL)");
-
+ /* Get the property list of 'host2' */
XBT_INFO("Property list for host %s", name2);
- /* Get the property list of the workstation 2 */
- props = sg_host_get_properties(w2);
- cursor = NULL;
+ props = sg_host_get_properties(h2);
- /* Print the properties of the workstation 2 */
+ /* Print the properties of 'host2' */
xbt_dict_foreach(props, cursor, key, data) {
XBT_INFO("\tProperty: %s on host: %s", key, data);
}
/* Modify an existing property test. First check it exists */
XBT_INFO("Modify an existing property");
- value = sg_host_get_property_value(w2, exist);
+ value = sg_host_get_property_value(h2, exist);
if (value == NULL)
XBT_INFO("\tProperty: %s is undefined", exist);
else {
}
/* Test if we have changed the value */
- value = sg_host_get_property_value(w2, exist);
+ value = sg_host_get_property_value(h2, exist);
XBT_INFO("\tProperty: %s new value: %s", exist, value?value:"Undefined (NULL)");
/* Test if properties are displayed by sg_host_dump */
- sg_host_dump(w2);
+ sg_host_dump(h2);
SD_exit();
return 0;
-/* Copyright (c) 2012-2015. The SimGrid Team.
+/* Copyright (c) 2012-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 <stdio.h>
-#include <stdlib.h>
#include "simgrid/simdag.h"
-#include "xbt/ex.h"
#include "xbt/log.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(sd_avail,
- "Logging specific to this SimDag example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(sd_avail, "Logging specific to this SimDag example");
/* Test of dynamic availability traces
* Scenario:
int main(int argc, char **argv)
{
unsigned int ctr;
- const sg_host_t *workstations;
+ const sg_host_t *hosts;
SD_task_t t1, c1, t2, c2, t3, c3, t4, task;
xbt_dynar_t changed_tasks;
SD_init(&argc, argv);
SD_create_environment(argv[1]);
- workstations = sg_host_list();
+ hosts = sg_host_list();
t1 = SD_task_create_comp_seq("t1", NULL, 25000000);
c1 = SD_task_create_comm_e2e("c1", NULL, 125000000);
/* Schedule tasks t1 and w3 on first host, t2 on second host */
/* Transfers are auto-scheduled */
- SD_task_schedulel(t1, 1, workstations[0]);
- SD_task_schedulel(t2, 1, workstations[1]);
- SD_task_schedulel(t3, 1, workstations[0]);
- SD_task_schedulel(t4, 1, workstations[1]);
+ SD_task_schedulel(t1, 1, hosts[0]);
+ SD_task_schedulel(t2, 1, hosts[1]);
+ SD_task_schedulel(t3, 1, hosts[0]);
+ SD_task_schedulel(t4, 1, hosts[1]);
/* Add some watchpoint upon task completion */
SD_task_watch(t1, SD_DONE);
SD_task_watch(c3, SD_DONE);
SD_task_watch(t4, SD_DONE);
- while (!xbt_dynar_is_empty((changed_tasks = SD_simulate(-1.0)))) {
- XBT_INFO("link1: bw=%.0f, lat=%f",
- SD_route_get_bandwidth(workstations[0], workstations[1]),
- SD_route_get_latency(workstations[0], workstations[1]));
- XBT_INFO("Jupiter: speed=%.0f",
- sg_host_speed(workstations[0])*
- sg_host_get_available_speed(workstations[0]));
- XBT_INFO("Tremblay: speed=%.0f",
- sg_host_speed(workstations[1])*
- sg_host_get_available_speed(workstations[1]));
+ while (!xbt_dynar_is_empty((changed_tasks = SD_simulate(-1.0)))) {
+ XBT_INFO("link1: bw=%.0f, lat=%f", SD_route_get_bandwidth(hosts[0], hosts[1]),
+ SD_route_get_latency(hosts[0], hosts[1]));
+ XBT_INFO("Jupiter: speed=%.0f", sg_host_speed(hosts[0])* sg_host_get_available_speed(hosts[0]));
+ XBT_INFO("Tremblay: speed=%.0f", sg_host_speed(hosts[1])* sg_host_get_available_speed(hosts[1]));
xbt_dynar_foreach(changed_tasks, ctr, task) {
- XBT_INFO("Task '%s' start time: %f, finish time: %f",
- SD_task_get_name(task),
+ XBT_INFO("Task '%s' start time: %f, finish time: %f", SD_task_get_name(task),
SD_task_get_start_time(task), SD_task_get_finish_time(task));
if (SD_task_get_state(task)==SD_DONE)
SD_task_destroy(task);
* under the terms of the license (GNU LGPL) which comes with this package. */
#include <stdio.h>
-#include <stdlib.h>
#include "simgrid/simdag.h"
-#include "xbt/ex.h"
#include "xbt/log.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(sd_comm_throttling,
- "Logging specific to this SimDag example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(sd_comm_throttling, "Logging specific to this SimDag example");
int main(int argc, char **argv)
{
unsigned int ctr;
- const char *platform_file;
- const sg_host_t *workstations;
+ const sg_host_t *hosts;
SD_task_t task, taskA, taskB, taskC, taskD, taskE;
xbt_dynar_t changed_tasks;
- /* initialization of SD */
SD_init(&argc, argv);
-
- /* xbt_log_control_set("sd.thres=debug"); */
-
- xbt_assert(argc > 1, "Usage: %s platform_file\n"
- "\nExample: %s two_clusters.xml", argv[0], argv[0]);
+ xbt_assert(argc > 1, "Usage: %s platform_file\n\nExample: %s two_clusters.xml", argv[0], argv[0]);
/* creation of the environment */
- platform_file = argv[1];
- SD_create_environment(platform_file);
-
- workstations = sg_host_list();
+ SD_create_environment(argv[1]);
+
+ hosts = sg_host_list();
/* creation of some typed tasks and their dependencies */
- /* chain of five tasks, three compute tasks with two data transfers */
- /* in between */
+ /* chain of five tasks, three compute tasks with two data transfers in between */
taskA = SD_task_create_comp_seq("Task A", NULL, 5e9);
taskB = SD_task_create_comm_e2e("Task B", NULL, 1e7);
taskC = SD_task_create_comp_seq("Task C", NULL, 5e9);
/* Auto-schedule the compute tasks on three different workstations */
/* Data transfer tasks taskB and taskD are automagically scheduled */
- SD_task_schedulel(taskA, 1, workstations[0]);
- SD_task_schedulel(taskC, 1, workstations[1]);
- SD_task_schedulel(taskE, 1, workstations[0]);
+ SD_task_schedulel(taskA, 1, hosts[0]);
+ SD_task_schedulel(taskC, 1, hosts[1]);
+ SD_task_schedulel(taskE, 1, hosts[0]);
while (!xbt_dynar_is_empty((changed_tasks = SD_simulate(-1.0)))) {
XBT_INFO("Simulation stopped after %.4f seconds", SD_get_clock());
xbt_dynar_foreach(changed_tasks, ctr, task) {
- XBT_INFO("Task '%s' start time: %f, finish time: %f",
- SD_task_get_name(task),
- SD_task_get_start_time(task),
- SD_task_get_finish_time(task));
-
+ XBT_INFO("Task '%s' start time: %f, finish time: %f", SD_task_get_name(task), SD_task_get_start_time(task),
+ SD_task_get_finish_time(task));
}
+
/* let throttle the communication for taskD if its parent is SD_DONE */
- /* the bandwidth is 1.25e8, the data size is 1e7, and we want to throttle
- * the bandwidth by a factor 2. the rate is then 1.25e8/(2*1e7)=6.25
- * Changing the rate is possible before the task execution starts (in SD_RUNNING
- * state).
+ /* the bandwidth is 1.25e8, the data size is 1e7, and we want to throttle the bandwidth by a factor 2.
+ * The rate is then 1.25e8/(2*1e7)=6.25
+ * Changing the rate is possible before the task execution starts (in SD_RUNNING state).
*/
if (SD_task_get_state(taskC) == SD_DONE && SD_task_get_state(taskD) < SD_RUNNING)
SD_task_set_rate(taskD, 6.25);
}
XBT_DEBUG("Destroying tasks...");
-
SD_task_destroy(taskA);
SD_task_destroy(taskB);
SD_task_destroy(taskC);
SD_task_destroy(taskE);
XBT_DEBUG("Tasks destroyed. Exiting SimDag...");
-
SD_exit();
return 0;
}
-/* Copyright (c) 2006-2010, 2012-2015. The SimGrid Team.
+/* Copyright (c) 2006-2010, 2012-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 <stdio.h>
-#include <stdlib.h>
#include "simgrid/simdag.h"
-#include "xbt/ex.h"
#include "xbt/log.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(sd_fail,
- "Logging specific to this SimDag example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(sd_fail, "Logging specific to this SimDag example");
int main(int argc, char **argv)
{
SD_task_t task;
double computation_amount[1];
double communication_amount[2] = { 0 };
- sg_host_t workstation_list[1];
+ sg_host_t hosts[1];
/* initialization of SD */
SD_init(&argc, argv);
SD_task_watch(task, SD_FAILED);
SD_task_watch(task, SD_DONE);
- XBT_INFO("Schedule task '%s' on workstation 'Faulty Host'",
- SD_task_get_name(task));
+ XBT_INFO("Schedule task '%s' on 'Faulty Host'", SD_task_get_name(task));
SD_task_schedulel(task, 1, sg_host_by_name("Faulty Host"));
SD_task_dump(task);
- XBT_INFO("Task '%s' has failed. %.f flops remain to be done",
- SD_task_get_name(task),
+ XBT_INFO("Task '%s' has failed. %.f flops remain to be done", SD_task_get_name(task),
SD_task_get_remaining_amount(task));
- XBT_INFO("let's unschedule task '%s' and reschedule it on the 'Safe Host'",
- SD_task_get_name(task));
+ XBT_INFO("let's unschedule task '%s' and reschedule it on the 'Safe Host'", SD_task_get_name(task));
SD_task_unschedule(task);
SD_task_schedulel(task, 1, sg_host_by_name("Safe Host"));
SD_simulate(-1.0);
SD_task_dump(task);
- XBT_INFO("Task '%s' start time: %f, finish time: %f",
- SD_task_get_name(task),
- SD_task_get_start_time(task),
- SD_task_get_finish_time(task));
+ XBT_INFO("Task '%s' start time: %f, finish time: %f", SD_task_get_name(task), SD_task_get_start_time(task),
+ SD_task_get_finish_time(task));
SD_task_destroy(task);
task=NULL;
computation_amount[0] = 2e10;
- XBT_INFO("Schedule task '%s' on workstation 'Faulty Host'",
- SD_task_get_name(task));
+ XBT_INFO("Schedule task '%s' on 'Faulty Host'", SD_task_get_name(task));
- workstation_list[0] = sg_host_by_name("Faulty Host");
- SD_task_schedule(task, 1, workstation_list,
- computation_amount, communication_amount,-1);
+ hosts[0] = sg_host_by_name("Faulty Host");
+ SD_task_schedule(task, 1, hosts, computation_amount, communication_amount,-1);
SD_simulate(-1.0);
SD_task_dump(task);
- XBT_INFO("Task '%s' has failed. %.f flops remain to be done",
- SD_task_get_name(task),
+ XBT_INFO("Task '%s' has failed. %.f flops remain to be done", SD_task_get_name(task),
SD_task_get_remaining_amount(task));
- XBT_INFO("let's unschedule task '%s' and reschedule it on the 'Safe Host'",
- SD_task_get_name(task));
+ XBT_INFO("let's unschedule task '%s' and reschedule it on the 'Safe Host'", SD_task_get_name(task));
SD_task_unschedule(task);
- workstation_list[0] = sg_host_by_name("Safe Host");
+ hosts[0] = sg_host_by_name("Safe Host");
- SD_task_schedule(task, 1, workstation_list,
- computation_amount, communication_amount,-1);
+ SD_task_schedule(task, 1, hosts, computation_amount, communication_amount,-1);
XBT_INFO("Run the simulation again");
SD_simulate(-1.0);
SD_task_dump(task);
- XBT_INFO("Task '%s' start time: %f, finish time: %f",
- SD_task_get_name(task),
- SD_task_get_start_time(task),
+ XBT_INFO("Task '%s' start time: %f, finish time: %f", SD_task_get_name(task), SD_task_get_start_time(task),
SD_task_get_finish_time(task));
SD_task_destroy(task);
/* 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 <stdio.h>
-#include <stdlib.h>
#include "simgrid/simdag.h"
#include "xbt/ex.h"
#include "xbt/log.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(sd_test,
- "Logging specific to this SimDag example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(sd_test, "Logging specific to this SimDag example");
int main(int argc, char **argv)
{
int i;
unsigned int ctr;
- const char *platform_file;
- const sg_host_t *workstations;
- const char *name1;
- const char *name2;
- double computation_amount1;
- double computation_amount2;
- double communication_amount12;
- double communication_amount21;
+ const sg_host_t *hosts;
+ const char *name1, *name2;
+ double comp_amount1, comp_amount2;
+ double comm_amount12, comm_amount21;
const SD_link_t *route;
int route_size;
SD_task_t task, taskA, taskB, taskC, taskD, checkB, checkD;
xbt_dynar_t changed_tasks;
xbt_ex_t ex;
- const int workstation_number = 2;
- sg_host_t workstation_list[2];
+ const int host_count = 2;
+ sg_host_t host_list[2];
double computation_amount[2];
double communication_amount[4] = { 0 };
double rate = -1.0;
- sg_host_t w1, w2;
+ sg_host_t h1, h2;
/* initialization of SD */
SD_init(&argc, argv);
- /* xbt_log_control_set("sd.thres=debug"); */
-
- xbt_assert(argc > 1, "Usage: %s platform_file\n"
- "\nExample: %s two_clusters.xml", argv[0], argv[0]);
-
- /* creation of the environment */
- platform_file = argv[1];
- SD_create_environment(platform_file);
+ xbt_assert(argc > 1, "Usage: %s platform_file\n\nExample: %s two_clusters.xml", argv[0], argv[0]);
+ SD_create_environment(argv[1]);
/* test the estimation functions */
- workstations = sg_host_list();
- w1 = workstations[0];
- w2 = workstations[1];
- name1 = sg_host_get_name(w1);
- name2 = sg_host_get_name(w2);
- computation_amount1 = 2000000;
- computation_amount2 = 1000000;
- communication_amount12 = 2000000;
- communication_amount21 = 3000000;
- XBT_INFO("Computation time for %f flops on %s: %f", computation_amount1,
- name1, computation_amount1/sg_host_speed(w1));
- XBT_INFO("Computation time for %f flops on %s: %f", computation_amount2,
- name2, computation_amount2/sg_host_speed(w2));
+ hosts = sg_host_list();
+ h1 = hosts[0];
+ h2 = hosts[1];
+ name1 = sg_host_get_name(h1);
+ name2 = sg_host_get_name(h2);
+ comp_amount1 = 2000000;
+ comp_amount2 = 1000000;
+ comm_amount12 = 2000000;
+ comm_amount21 = 3000000;
+ XBT_INFO("Computation time for %f flops on %s: %f", comp_amount1, name1, comp_amount1/sg_host_speed(h1));
+ XBT_INFO("Computation time for %f flops on %s: %f", comp_amount2, name2, comp_amount2/sg_host_speed(h2));
XBT_INFO("Route between %s and %s:", name1, name2);
- route = SD_route_get_list(w1, w2);
- route_size = SD_route_get_size(w1, w2);
+ route = SD_route_get_list(h1, h2);
+ route_size = SD_route_get_size(h1, h2);
for (i = 0; i < route_size; i++) {
- XBT_INFO(" Link %s: latency = %f, bandwidth = %f",
- sg_link_name(route[i]),
- sg_link_latency(route[i]),
- sg_link_bandwidth(route[i]));
+ XBT_INFO(" Link %s: latency = %f, bandwidth = %f", sg_link_name(route[i]), sg_link_latency(route[i]),
+ sg_link_bandwidth(route[i]));
}
- XBT_INFO("Route latency = %f, route bandwidth = %f",
- SD_route_get_latency(w1, w2),
- SD_route_get_bandwidth(w1, w2));
- XBT_INFO("Communication time for %f bytes between %s and %s: %f",
- communication_amount12, name1, name2,
- SD_route_get_latency(w1, w2) +
- communication_amount12 / SD_route_get_bandwidth(w1, w2));
- XBT_INFO("Communication time for %f bytes between %s and %s: %f",
- communication_amount21, name2, name1,
- SD_route_get_latency(w2, w1) +
- communication_amount21 / SD_route_get_bandwidth(w2, w1));
+ XBT_INFO("Route latency = %f, route bandwidth = %f", SD_route_get_latency(h1, h2), SD_route_get_bandwidth(h1, h2));
+ XBT_INFO("Communication time for %f bytes between %s and %s: %f", comm_amount12, name1, name2,
+ SD_route_get_latency(h1, h2) + comm_amount12 / SD_route_get_bandwidth(h1, h2));
+ XBT_INFO("Communication time for %f bytes between %s and %s: %f", comm_amount21, name2, name1,
+ SD_route_get_latency(h2, h1) + comm_amount21 / SD_route_get_bandwidth(h2, h1));
/* creation of the tasks and their dependencies */
taskA = SD_task_create("Task A", NULL, 10.0);
taskD = SD_task_create("Task D", NULL, 60.0);
/* try to attach and retrieve user data to a task */
- SD_task_set_data(taskA, (void*) &computation_amount1);
- if (computation_amount1 != (*((double*) SD_task_get_data(taskA))))
+ SD_task_set_data(taskA, (void*) &comp_amount1);
+ if (comp_amount1 != (*((double*) SD_task_get_data(taskA))))
XBT_ERROR("User data was corrupted by a simple set/get");
SD_task_dependency_add(NULL, NULL, taskB, taskA);
SD_task_dependency_add(NULL, NULL, taskD, taskC);
SD_task_dependency_add(NULL, NULL, taskB, taskC);
-
-
TRY {
SD_task_dependency_add(NULL, NULL, taskA, taskA); /* shouldn't work and must raise an exception */
xbt_die("Hey, I can add a dependency between Task A and Task A!");
xbt_ex_free(ex);
}
-
/* if everything is ok, no exception is forwarded or rethrown by main() */
/* watch points */
SD_task_watch(taskB, SD_DONE);
SD_task_unwatch(taskD, SD_DONE);
-
/* scheduling parameters */
- workstation_list[0] = w1;
- workstation_list[1] = w2;
- computation_amount[0] = computation_amount1;
- computation_amount[1] = computation_amount2;
+ host_list[0] = h1;
+ host_list[1] = h2;
+ computation_amount[0] = comp_amount1;
+ computation_amount[1] = comp_amount2;
- communication_amount[1] = communication_amount12;
- communication_amount[2] = communication_amount21;
+ communication_amount[1] = comm_amount12;
+ communication_amount[2] = comm_amount21;
/* estimated time */
task = taskD;
- XBT_INFO("Estimated time for '%s': %f", SD_task_get_name(task),
- SD_task_get_execution_time(task, workstation_number,
- workstation_list, computation_amount,
- communication_amount));
-
- /* let's launch the simulation! */
-
- SD_task_schedule(taskA, workstation_number, workstation_list,
- computation_amount, communication_amount, rate);
- SD_task_schedule(taskB, workstation_number, workstation_list,
- computation_amount, communication_amount, rate);
- SD_task_schedule(taskC, workstation_number, workstation_list,
- computation_amount, communication_amount, rate);
- SD_task_schedule(taskD, workstation_number, workstation_list,
- computation_amount, communication_amount, rate);
+ XBT_INFO("Estimated time for '%s': %f", SD_task_get_name(task), SD_task_get_execution_time(task, host_count,
+ host_list, computation_amount, communication_amount));
+
+ SD_task_schedule(taskA, host_count, host_list, computation_amount, communication_amount, rate);
+ SD_task_schedule(taskB, host_count, host_list, computation_amount, communication_amount, rate);
+ SD_task_schedule(taskC, host_count, host_list, computation_amount, communication_amount, rate);
+ SD_task_schedule(taskD, host_count, host_list, computation_amount, communication_amount, rate);
changed_tasks = SD_simulate(-1.0);
xbt_dynar_foreach(changed_tasks, ctr, task) {
- XBT_INFO("Task '%s' start time: %f, finish time: %f",
- SD_task_get_name(task),
+ XBT_INFO("Task '%s' start time: %f, finish time: %f", SD_task_get_name(task),
SD_task_get_start_time(task), SD_task_get_finish_time(task));
}
xbt_dynar_get_cpy(changed_tasks, 0, &checkD);
xbt_dynar_get_cpy(changed_tasks, 1, &checkB);
- xbt_assert(checkD == taskD &&
- checkB == taskB, "Unexpected simulation results");
+ xbt_assert(checkD == taskD && checkB == taskB, "Unexpected simulation results");
XBT_DEBUG("Destroying tasks...");
-
SD_task_destroy(taskA);
SD_task_destroy(taskB);
SD_task_destroy(taskC);
SD_task_destroy(taskD);
XBT_DEBUG("Tasks destroyed. Exiting SimDag...");
-
SD_exit();
return 0;
}
/* 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 <stdio.h>
-#include <stdlib.h>
#include <string.h>
#include "simgrid/simdag.h"
#include "xbt/log.h"
-#include "xbt/sysdep.h" /* calloc, printf */
-
-XBT_LOG_NEW_DEFAULT_CATEGORY(sd_test,
- "Logging specific to this SimDag example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(sd_test, "Logging specific to this SimDag example");
static int nameCompareHosts(const void *n1, const void *n2)
{
- return strcmp(sg_host_get_name(*((sg_host_t *) n1)),
- sg_host_get_name(*((sg_host_t *) n2)));
+ return strcmp(sg_host_get_name(*((sg_host_t *) n1)), sg_host_get_name(*((sg_host_t *) n2)));
}
int main(int argc, char **argv)
double final_cost = 5e+9;
double *ParComp_wcomm2_table;
- /* SD initialization */
SD_init(&argc, argv);
- /* creation of the environment */
- xbt_assert(strstr(argv[1],".xml"),
- "Unsupported platform description style (not XML): %s",
- argv[1]);
+ xbt_assert(strstr(argv[1],".xml"), "Unsupported platform description style (not XML): %s", argv[1]);
SD_create_environment(argv[1]);
/* getting platform infos */
hosts = sg_host_list();
/* sorting hosts by hostname */
- qsort((void *) hosts, n_hosts, sizeof(sg_host_t),
- nameCompareHosts);
+ qsort((void *) hosts, n_hosts, sizeof(sg_host_t), nameCompareHosts);
/* creation of the tasks */
taskInit = SD_task_create("Initial", NULL, 1.0);
taskFinal = SD_task_create("Final", NULL, 1.0);
ParComp_wcomm2 = SD_task_create("Par Comp with comm 2", NULL, 1.0);
-
/* creation of the dependencies */
SD_task_dependency_add(NULL, NULL, taskInit, PtoPComm1);
SD_task_dependency_add(NULL, NULL, taskInit, PtoPComm2);
SD_task_dependency_add(NULL, NULL, ParComp_wcomm2, taskFinal);
SD_task_dependency_add(NULL, NULL, PtoPComm2, taskFinal);
-
- /* scheduling parameters */
-
/* large point-to-point communication (0.1 sec duration) */
PtoPcomm1_hosts[0] = hosts[0];
PtoPcomm1_hosts[1] = hosts[1];
/* parallel task with intra communications */
/* Communication domination (0.1 sec duration) */
-
ParComp_wcomm2_table = xbt_new0(double, 25);
for (i = 0; i < 5; i++) {
}
}
- /* Sequential task */
-
-
/* scheduling the tasks */
- SD_task_schedule(taskInit, 1, hosts, SD_SCHED_NO_COST, SD_SCHED_NO_COST,
- -1.0);
- SD_task_schedule(PtoPComm1, 2, PtoPcomm1_hosts, SD_SCHED_NO_COST,
- PtoPcomm1_table, -1.0);
- SD_task_schedule(PtoPComm2, 2, PtoPcomm2_hosts, SD_SCHED_NO_COST,
- PtoPcomm2_table, -1.0);
- SD_task_schedule(ParComp_wocomm, 5, ParComp_wocomm_hosts,
- ParComp_wocomm_cost, ParComp_wocomm_table, -1.0);
- SD_task_schedule(IntraRedist, 5, IntraRedist_hosts, IntraRedist_cost,
- IntraRedist_table, -1.0);
- SD_task_schedule(ParComp_wcomm1, 5, ParComp_wcomm1_hosts,
- ParComp_wcomm1_cost, ParComp_wcomm1_table, -1.0);
- SD_task_schedule(InterRedist, 10, hosts, InterRedist_cost,
- InterRedist_table, -1.0);
- SD_task_schedule(ParComp_wcomm2, 5, ParComp_wcomm2_hosts,
- ParComp_wcomm2_cost, ParComp_wcomm2_table, -1.0);
- SD_task_schedule(taskFinal, 1, &(hosts[9]), &final_cost,
- SD_SCHED_NO_COST, -1.0);
+ SD_task_schedule(taskInit, 1, hosts, SD_SCHED_NO_COST, SD_SCHED_NO_COST, -1.0);
+ SD_task_schedule(PtoPComm1, 2, PtoPcomm1_hosts, SD_SCHED_NO_COST, PtoPcomm1_table, -1.0);
+ SD_task_schedule(PtoPComm2, 2, PtoPcomm2_hosts, SD_SCHED_NO_COST, PtoPcomm2_table, -1.0);
+ SD_task_schedule(ParComp_wocomm, 5, ParComp_wocomm_hosts, ParComp_wocomm_cost, ParComp_wocomm_table, -1.0);
+ SD_task_schedule(IntraRedist, 5, IntraRedist_hosts, IntraRedist_cost, IntraRedist_table, -1.0);
+ SD_task_schedule(ParComp_wcomm1, 5, ParComp_wcomm1_hosts, ParComp_wcomm1_cost, ParComp_wcomm1_table, -1.0);
+ SD_task_schedule(InterRedist, 10, hosts, InterRedist_cost, InterRedist_table, -1.0);
+ SD_task_schedule(ParComp_wcomm2, 5, ParComp_wcomm2_hosts, ParComp_wcomm2_cost, ParComp_wcomm2_table, -1.0);
+ SD_task_schedule(taskFinal, 1, &(hosts[9]), &final_cost, SD_SCHED_NO_COST, -1.0);
/* let's launch the simulation! */
SD_simulate(-1.0);
XBT_INFO("Simulation time: %f", SD_get_clock());
-
free(ParComp_wocomm_table);
free(IntraRedist_cost);
free(IntraRedist_table);
-/* Copyright (c) 2006-2010, 2012-2015. The SimGrid Team.
+/* Copyright (c) 2006-2010, 2012-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 <stdio.h>
-#include <stdlib.h>
#include "simgrid/simdag.h"
-#include "xbt/ex.h"
#include "xbt/log.h"
-XBT_LOG_NEW_DEFAULT_CATEGORY(sd_typed_tasks_test,
- "Logging specific to this SimDag example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(sd_typed_tasks_test, "Logging specific to this SimDag example");
int main(int argc, char **argv)
{
int i;
unsigned int ctr;
- const char *platform_file;
- const sg_host_t *workstations;
+ const sg_host_t *hosts;
SD_task_t task, seq_comp1, e2e_comm, seq_comp2;
SD_task_t par_comp1, redist, par_comp2, par_comp3;
xbt_dynar_t changed_tasks;
double computation_amount[4];
double communication_amount[16] = { 0 };
- sg_host_t workstation_list[4];
-
- /* initialization of SD */
- SD_init(&argc, argv);
+ sg_host_t host_list[4];
- /* xbt_log_control_set("sd.thres=debug"); */
+ SD_init(&argc, argv);
- xbt_assert(argc > 1, "Usage: %s platform_file\n"
- "\nExample: %s two_clusters.xml", argv[0], argv[0]);
+ xbt_assert(argc > 1, "Usage: %s platform_file\n\nExample: %s two_clusters.xml", argv[0], argv[0]);
+ SD_create_environment(argv[1]);
- /* creation of the environment */
- platform_file = argv[1];
- SD_create_environment(platform_file);
-
- workstations = sg_host_list();
+ hosts = sg_host_list();
/* creation of some typed tasks and their dependencies */
seq_comp1 = SD_task_create_comp_seq("Seq. comp. 1", NULL, 1e9);
SD_task_dependency_add(NULL, NULL, par_comp1, redist);
SD_task_dependency_add(NULL, NULL, redist, par_comp2);
- SD_task_schedulel(seq_comp1, 1, workstations[8]);
- SD_task_schedulel(seq_comp2, 1, workstations[9]);
+ SD_task_schedulel(seq_comp1, 1, hosts[8]);
+ SD_task_schedulel(seq_comp2, 1, hosts[9]);
- SD_task_schedulev(par_comp1, 4, workstations);
- SD_task_schedulev(par_comp2, 3, workstations);
+ SD_task_schedulev(par_comp1, 4, hosts);
+ SD_task_schedulev(par_comp2, 3, hosts);
- /* Let's unschedule these tasks and test the auto-scheduling in the
- * opposite way.
- */
+ /* Let's unschedule these tasks and test the auto-scheduling in the opposite way. */
SD_task_unschedule(par_comp1);
SD_task_unschedule(par_comp2);
SD_task_unschedule(redist); /* yes, it was scheduled too */
- SD_task_schedulev(par_comp2, 3, workstations);
- SD_task_schedulev(par_comp1, 4, workstations);
+ SD_task_schedulev(par_comp2, 3, hosts);
+ SD_task_schedulev(par_comp1, 4, hosts);
for (i=0;i<4;i++){
- workstation_list[i]=workstations[i+4];
+ host_list[i]=hosts[i+4];
/* Apply Amdahl's law manually assuming a 20% serial part */
computation_amount[i]=(0.2 + (1 - 0.2)/4) * SD_task_get_amount(par_comp3);
}
- SD_task_schedule(par_comp3, 4, workstation_list,
- computation_amount, communication_amount, -1);
+ SD_task_schedule(par_comp3, 4, host_list, computation_amount, communication_amount, -1);
changed_tasks = SD_simulate(-1.0);
xbt_dynar_foreach(changed_tasks, ctr, task) {
- XBT_INFO("Task '%s' start time: %f, finish time: %f",
- SD_task_get_name(task),
- SD_task_get_start_time(task), SD_task_get_finish_time(task));
+ XBT_INFO("Task '%s' start time: %f, finish time: %f", SD_task_get_name(task), SD_task_get_start_time(task),
+ SD_task_get_finish_time(task));
}
xbt_dynar_foreach(changed_tasks, ctr, task) {
$ $SG_TEST_EXENV ${bindir:=.}/sd_fail
> [0.000000] [xbt_cfg/INFO] Switching to the L07 model to handle parallel tasks.
> [0.000000] [sd_fail/INFO] First test: COMP_SEQ task
-> [0.000000] [sd_fail/INFO] Schedule task 'Poor task' on workstation 'Faulty Host'
+> [0.000000] [sd_fail/INFO] Schedule task 'Poor task' on 'Faulty Host'
> [10.000000] [sd_task/INFO] Displaying task Poor task
> [10.000000] [sd_task/INFO] - state: not runnable failed
> [10.000000] [sd_task/INFO] - kind: sequential computation
> [50.000000] [sd_task/INFO] - Dependencies to satisfy: 0
> [50.000000] [sd_fail/INFO] Task 'Poor task' start time: 10.000000, finish time: 50.000000
> [50.000000] [sd_fail/INFO] Second test: NON TYPED task
-> [50.000000] [sd_fail/INFO] Schedule task 'Poor parallel task' on workstation 'Faulty Host'
+> [50.000000] [sd_fail/INFO] Schedule task 'Poor parallel task' on 'Faulty Host'
> [60.000000] [sd_task/INFO] Displaying task Poor parallel task
> [60.000000] [sd_task/INFO] - state: not runnable failed
> [60.000000] [sd_task/INFO] - amount: 20000000000
/** @brief Link datatype
@ingroup SD_datatypes_management
- A link is a network node represented as a <em>name</em>, a <em>current
- bandwidth</em> and a <em>current latency</em>. A route is a list of
- links between two workstations.
+ A link is a network node represented as a <em>name</em>, a <em>bandwidth</em> and a <em>latency</em>.
+ A route is a list of links between two workstations.
@see SD_link_management */
typedef Link *SD_link_t;
/** @brief Task datatype
@ingroup SD_datatypes_management
- A task is some <em>computing amount</em> that can be executed
- in parallel on several workstations. A task may depend on other
- tasks, this means that the task cannot start until the other tasks are done.
- Each task has a <em>\ref e_SD_task_state_t "state"</em> indicating whether
- the task is scheduled, running, done, etc.
+ A task is some <em>computing amount</em> that can be executed in parallel on several hosts.
+ A task may depend on other tasks, which means that the task cannot start until the other tasks are done.
+ Each task has a <em>\ref e_SD_task_state_t "state"</em> indicating whether the task is scheduled, running, done, ...
@see SD_task_management */
typedef struct SD_task *SD_task_t;
/** @brief Storage datatype
@ingroup SD_datatypes_management
- TODO PV: comment it !
-
@see SD_storage_management */
typedef xbt_dictelm_t SD_storage_t;
* This section describes the functions for managing the hosts.
*
* A host is a place where a task can be executed.
- * A host is represented as a <em>physical resource with computing
- * capabilities</em> and has a <em>name</em>.
+ * A host is represented as a <em>physical resource with computing capabilities</em> and has a <em>name</em>.
*
* The hosts are created when you call the function SD_create_environment.
*
*
* This section describes the functions for managing the tasks.
*
- * A task is some <em>working amount</em> that can be executed in parallel on several hosts. A task may depend on other
- * tasks, this means that the task cannot start until the other tasks are done. Each task has a
- * <em>\ref e_SD_task_state_t "state"</em> indicating whether the task is scheduled, running, done, etc.
+ * A task is some <em>working amount</em> that can be executed in parallel on several hosts.
+ * A task may depend on other tasks, which means that the task cannot start until the other tasks are done.
+ * Each task has a <em>\ref e_SD_task_state_t "state"</em> indicating whether the task is scheduled, running, done, ...
*
* @see SD_task_t, SD_task_dependency_management
* @{
XBT_PUBLIC(void) SD_exit(void);
XBT_PUBLIC(xbt_dynar_t) SD_daxload(const char *filename);
XBT_PUBLIC(xbt_dynar_t) SD_dotload(const char *filename);
-XBT_PUBLIC(xbt_dynar_t) SD_PTG_dotload(const char *filename);
XBT_PUBLIC(xbt_dynar_t) SD_dotload_with_sched(const char *filename);
+XBT_PUBLIC(xbt_dynar_t) SD_PTG_dotload(const char *filename);
/** @} */
static double dax_parse_double(const char *string)
{
- int ret = 0;
double value;
- ret = sscanf(string, "%lg", &value);
+ int ret = sscanf(string, "%lg", &value);
xbt_assert (ret == 1, "Parse error on line %d: %s is not a double", dax_lineno, string);
return value;
}
void uniq_transfer_task_name(SD_task_t task)
{
SD_task_t child, parent;
- xbt_dynar_t children, parents;
- char *new_name;
- children = SD_task_get_children(task);
- parents = SD_task_get_parents(task);
+ xbt_dynar_t children = SD_task_get_children(task);
+ xbt_dynar_t parents = SD_task_get_parents(task);
xbt_dynar_get_cpy(children, 0, &child);
xbt_dynar_get_cpy(parents, 0, &parent);
- new_name = bprintf("%s_%s_%s", SD_task_get_name(parent), SD_task_get_name(task), SD_task_get_name(child));
+ char *new_name = bprintf("%s_%s_%s", SD_task_get_name(parent), SD_task_get_name(task), SD_task_get_name(child));
SD_task_set_name(task, new_name);
}
bool children_are_marked(SD_task_t task){
- SD_task_t child_task = NULL;
- bool all_marked = true;
SD_dependency_t depafter = NULL;
unsigned int count;
+
xbt_dynar_foreach(task->tasks_after,count,depafter){
- child_task = depafter->dst;
- //test marked
- if(child_task->marked == 0) {
- all_marked = false;
- break;
+ if(depafter->dst->marked == 0) {
+ return false;
}
- child_task = NULL;
}
- return all_marked;
+ return true;
}
bool parents_are_marked(SD_task_t task){
- SD_task_t parent_task = NULL;
- bool all_marked = true;
SD_dependency_t depbefore = NULL;
unsigned int count;
xbt_dynar_foreach(task->tasks_before,count,depbefore){
- parent_task = depbefore->src;
- //test marked
- if(parent_task->marked == 0) {
- all_marked = false;
- break;
+ if(depbefore->src->marked == 0) {
+ return false;
}
- parent_task = NULL;
}
- return all_marked;
+ return true;
}
bool acyclic_graph_detail(xbt_dynar_t dag){
return all_marked;
}
-
-
static YY_BUFFER_STATE input_buffer;
static xbt_dynar_t result;
void STag_dax__uses(void)
{
- SD_task_t file;
double size = dax_parse_double(A_dax__uses_size);
int is_input = (A_dax__uses_link == A_dax__uses_link_input);
// XBT_INFO("See <uses file=%s %s>",A_dax__uses_file,(is_input?"in":"out"));
- file = (SD_task_t)xbt_dict_get_or_null(files, A_dax__uses_file);
+ SD_task_t file = (SD_task_t)xbt_dict_get_or_null(files, A_dax__uses_file);
if (file == NULL) {
file = SD_task_create_comm_e2e(A_dax__uses_file, NULL, size);
xbt_dynar_pop(sd_global->initial_task_set,NULL);
task->state= SD_NOT_SCHEDULED;
xbt_dynar_push(sd_global->initial_task_set,&task);
-
task->marked = 0;
task->start_time = -1.0;
SD_task_t SD_task_create_comp_par_amdahl(const char *name, void *data, double flops_amount, double alpha)
{
xbt_assert(alpha < 1. && alpha >= 0., "Invalid parameter: alpha must be in [0.;1.[");
-
+
SD_task_t res = SD_task_create(name, data, flops_amount);
res->alpha = alpha;
res->kind = SD_TASK_COMP_PAR_AMDAHL;
*/
void SD_task_destroy(SD_task_t task)
{
- int idx;
XBT_DEBUG("Destroying task %s...", SD_task_get_name(task));
__SD_task_remove_dependencies(task);
if (task->state == SD_SCHEDULED || task->state == SD_RUNNABLE)
__SD_task_destroy_scheduling_data(task);
- idx = xbt_dynar_search_or_negative(sd_global->return_set, &task);
+ int idx = xbt_dynar_search_or_negative(sd_global->return_set, &task);
if (idx >=0) {
xbt_dynar_remove_at(sd_global->return_set, idx, NULL);
}
xbt_dynar_t SD_task_get_parents(SD_task_t task)
{
unsigned int i;
- xbt_dynar_t parents;
SD_dependency_t dep;
- parents = xbt_dynar_new(sizeof(SD_task_t), NULL);
+ xbt_dynar_t parents = xbt_dynar_new(sizeof(SD_task_t), NULL);
xbt_dynar_foreach(task->tasks_before, i, dep) {
xbt_dynar_push(parents, &(dep->src));
}
xbt_dynar_t SD_task_get_children(SD_task_t task)
{
unsigned int i;
- xbt_dynar_t children;
SD_dependency_t dep;
- children = xbt_dynar_new(sizeof(SD_task_t), NULL);
+ xbt_dynar_t children = xbt_dynar_new(sizeof(SD_task_t), NULL);
xbt_dynar_foreach(task->tasks_after, i, dep) {
xbt_dynar_push(children, &(dep->dst));
}
{
unsigned int counter;
SD_dependency_t dependency;
- char *statename;
XBT_INFO("Displaying task %s", SD_task_get_name(task));
- statename = bprintf("%s%s%s%s%s%s%s",
+ char *statename = bprintf("%s%s%s%s%s%s%s",
(task->state == SD_NOT_SCHEDULED ? " not scheduled" : ""),
(task->state == SD_SCHEDULABLE ? " schedulable" : ""),
(task->state == SD_SCHEDULED ? " scheduled" : ""),
*/
void SD_task_dependency_add(const char *name, void *data, SD_task_t src, SD_task_t dst)
{
- xbt_dynar_t dynar;
- unsigned long length;
int found = 0;
- unsigned long i;
SD_dependency_t dependency;
- e_SD_task_state_t state;
- dynar = src->tasks_after;
- length = xbt_dynar_length(dynar);
+ unsigned long length = xbt_dynar_length(src->tasks_after);
if (src == dst)
THROWF(arg_error, 0, "Cannot add a dependency between task '%s' and itself", SD_task_get_name(src));
- state = SD_task_get_state(src);
+ e_SD_task_state_t state = SD_task_get_state(src);
if (state != SD_NOT_SCHEDULED && state != SD_SCHEDULABLE && state != SD_RUNNING && state != SD_SCHEDULED &&
state != SD_RUNNABLE)
THROWF(arg_error, 0, "Task '%s' must be SD_NOT_SCHEDULED, SD_SCHEDULABLE, SD_SCHEDULED, SD_RUNNABLE, or SD_RUNNING",
SD_task_get_name(dst));
XBT_DEBUG("SD_task_dependency_add: src = %s, dst = %s", SD_task_get_name(src), SD_task_get_name(dst));
- for (i = 0; i < length && !found; i++) {
- xbt_dynar_get_cpy(dynar, i, &dependency);
+ for (unsigned long i = 0; i < length && !found; i++) {
+ xbt_dynar_get_cpy(src->tasks_after, i, &dependency);
found = (dependency->dst == dst);
XBT_DEBUG("Dependency %lu: dependency->dst = %s", i, SD_task_get_name(dependency->dst));
}
SD_task_set_state(dst, SD_SCHEDULED);
}
}
+
/**
* \brief Returns the name given as input when dependency has been created..
*
*/
int SD_task_dependency_exists(SD_task_t src, SD_task_t dst)
{
- unsigned int counter;
- SD_dependency_t dependency;
-
xbt_assert(src != NULL || dst != NULL, "Invalid parameter: both src and dst are NULL");
if (src) {
if (dst) {
+ unsigned int counter;
+ SD_dependency_t dependency;
xbt_dynar_foreach(src->tasks_after, counter, dependency) {
if (dependency->dst == dst)
return 1;
*/
void SD_task_dependency_remove(SD_task_t src, SD_task_t dst)
{
- xbt_dynar_t dynar;
unsigned long length;
int found = 0;
- unsigned long i;
SD_dependency_t dependency;
/* remove the dependency from src->tasks_after */
- dynar = src->tasks_after;
- length = xbt_dynar_length(dynar);
+ length = xbt_dynar_length(src->tasks_after);
- for (i = 0; i < length && !found; i++) {
- xbt_dynar_get_cpy(dynar, i, &dependency);
+ for (unsigned long i = 0; i < length && !found; i++) {
+ xbt_dynar_get_cpy(src->tasks_after, i, &dependency);
if (dependency->dst == dst) {
- xbt_dynar_remove_at(dynar, i, NULL);
+ xbt_dynar_remove_at(src->tasks_after, i, NULL);
found = 1;
}
}
SD_task_get_name(src), SD_task_get_name(dst), SD_task_get_name(dst), SD_task_get_name(src));
/* remove the dependency from dst->tasks_before */
- dynar = dst->tasks_before;
- length = xbt_dynar_length(dynar);
+ length = xbt_dynar_length(dst->tasks_before);
found = 0;
- for (i = 0; i < length && !found; i++) {
- xbt_dynar_get_cpy(dynar, i, &dependency);
+ for (unsigned long i = 0; i < length && !found; i++) {
+ xbt_dynar_get_cpy(dst->tasks_before, i, &dependency);
if (dependency->src == src) {
- xbt_dynar_remove_at(dynar, i, NULL);
+ xbt_dynar_remove_at(dst->tasks_before, i, NULL);
__SD_task_dependency_destroy(dependency);
dst->unsatisfied_dependencies--;
dst->is_not_ready--;
SD_task_get_name(dst), SD_task_get_name(src), SD_task_get_name(src), SD_task_get_name(dst));
/* if the task was scheduled and dst->tasks_before is empty now, we can make it runnable */
-
if (dst->unsatisfied_dependencies == 0) {
if (SD_task_get_state(dst) == SD_SCHEDULED)
SD_task_set_state(dst, SD_RUNNABLE);
*/
void *SD_task_dependency_get_data(SD_task_t src, SD_task_t dst)
{
- xbt_dynar_t dynar;
- unsigned long length;
int found = 0;
- unsigned long i;
SD_dependency_t dependency;
- dynar = src->tasks_after;
- length = xbt_dynar_length(dynar);
+ unsigned long length = xbt_dynar_length(src->tasks_after);
- for (i = 0; i < length && !found; i++) {
- xbt_dynar_get_cpy(dynar, i, &dependency);
+ for (unsigned long i = 0; i < length && !found; i++) {
+ xbt_dynar_get_cpy(src->tasks_after, i, &dependency);
found = (dependency->dst == dst);
}
if (!found)
* The watch point is then automatically removed.
*
* \param task a task
- * \param state the \ref e_SD_task_state_t "state" you want to watch
- * (cannot be #SD_NOT_SCHEDULED)
+ * \param state the \ref e_SD_task_state_t "state" you want to watch (cannot be #SD_NOT_SCHEDULED)
* \see SD_task_unwatch()
*/
void SD_task_watch(SD_task_t task, e_SD_task_state_t state)
void SD_task_unwatch(SD_task_t task, e_SD_task_state_t state)
{
xbt_assert(state != SD_NOT_SCHEDULED, "SimDag error: Cannot have a watch point for state SD_NOT_SCHEDULED");
-
task->watch_points = task->watch_points & ~state;
}
double SD_task_get_execution_time(SD_task_t task, int workstation_nb, const sg_host_t *workstation_list,
const double *flops_amount, const double *bytes_amount)
{
- double time, max_time = 0.0;
- int i, j;
xbt_assert(workstation_nb > 0, "Invalid parameter");
+ double max_time = 0.0;
/* the task execution time is the maximum execution time of the parallel tasks */
-
- for (i = 0; i < workstation_nb; i++) {
- time = 0.0;
+ for (int i = 0; i < workstation_nb; i++) {
+ double time = 0.0;
if (flops_amount != NULL)
time = flops_amount[i] / sg_host_speed(workstation_list[i]);
if (bytes_amount != NULL)
- for (j = 0; j < workstation_nb; j++) {
+ for (int j = 0; j < workstation_nb; j++) {
if (bytes_amount[i * workstation_nb + j] !=0 ) {
time += (SD_route_get_latency(workstation_list[i], workstation_list[j]) +
bytes_amount[i * workstation_nb + j] /
if (SD_task_get_state(task) > SD_SCHEDULABLE)
THROWF(arg_error, 0, "Task '%s' has already been scheduled", SD_task_get_name(task));
- /* update the task state */
if (task->unsatisfied_dependencies == 0)
SD_task_set_state(task, SD_RUNNABLE);
else
* Once scheduled, a task is executed as soon as possible in \see SD_simulate, i.e. when its dependencies are satisfied.
*
* \param task the task you want to schedule
- * \param workstation_count number of workstations on which the task will be executed
+ * \param host_count number of workstations on which the task will be executed
* \param workstation_list the workstations on which the task will be executed
* \param flops_amount computation amount for each workstation
* \param bytes_amount communication amount between each pair of workstations
* \param rate task execution speed rate
* \see SD_task_unschedule()
*/
-void SD_task_schedule(SD_task_t task, int workstation_count, const sg_host_t * workstation_list,
+void SD_task_schedule(SD_task_t task, int host_count, const sg_host_t * workstation_list,
const double *flops_amount, const double *bytes_amount, double rate)
{
- xbt_assert(workstation_count > 0, "workstation_nb must be positive");
+ xbt_assert(host_count > 0, "workstation_nb must be positive");
- task->host_count = workstation_count;
+ task->host_count = host_count;
task->rate = rate;
if (flops_amount) {
- task->flops_amount = (double*)xbt_realloc(task->flops_amount, sizeof(double) * workstation_count);
- memcpy(task->flops_amount, flops_amount, sizeof(double) * workstation_count);
+ task->flops_amount = (double*)xbt_realloc(task->flops_amount, sizeof(double) * host_count);
+ memcpy(task->flops_amount, flops_amount, sizeof(double) * host_count);
} else {
xbt_free(task->flops_amount);
task->flops_amount = NULL;
}
- int communication_nb = workstation_count * workstation_count;
+ int communication_nb = host_count * host_count;
if (bytes_amount) {
task->bytes_amount = (double*)xbt_realloc(task->bytes_amount, sizeof(double) * communication_nb);
memcpy(task->bytes_amount, bytes_amount, sizeof(double) * communication_nb);
task->bytes_amount = NULL;
}
- task->host_list = (sg_host_t*) xbt_realloc(task->host_list, sizeof(sg_host_t) * workstation_count);
- memcpy(task->host_list, workstation_list, sizeof(sg_host_t) * workstation_count);
+ task->host_list = (sg_host_t*) xbt_realloc(task->host_list, sizeof(sg_host_t) * host_count);
+ memcpy(task->host_list, workstation_list, sizeof(sg_host_t) * host_count);
SD_task_do_schedule(task);
}
/* Runs a task. */
void SD_task_run(SD_task_t task)
{
- int i;
- sg_host_t *hosts;
-
xbt_assert(SD_task_get_state(task) == SD_RUNNABLE, "Task '%s' is not runnable! Task state: %d",
SD_task_get_name(task), (int)SD_task_get_state(task));
xbt_assert(task->host_list != NULL, "Task '%s': workstation_list is NULL!", SD_task_get_name(task));
/* Copy the elements of the task into the action */
int host_nb = task->host_count;
- hosts = xbt_new(sg_host_t, host_nb);
+ sg_host_t *hosts = xbt_new(sg_host_t, host_nb);
- for (i = 0; i < host_nb; i++)
+ for (int i = 0; i < host_nb; i++)
hosts[i] = task->host_list[i];
double *flops_amount = xbt_new0(double, host_nb);
__SD_task_destroy_scheduling_data(task); /* now the scheduling data are not useful anymore */
SD_task_set_state(task, SD_RUNNING);
- xbt_assert(SD_task_get_state(task) == SD_RUNNING, "Bad state of task '%s': %d",
- SD_task_get_name(task), (int)SD_task_get_state(task));
-
}
/*
void SD_task_distribute_comp_amdahl(SD_task_t task, int ws_count)
{
- int i;
xbt_assert(task->kind == SD_TASK_COMP_PAR_AMDAHL, "Task %s is not a SD_TASK_COMP_PAR_AMDAHL typed task."
"Cannot use this function.", SD_task_get_name(task));
task->flops_amount = xbt_new0(double, ws_count);
task->host_count = ws_count;
task->host_list = xbt_new0(sg_host_t, ws_count);
- for(i=0;i<ws_count;i++){
+ for(int i=0;i<ws_count;i++){
task->flops_amount[i] = (task->alpha + (1 - task->alpha)/ws_count) * task->amount;
}
}
default:
xbt_die("Kind of task %s not supported by SD_task_schedulev()", SD_task_get_name(task));
}
+
if (task->kind == SD_TASK_COMM_E2E) {
XBT_VERB("Schedule comm task %s between %s -> %s. It costs %.f bytes", SD_task_get_name(task),
sg_host_get_name(task->host_list[0]), sg_host_get_name(task->host_list[1]), task->bytes_amount[2]);
-
}
/* Iterate over all children and parents being COMM_E2E to say where I am located (and start them if runnable) */
{
va_list ap;
sg_host_t *list = xbt_new(sg_host_t, count);
- int i;
va_start(ap, count);
- for (i = 0; i < count; i++) {
+ for (int i = 0; i < count; i++) {
list[i] = va_arg(ap, sg_host_t);
}
va_end(ap);
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
add_executable(availability_test availability_test.c)
-
-### Add definitions for compile
-if(NOT WIN32)
- target_link_libraries(availability_test simgrid m)
-else()
- target_link_libraries(availability_test simgrid)
-endif()
+target_link_libraries(availability_test simgrid)
set(tesh_files
${tesh_files}
/* 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 <stdio.h>
-#include <stdlib.h>
#include <string.h>
-#include <stddef.h>
-#include <unistd.h>
#include <simgrid/simdag.h>
#include <xbt/log.h>
-#include <xbt/ex.h>
-#include <signal.h>
XBT_LOG_NEW_DEFAULT_CATEGORY(test,"Logging for the current example");
static int name_compare_hosts(const void *n1, const void *n2)
{
- return strcmp(
- sg_host_get_name(*(sg_host_t *) n1),
- sg_host_get_name(*(sg_host_t *) n2)
- );
+ return strcmp(sg_host_get_name(*(sg_host_t *) n1), sg_host_get_name(*(sg_host_t *) n2));
}
static void scheduleDAX(xbt_dynar_t dax)
int totalHosts = sg_host_count();
qsort((void *) ws_list, totalHosts, sizeof(sg_host_t), name_compare_hosts);
-
xbt_dynar_foreach(dax, cursor, task) {
if (SD_task_get_kind(task) == SD_TASK_COMP_SEQ) {
- if (!strcmp(SD_task_get_name(task), "end")
- || !strcmp(SD_task_get_name(task), "root")) {
- XBT_INFO("Scheduling %s to node: %s", SD_task_get_name(task),
- sg_host_get_name(ws_list[0]));
+ if (!strcmp(SD_task_get_name(task), "end") || !strcmp(SD_task_get_name(task), "root")) {
+ XBT_INFO("Scheduling %s to node: %s", SD_task_get_name(task), sg_host_get_name(ws_list[0]));
SD_task_schedulel(task, 1, ws_list[0]);
} else {
- XBT_INFO("Scheduling %s to node: %s", SD_task_get_name(task),
- sg_host_get_name(ws_list[(cursor) % totalHosts]));
+ XBT_INFO("Scheduling %s to node: %s", SD_task_get_name(task), sg_host_get_name(ws_list[(cursor) % totalHosts]));
SD_task_schedulel(task, 1, ws_list[(cursor) % totalHosts]);
}
}
}
}
-static xbt_dynar_t initDynamicThrottling(int argc, char *argv[])
+int main(int argc, char *argv[])
{
SD_init(&argc, argv);
- xbt_assert(argc == 3,
- "Error on parameters.\n"
- "Usage: %s <XML platform file> <DAX file>\n", argv[0]);
-
- FILE *testFile = fopen(argv[1], "r");
- xbt_assert(testFile, "Cannot open platform file %s.\n", argv[1]);
- testFile = fopen(argv[2], "r");
- xbt_assert(testFile, "Cannot open DAX file %s.\n", argv[2]);
+ xbt_assert(argc > 2, "Usage: %s platform_file dax_file\n"
+ "\tExample: %s simulacrum_7_hosts.xml Montage_25.xml", argv[0], argv[0]);
SD_create_environment(argv[1]);
xbt_dynar_t dax = SD_daxload(argv[2]);
- // Schedule DAX
XBT_INFO("Scheduling DAX...");
scheduleDAX(dax);
XBT_INFO("DAX scheduled");
SD_simulate(-1);
XBT_INFO("Simulation done.");
- return dax;
-}
-
-int main(int argc, char *argv[])
-{
-
- /* Start process... */
- xbt_dynar_t dax = initDynamicThrottling(argc, argv);
-
// Free memory
while (!xbt_dynar_is_empty(dax)) {
SD_task_t task = xbt_dynar_pop_as(dax, SD_task_t);
add_executable(basic5 basic5.c)
add_executable(basic6 basic6.c)
-### Add definitions for compile
-if(NOT WIN32)
- target_link_libraries(basic0 simgrid m pthread )
- target_link_libraries(basic1 simgrid m pthread )
- target_link_libraries(basic2 simgrid m pthread )
- target_link_libraries(basic3 simgrid m pthread )
- target_link_libraries(basic4 simgrid m pthread )
- target_link_libraries(basic5 simgrid m pthread )
- target_link_libraries(basic6 simgrid m pthread )
-else()
- target_link_libraries(basic0 simgrid)
- target_link_libraries(basic1 simgrid)
- target_link_libraries(basic2 simgrid)
- target_link_libraries(basic3 simgrid)
- target_link_libraries(basic4 simgrid)
- target_link_libraries(basic5 simgrid)
- target_link_libraries(basic6 simgrid)
-endif()
+target_link_libraries(basic0 simgrid)
+target_link_libraries(basic1 simgrid)
+target_link_libraries(basic2 simgrid)
+target_link_libraries(basic3 simgrid)
+target_link_libraries(basic4 simgrid)
+target_link_libraries(basic5 simgrid)
+target_link_libraries(basic6 simgrid)
set(tesh_files
${tesh_files}
/* 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 <stdio.h>
-#include <stdlib.h>
#include "simgrid/simdag.h"
#include "xbt/log.h"
* - Create a no-op Init task
* - Create two communication tasks: 100MB and 1B
* - Schedule them concurrently on the two hosts of the platform
- * The two communications occur simultaneously but one is so short that it has
- * no impact on the other.
+ * The two communications occur simultaneously but one is so short that it has no impact on the other.
* Simulated time should be:
* 1e8/1.25e8 + 1e-4 = 0.8001 seconds
- * This corresponds to paying latency once and having the full bandwidth for the
- * big message.
+ * This corresponds to paying latency once and having the full bandwidth for the big message.
*/
int main(int argc, char **argv)
{
- SD_task_t taskInit;
- SD_task_t taskA;
- SD_task_t taskB;
-
/* scheduling parameters */
-
double communication_amount1[] = { 0, 1e8, 0, 0 };
double communication_amount2[] = { 0, 1, 0, 0 };
const double no_cost[] = { 0.0, 0.0 };
SD_create_environment(argv[1]);
/* creation of the tasks and their dependencies */
- taskInit = SD_task_create("Init", NULL, 1.0);
- taskA = SD_task_create("Task Comm 1", NULL, 1.0);
- taskB = SD_task_create("Task Comm 2", NULL, 1.0);
-
- /* let's launch the simulation! */
-
- SD_task_schedule(taskInit, 1, sg_host_list(), no_cost,
- no_cost, -1.0);
- SD_task_schedule(taskA, 2, sg_host_list(), no_cost,
- communication_amount1, -1.0);
- SD_task_schedule(taskB, 2, sg_host_list(), no_cost,
- communication_amount2, -1.0);
+ SD_task_t taskInit = SD_task_create("Init", NULL, 1.0);
+ SD_task_t taskA = SD_task_create("Task Comm 1", NULL, 1.0);
+ SD_task_t taskB = SD_task_create("Task Comm 2", NULL, 1.0);
SD_task_dependency_add(NULL, NULL, taskInit, taskA);
SD_task_dependency_add(NULL, NULL, taskInit, taskB);
+ SD_task_schedule(taskInit, 1, sg_host_list(), no_cost, no_cost, -1.0);
+ SD_task_schedule(taskA, 2, sg_host_list(), no_cost, communication_amount1, -1.0);
+ SD_task_schedule(taskB, 2, sg_host_list(), no_cost, communication_amount2, -1.0);
+
+ /* let's launch the simulation! */
SD_simulate(-1.0);
SD_task_destroy(taskInit);
SD_task_destroy(taskA);
/* 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 <stdio.h>
-#include <stdlib.h>
#include "simgrid/simdag.h"
#include "xbt/log.h"
*/
int main(int argc, char **argv)
{
-
- SD_task_t taskInit;
- SD_task_t taskA;
- SD_task_t taskB;
-
+ /* scheduling parameters */
double communication_amount1 = 1e9;
double communication_amount2 = 1e9;
double no_cost = 0.0;
- const sg_host_t *workstation;
-
/* initialization of SD */
SD_init(&argc, argv);
SD_create_environment(argv[1]);
/* creation of the tasks and their dependencies */
- taskInit = SD_task_create("Init", NULL, 1.0);
- taskA = SD_task_create("Task Comm A", NULL, 1.0);
- taskB = SD_task_create("Task Comm B", NULL, 1.0);
-
+ SD_task_t taskInit = SD_task_create("Init", NULL, 1.0);
+ SD_task_t taskA = SD_task_create("Task Comm A", NULL, 1.0);
+ SD_task_t taskB = SD_task_create("Task Comm B", NULL, 1.0);
- /* scheduling parameters */
+ SD_task_dependency_add(NULL, NULL, taskInit, taskA);
+ SD_task_dependency_add(NULL, NULL, taskInit, taskB);
+ const sg_host_t *hosts = sg_host_list();
- workstation = sg_host_list();
+ SD_task_schedule(taskInit, 1, sg_host_list(), &no_cost, &no_cost, -1.0);
+ SD_task_schedule(taskA, 1, &hosts[0], &no_cost, &communication_amount1, -1.0);
+ SD_task_schedule(taskB, 1, &hosts[1], &no_cost, &communication_amount2, -1.0);
/* let's launch the simulation! */
- SD_task_schedule(taskInit, 1, sg_host_list(), &no_cost,
- &no_cost, -1.0);
- SD_task_schedule(taskA, 1, &workstation[0], &no_cost,
- &communication_amount1, -1.0);
- SD_task_schedule(taskB, 1, &workstation[1], &no_cost,
- &communication_amount2, -1.0);
-
- SD_task_dependency_add(NULL, NULL, taskInit, taskA);
- SD_task_dependency_add(NULL, NULL, taskInit, taskB);
-
SD_simulate(-1.0);
SD_task_destroy(taskA);
SD_task_destroy(taskB);
/* 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 <stdio.h>
-#include <stdlib.h>
#include "simgrid/simdag.h"
#include "xbt/log.h"
* - Create a no-op Init task
* - Create two communication tasks: 1GB and 100MB
* - Schedule them concurrently on the two hosts of the platform
- * The two communications occur simultaneously. They share the network for the
- * duration of the shortest one, then the longest one has the full bandwidth.
+ * The two communications occur simultaneously. They share the network for the duration of the shortest one, then the
+ * longest one has the full bandwidth.
* Simulated time should be:
* 1e8/(1/2*1.25e8) + 9e8/1.25e8) + 1e-4 = 8.8001 seconds
*/
int main(int argc, char **argv)
{
-
- SD_task_t taskInit;
- SD_task_t taskA;
- SD_task_t taskB;
-
- const sg_host_t *workstation;
-
+ /* scheduling parameters */
double communication_amount1 = 1e9;
double communication_amount2 = 1e8;
double no_cost = 0.0;
SD_create_environment(argv[1]);
/* creation of the tasks and their dependencies */
- taskInit = SD_task_create("Init", NULL, 1.0);
- taskA = SD_task_create("Task Comm A", NULL, 1.0);
- taskB = SD_task_create("Task Comm B", NULL, 1.0);
+ SD_task_t taskInit = SD_task_create("Init", NULL, 1.0);
+ SD_task_t taskA = SD_task_create("Task Comm A", NULL, 1.0);
+ SD_task_t taskB = SD_task_create("Task Comm B", NULL, 1.0);
+ SD_task_dependency_add(NULL, NULL, taskInit, taskA);
+ SD_task_dependency_add(NULL, NULL, taskInit, taskB);
- /* scheduling parameters */
+ const sg_host_t *workstation = sg_host_list();
- workstation = sg_host_list();
+ SD_task_schedule(taskInit, 1, sg_host_list(), &no_cost, &no_cost, -1.0);
+ SD_task_schedule(taskA, 1, &workstation[0], &no_cost, &communication_amount1, -1.0);
+ SD_task_schedule(taskB, 1, &workstation[1], &no_cost, &communication_amount2, -1.0);
/* let's launch the simulation! */
- SD_task_schedule(taskInit, 1, sg_host_list(), &no_cost,
- &no_cost, -1.0);
- SD_task_schedule(taskA, 1, &workstation[0], &no_cost,
- &communication_amount1, -1.0);
- SD_task_schedule(taskB, 1, &workstation[1], &no_cost,
- &communication_amount2, -1.0);
-
- SD_task_dependency_add(NULL, NULL, taskInit, taskA);
- SD_task_dependency_add(NULL, NULL, taskInit, taskB);
-
SD_simulate(-1.0);
SD_task_destroy(taskA);
SD_task_destroy(taskB);
/* 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 <stdio.h>
-#include <stdlib.h>
#include "simgrid/simdag.h"
#include "xbt/log.h"
*/
int main(int argc, char **argv)
{
-
- SD_task_t taskInit;
- SD_task_t taskA;
- SD_task_t taskFin;
-
/* scheduling parameters */
-
double no_cost[] = { 0.0, 0.0, 0.0, 0.0 };
/* initialization of SD */
SD_create_environment(argv[1]);
/* creation of the tasks and their dependencies */
- taskInit = SD_task_create("Task Init", NULL, 1.0);
- taskA = SD_task_create("Task A", NULL, 1.0);
- taskFin = SD_task_create("Task Fin", NULL, 1.0);
-
- /* let's launch the simulation! */
- SD_task_schedule(taskInit, 1, sg_host_list(), no_cost,
- no_cost, -1.0);
- SD_task_schedule(taskA, 2, sg_host_list(), no_cost, no_cost,
- -1.0);
- SD_task_schedule(taskFin, 1, sg_host_list(), no_cost, no_cost,
- -1.0);
+ SD_task_t taskInit = SD_task_create("Task Init", NULL, 1.0);
+ SD_task_t taskA = SD_task_create("Task A", NULL, 1.0);
+ SD_task_t taskFin = SD_task_create("Task Fin", NULL, 1.0);
SD_task_dependency_add(NULL, NULL, taskInit, taskA);
SD_task_dependency_add(NULL, NULL, taskA, taskFin);
+ SD_task_schedule(taskInit, 1, sg_host_list(), no_cost, no_cost, -1.0);
+ SD_task_schedule(taskA, 2, sg_host_list(), no_cost, no_cost, -1.0);
+ SD_task_schedule(taskFin, 1, sg_host_list(), no_cost, no_cost, -1.0);
+
+ /* let's launch the simulation! */
SD_simulate(-1.0);
SD_task_destroy(taskInit);
SD_task_destroy(taskA);
/* 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 <stdio.h>
-#include <stdlib.h>
#include "simgrid/simdag.h"
#include "xbt/log.h"
*/
int main(int argc, char **argv)
{
- /* creation of the tasks and their dependencies */
-
- SD_task_t taskInit;
- SD_task_t taskA;
- SD_task_t taskFin;
-
/* scheduling parameters */
-
double no_cost[] = { 0., 0., 0., 0. };
double amount[] = { 0., 1., 0., 0. };
SD_create_environment(argv[1]);
/* creation of the tasks and their dependencies */
- taskInit = SD_task_create("Task Init", NULL, 1.0);
- taskA = SD_task_create("Task A", NULL, 1.0);
- taskFin = SD_task_create("Task Fin", NULL, 1.0);
-
-
- /* let's launch the simulation! */
- SD_task_schedule(taskInit, 1, sg_host_list(), no_cost,
- no_cost, -1.0);
- SD_task_schedule(taskA, 2, sg_host_list(), no_cost, amount,
- -1.0);
- SD_task_schedule(taskFin, 1, sg_host_list(), no_cost, no_cost,
- -1.0);
+ SD_task_t taskInit = SD_task_create("Task Init", NULL, 1.0);
+ SD_task_t taskA = SD_task_create("Task A", NULL, 1.0);
+ SD_task_t taskFin = SD_task_create("Task Fin", NULL, 1.0);
SD_task_dependency_add(NULL, NULL, taskInit, taskA);
SD_task_dependency_add(NULL, NULL, taskA, taskFin);
+ SD_task_schedule(taskInit, 1, sg_host_list(), no_cost, no_cost, -1.0);
+ SD_task_schedule(taskA, 2, sg_host_list(), no_cost, amount, -1.0);
+ SD_task_schedule(taskFin, 1, sg_host_list(), no_cost, no_cost, -1.0);
+
+ /* let's launch the simulation! */
SD_simulate(-1.0);
SD_task_destroy(taskInit);
SD_task_destroy(taskA);
/* 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 <stdio.h>
-#include <stdlib.h>
#include "simgrid/simdag.h"
#include "xbt/log.h"
*/
int main(int argc, char **argv)
{
-
- /* creation of the tasks and their dependencies */
- SD_task_t taskInit;
- SD_task_t taskA;
- SD_task_t taskB;
-
/* scheduling parameters */
-
double no_cost[] = { 0., 0., 0., 0. };
double amount[] = { 0., 100000., 0., 0. };
double comput[] = { 10000000. };
SD_create_environment(argv[1]);
/* creation of the tasks and their dependencies */
- taskInit = SD_task_create("Task Init", NULL, 1.0);
- taskA = SD_task_create("Task A", NULL, 1.0);
- taskB = SD_task_create("Task B", NULL, 1.0);
-
- /* let's launch the simulation! */
- SD_task_schedule(taskInit, 1, sg_host_list(), no_cost,
- no_cost, -1.0);
- SD_task_schedule(taskA, 2, sg_host_list(), no_cost, amount,
- -1.0);
- SD_task_schedule(taskB, 1, sg_host_list(), comput, no_cost,
- -1.0);
+ SD_task_t taskInit = SD_task_create("Task Init", NULL, 1.0);
+ SD_task_t taskA = SD_task_create("Task A", NULL, 1.0);
+ SD_task_t taskB = SD_task_create("Task B", NULL, 1.0);
SD_task_dependency_add(NULL, NULL, taskInit, taskA);
SD_task_dependency_add(NULL, NULL, taskInit, taskB);
+ SD_task_schedule(taskInit, 1, sg_host_list(), no_cost, no_cost, -1.0);
+ SD_task_schedule(taskA, 2, sg_host_list(), no_cost, amount, -1.0);
+ SD_task_schedule(taskB, 1, sg_host_list(), comput, no_cost, -1.0);
+
+ /* let's launch the simulation! */
SD_simulate(-1.0);
SD_task_destroy(taskInit);
SD_task_destroy(taskA);
/* 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 <stdio.h>
-#include <stdlib.h>
#include "simgrid/simdag.h"
#include "xbt/asserts.h"
#include "xbt/log.h"
{
double comm_cost[] = { 0.0, 0.0, 0.0, 0.0 };
double comp_cost[] = { 1.0 };
- SD_task_t taskA, taskB;
xbt_dynar_t ret;
SD_init(&argc, argv);
SD_create_environment(argv[1]);
- taskA = SD_task_create("Task A", NULL, 1.0);
- taskB = SD_task_create("Task B", NULL, 1.0);
+ SD_task_t taskA = SD_task_create("Task A", NULL, 1.0);
+ SD_task_t taskB = SD_task_create("Task B", NULL, 1.0);
- SD_task_schedule(taskA, 1, sg_host_list(), comp_cost,
- comm_cost, -1.0);
- SD_task_schedule(taskB, 1, sg_host_list(), comp_cost,
- comm_cost, -1.0);
+ SD_task_schedule(taskA, 1, sg_host_list(), comp_cost, comm_cost, -1.0);
+ SD_task_schedule(taskB, 1, sg_host_list(), comp_cost, comm_cost, -1.0);
ret = SD_simulate(-1.0);
- xbt_assert(xbt_dynar_length(ret) == 2,
- "I was expecting the completion of 2 tasks, but I got %lu instead",
- xbt_dynar_length(ret));
+ xbt_assert(xbt_dynar_length(ret) == 2, "I was expecting the completion of 2 tasks, but I got %lu instead",
+ xbt_dynar_length(ret));
SD_task_destroy(taskA);
SD_task_destroy(taskB);
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
add_executable(incomplete incomplete.c)
-
-### Add definitions for compile
-if(NOT WIN32)
- target_link_libraries(incomplete simgrid m pthread )
-else()
- target_link_libraries(incomplete simgrid)
-endif()
+target_link_libraries(incomplete simgrid)
set(tesh_files
${tesh_files}
/* 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 <stdio.h>
-#include <stdlib.h>
#include "simgrid/simdag.h"
#include "xbt/log.h"
*/
int main(int argc, char **argv)
{
-
- SD_task_t taskInit;
- SD_task_t taskA, taskB, taskC, taskD;
-
- const sg_host_t *workstation;
-
+ /* scheduling parameters */
double communication_amount1 = 1e9;
double no_cost = 0.0;
SD_create_environment(argv[1]);
/* creation of the tasks and their dependencies */
- taskInit = SD_task_create("Init", NULL, 1.0);
- taskA = SD_task_create("Task A", NULL, 1.0);
- taskB = SD_task_create("Task B", NULL, 1.0);
- taskC = SD_task_create("Task C", NULL, 1.0);
- taskD = SD_task_create("Task D", NULL, 1.0);
-
-
- /* scheduling parameters */
-
- workstation = sg_host_list();
+ SD_task_t taskInit = SD_task_create("Init", NULL, 1.0);
+ SD_task_t taskA = SD_task_create("Task A", NULL, 1.0);
+ SD_task_t taskB = SD_task_create("Task B", NULL, 1.0);
+ SD_task_t taskC = SD_task_create("Task C", NULL, 1.0);
+ SD_task_t taskD = SD_task_create("Task D", NULL, 1.0);
SD_task_dependency_add(NULL, NULL, taskInit, taskA);
SD_task_dependency_add(NULL, NULL, taskInit, taskB);
SD_task_dependency_add(NULL, NULL, taskC, taskD);
- /* let's launch the simulation! */
- SD_task_schedule(taskInit, 1, sg_host_list(), &no_cost,
- &no_cost, -1.0);
- SD_task_schedule(taskA, 1, &workstation[0], &no_cost,
- &communication_amount1, -1.0);
- SD_task_schedule(taskD, 1, &workstation[0], &no_cost,
- &communication_amount1, -1.0);
+ const sg_host_t *hosts = sg_host_list();
+ SD_task_schedule(taskInit, 1, sg_host_list(), &no_cost, &no_cost, -1.0);
+ SD_task_schedule(taskA, 1, &hosts[0], &no_cost, &communication_amount1, -1.0);
+ SD_task_schedule(taskD, 1, &hosts[0], &no_cost, &communication_amount1, -1.0);
+ /* let's launch the simulation! */
SD_simulate(-1.);
+
SD_task_destroy(taskA);
SD_task_destroy(taskB);
SD_task_destroy(taskC);
add_executable(test_intra_all2all test_intra_all2all.c)
add_executable(test_intra_independent_comm test_intra_independent_comm.c)
add_executable(test_intra_scatter test_intra_scatter.c)
-
-### Add definitions for compile
-if(NOT WIN32)
- target_link_libraries(test_intra_all2all simgrid m pthread )
- target_link_libraries(test_intra_independent_comm simgrid m pthread )
- target_link_libraries(test_intra_scatter simgrid m pthread )
-else()
- target_link_libraries(test_intra_all2all simgrid)
- target_link_libraries(test_intra_independent_comm simgrid)
- target_link_libraries(test_intra_scatter simgrid)
-endif()
+target_link_libraries(test_intra_all2all simgrid)
+target_link_libraries(test_intra_independent_comm simgrid)
+target_link_libraries(test_intra_scatter simgrid)
set(tesh_files
${tesh_files}
${CMAKE_CURRENT_SOURCE_DIR}/test_intra_independent_comm.c
${CMAKE_CURRENT_SOURCE_DIR}/test_intra_scatter.c
PARENT_SCOPE)
-set(bin_files
- ${bin_files}
- PARENT_SCOPE)
-set(txt_files
- ${txt_files}
- PARENT_SCOPE)
* under the terms of the license (GNU LGPL) which comes with this package. */
#include <stdio.h>
-#include <stdlib.h>
-
#include "simgrid/simdag.h"
/*
* send 1 byte from all to all
* + 2 secs latency
* should be 8 (platform_4p_1switch.xml)
- *
*/
int main(int argc, char **argv)
{
- double time;
- SD_task_t task;
-
double communication_amount[] = { 0.0, 1.0, 1.0, 1.0,
- 1.0, 0.0, 1.0, 1.0,
- 1.0, 1.0, 0.0, 1.0,
- 1.0, 1.0, 1.0, 0.0,
- };
+ 1.0, 0.0, 1.0, 1.0,
+ 1.0, 1.0, 0.0, 1.0,
+ 1.0, 1.0, 1.0, 0.0 };
double no_cost[] = { 0.0, 0.0, 0.0, 0.0 };
-
- /***************************************/
-
SD_init(&argc, argv);
SD_create_environment(argv[1]);
- task = SD_task_create("All2all task", NULL, 1.0);
+ SD_task_t task = SD_task_create("All2all task", NULL, 1.0);
- SD_task_schedule(task, 4, sg_host_list(), no_cost,
- communication_amount, -1.0);
+ SD_task_schedule(task, 4, sg_host_list(), no_cost, communication_amount, -1.0);
SD_simulate(-1.0);
- time = SD_get_clock();
-
- printf("%g\n", time);
+ printf("%g\n", SD_get_clock());
fflush(stdout);
SD_task_destroy(task);
SD_exit();
-
return 0;
}
* under the terms of the license (GNU LGPL) which comes with this package. */
#include <stdio.h>
-#include <stdlib.h>
-
#include "simgrid/simdag.h"
/*
int main(int argc, char **argv)
{
- double time;
- SD_task_t task;
-
double communication_amount[] = { 0.0, 1.0, 0.0, 0.0,
- 0.0, 0.0, 0.0, 0.0,
- 0.0, 0.0, 0.0, 1.0,
- 0.0, 0.0, 0.0, 0.0,
- };
+ 0.0, 0.0, 0.0, 0.0,
+ 0.0, 0.0, 0.0, 1.0,
+ 0.0, 0.0, 0.0, 0.0 };
double no_cost[] = { 0.0, 0.0, 0.0, 0.0 };
-
- /***************************************/
-
SD_init(&argc, argv);
SD_create_environment(argv[1]);
- task = SD_task_create("Comm 1", NULL, 1.0);
+ SD_task_t task = SD_task_create("Comm 1", NULL, 1.0);
- SD_task_schedule(task, 4, sg_host_list(), no_cost,
- communication_amount, -1.0);
+ SD_task_schedule(task, 4, sg_host_list(), no_cost, communication_amount, -1.0);
SD_simulate(-1.0);
- time = SD_get_clock();
-
- printf("%g\n", time);
+ printf("%g\n", SD_get_clock());
fflush(stdout);
SD_task_destroy(task);
SD_exit();
-
return 0;
}
* under the terms of the license (GNU LGPL) which comes with this package. */
#include <stdio.h>
-#include <stdlib.h>
-
#include "simgrid/simdag.h"
/*
int main(int argc, char **argv)
{
- double time;
- SD_task_t task;
double communication_amount[] = { 0.0, 1.0, 2.0, 3.0,
- 0.0, 0.0, 0.0, 0.0,
- 0.0, 0.0, 0.0, 0.0,
- 0.0, 0.0, 0.0, 0.0,
- };
-
+ 0.0, 0.0, 0.0, 0.0,
+ 0.0, 0.0, 0.0, 0.0,
+ 0.0, 0.0, 0.0, 0.0 };
double no_cost[] = { 0.0, 0.0, 0.0, 0.0 };
-
- /***************************************/
-
SD_init(&argc, argv);
SD_create_environment(argv[1]);
- task = SD_task_create("Scatter task", NULL, 1.0);
+ SD_task_t task = SD_task_create("Scatter task", NULL, 1.0);
- SD_task_schedule(task, 4, sg_host_list(), no_cost,
- communication_amount, -1.0);
+ SD_task_schedule(task, 4, sg_host_list(), no_cost, communication_amount, -1.0);
SD_simulate(-1.0);
- time = SD_get_clock();
-
- printf("%g\n", time);
+ printf("%g\n", SD_get_clock());
fflush(stdout);
SD_task_destroy(task);
SD_exit();
-
return 0;
}
add_executable(test_latency2 test_latency2.c)
add_executable(test_latency3 test_latency3.c)
add_executable(test_latency_bound test_latency_bound.c)
-
-### Add definitions for compile
-if(NOT WIN32)
- target_link_libraries(test_latency1 simgrid m pthread )
- target_link_libraries(test_latency2 simgrid m pthread )
- target_link_libraries(test_latency3 simgrid m pthread )
- target_link_libraries(test_latency_bound simgrid m pthread )
-else()
- target_link_libraries(test_latency1 simgrid)
- target_link_libraries(test_latency2 simgrid)
- target_link_libraries(test_latency3 simgrid)
- target_link_libraries(test_latency_bound simgrid)
-endif()
+target_link_libraries(test_latency1 simgrid)
+target_link_libraries(test_latency2 simgrid)
+target_link_libraries(test_latency3 simgrid)
+target_link_libraries(test_latency_bound simgrid)
set(tesh_files
${tesh_files}
* under the terms of the license (GNU LGPL) which comes with this package. */
#include <stdio.h>
-#include <stdlib.h>
-
#include "simgrid/simdag.h"
/*
*
* this is a test for multiple platforms
* see tesh file for expected output
- *
*/
int main(int argc, char **argv)
{
- double time;
double communication_amount[] = { 0.0, 1.0, 0.0, 0.0 };
const double no_cost[] = { 0.0, 0.0 };
- SD_task_t task;
SD_init(&argc, argv);
SD_create_environment(argv[1]);
- task = SD_task_create("Comm 1", NULL, 1.0);
+ SD_task_t task = SD_task_create("Comm 1", NULL, 1.0);
- SD_task_schedule(task, 2, sg_host_list(), no_cost,
- communication_amount, -1.0);
+ SD_task_schedule(task, 2, sg_host_list(), no_cost, communication_amount, -1.0);
SD_simulate(-1.0);
- time = SD_get_clock();
-
- printf("%g\n", time);
+ printf("%g\n", SD_get_clock());
fflush(stdout);
SD_task_destroy(task);
SD_exit();
-
return 0;
}
* under the terms of the license (GNU LGPL) which comes with this package. */
#include <stdio.h>
-#include <stdlib.h>
-
#include "simgrid/simdag.h"
-
/*
* bw and latency test 2
* send 2 x 1 byte from 2 task in same direction 0 -> 1
- *
*/
int main(int argc, char **argv)
{
- double time;
- SD_task_t root;
- SD_task_t task1;
- SD_task_t task2;
double communication_amount1[] = { 0.0, 1.0, 0.0, 0.0 };
double communication_amount2[] = { 0.0, 1.0, 0.0, 0.0 };
double no_cost1[] = { 0.0 };
SD_init(&argc, argv);
SD_create_environment(argv[1]);
- root = SD_task_create("Root", NULL, 1.0);
- task1 = SD_task_create("Comm 1", NULL, 1.0);
- task2 = SD_task_create("Comm 2", NULL, 1.0);
+ SD_task_t root = SD_task_create("Root", NULL, 1.0);
+ SD_task_t task1 = SD_task_create("Comm 1", NULL, 1.0);
+ SD_task_t task2 = SD_task_create("Comm 2", NULL, 1.0);
- SD_task_schedule(root, 1, sg_host_list(), no_cost1, no_cost1,
- -1.0);
- SD_task_schedule(task1, 2, sg_host_list(), no_cost,
- communication_amount1, -1.0);
- SD_task_schedule(task2, 2, sg_host_list(), no_cost,
- communication_amount2, -1.0);
+ SD_task_schedule(root, 1, sg_host_list(), no_cost1, no_cost1, -1.0);
+ SD_task_schedule(task1, 2, sg_host_list(), no_cost, communication_amount1, -1.0);
+ SD_task_schedule(task2, 2, sg_host_list(), no_cost, communication_amount2, -1.0);
SD_task_dependency_add(NULL, NULL, root, task1);
SD_task_dependency_add(NULL, NULL, root, task2);
SD_simulate(-1.0);
- time = SD_get_clock();
-
- printf("%g\n", time);
+ printf("%g\n", SD_get_clock());
fflush(stdout);
SD_task_destroy(root);
* under the terms of the license (GNU LGPL) which comes with this package. */
#include <stdio.h>
-#include <stdlib.h>
-
#include "simgrid/simdag.h"
/**
* same intention as test 2
* sending 2 x 1 bytes at the same time
* this time in opposite direction
- *
*/
int main(int argc, char **argv)
{
- double time;
- SD_task_t root;
- SD_task_t task1;
- SD_task_t task2;
double communication_amount1[] = { 0.0, 1.0, 0.0, 0.0 };
double communication_amount2[] = { 0.0, 0.0, 1.0, 0.0 };
double no_cost1[] = { 0.0 };
SD_init(&argc, argv);
SD_create_environment(argv[1]);
- root = SD_task_create("Root", NULL, 1.0);
- task1 = SD_task_create("Comm 1", NULL, 1.0);
- task2 = SD_task_create("Comm 2", NULL, 1.0);
+ SD_task_t root = SD_task_create("Root", NULL, 1.0);
+ SD_task_t task1 = SD_task_create("Comm 1", NULL, 1.0);
+ SD_task_t task2 = SD_task_create("Comm 2", NULL, 1.0);
- SD_task_schedule(root, 1, sg_host_list(), no_cost1,
- no_cost1, -1.0);
- SD_task_schedule(task1, 2, sg_host_list(), no_cost,
- communication_amount1, -1.0);
- SD_task_schedule(task2, 2, sg_host_list(), no_cost,
- communication_amount2, -1.0);
+ SD_task_schedule(root, 1, sg_host_list(), no_cost1, no_cost1, -1.0);
+ SD_task_schedule(task1, 2, sg_host_list(), no_cost, communication_amount1, -1.0);
+ SD_task_schedule(task2, 2, sg_host_list(), no_cost, communication_amount2, -1.0);
SD_task_dependency_add(NULL, NULL, root, task1);
SD_task_dependency_add(NULL, NULL, root, task2);
SD_simulate(-1.0);
- time = SD_get_clock();
-
- printf("%g\n", time);
+ printf("%g\n", SD_get_clock());
fflush(stdout);
SD_task_destroy(root);
SD_task_destroy(task2);
SD_exit();
-
return 0;
}
* under the terms of the license (GNU LGPL) which comes with this package. */
#include <stdio.h>
-#include <stdlib.h>
-
#include "simgrid/simdag.h"
#define TASK_NUM 3
* 3 flows exceed bandwidth
* should be 10001.5
* because the max tcp win size is 20000
- *
- * @todo@ test assumes that max tcp win size is 20000
- * assert this
*/
int main(int argc, char **argv)
{
- int i;
- double time;
double communication_amount[] = { 0.0, 1.0, 0.0, 0.0 };
double no_cost[] = { 0.0, 0.0 };
- SD_task_t root;
SD_task_t task[TASK_NUM];
SD_init(&argc, argv);
SD_create_environment(argv[1]);
- // xbt_assert( check max tcp win size, "MAX TCP WIN SIZE is 20000");
-
- root = SD_task_create("Root", NULL, 1.0);
- SD_task_schedule(root, 1, sg_host_list(), no_cost, no_cost,
- -1.0);
+ SD_task_t root = SD_task_create("Root", NULL, 1.0);
+ SD_task_schedule(root, 1, sg_host_list(), no_cost, no_cost, -1.0);
- for (i = 0; i < TASK_NUM; i++) {
+ for (int i = 0; i < TASK_NUM; i++) {
task[i] = SD_task_create("Comm", NULL, 1.0);
- SD_task_schedule(task[i], 2, sg_host_list(), no_cost,
- communication_amount, -1.0);
+ SD_task_schedule(task[i], 2, sg_host_list(), no_cost, communication_amount, -1.0);
SD_task_dependency_add(NULL, NULL, root, task[i]);
}
SD_simulate(-1.0);
- time = SD_get_clock();
-
- printf("%g\n", time);
+ printf("%g\n", SD_get_clock());
fflush(stdout);
- for (i = 0; i < TASK_NUM; i++) {
+ for (int i = 0; i < TASK_NUM; i++) {
SD_task_destroy(task[i]);
}
SD_task_destroy(root);
SD_exit();
-
return 0;
}
add_executable(test_comp_only_seq test_comp_only_seq.c)
add_executable(test_comp_only_par test_comp_only_par.c)
-
-### Add definitions for compile
-if(NOT WIN32)
- target_link_libraries(test_comp_only_seq simgrid m pthread )
- target_link_libraries(test_comp_only_par simgrid m pthread )
-else()
- target_link_libraries(test_comp_only_seq simgrid)
- target_link_libraries(test_comp_only_par simgrid)
-endif()
+target_link_libraries(test_comp_only_seq simgrid)
+target_link_libraries(test_comp_only_par simgrid)
set(tesh_files
${tesh_files}
* under the terms of the license (GNU LGPL) which comes with this package. */
#include <stdio.h>
-#include <stdlib.h>
-
#include "simgrid/simdag.h"
int main(int argc, char **argv)
{
-
- double time;
double comm_amount[] = { 0.0, 0.0, 0.0, 0.0 };
double comp_cost[] = { 1.0, 1.0 };
- SD_task_t task;
-
SD_init(&argc, argv);
SD_create_environment(argv[1]);
- task = SD_task_create("partask", NULL, 1.0);
- SD_task_schedule(task, 2, sg_host_list(), comp_cost,
- comm_amount, -1.0);
+ SD_task_t task = SD_task_create("partask", NULL, 1.0);
+ SD_task_schedule(task, 2, sg_host_list(), comp_cost, comm_amount, -1.0);
SD_simulate(-1.0);
- time = SD_get_clock();
-
- printf("%g\n", time);
+ printf("%g\n", SD_get_clock());
fflush(stdout);
SD_task_destroy(task);
SD_exit();
-
return 0;
}
int main(int argc, char **argv)
{
- double time;
double comm_amount[] = { 0.0 };
double comp_cost[] = { 1.0 };
- SD_task_t task;
-
SD_init(&argc, argv);
SD_create_environment(argv[1]);
- task = SD_task_create("seqtask", NULL, 1.0);
- SD_task_schedule(task, 1, sg_host_list(), comp_cost,
- comm_amount, -1.0);
+ SD_task_t task = SD_task_create("seqtask", NULL, 1.0);
+ SD_task_schedule(task, 1, sg_host_list(), comp_cost, comm_amount, -1.0);
SD_simulate(-1.0);
- time = SD_get_clock();
-
- printf("%g\n", time);
+ printf("%g\n", SD_get_clock());
fflush(stdout);
SD_task_destroy(task);
SD_exit();
-
return 0;
}
add_executable(basic_parsing_test basic_parsing_test.c)
add_executable(is_router_test is_router_test.cpp)
add_executable(flatifier flatifier.cpp)
-add_executable(basic_tracing basic_tracing.c)
add_executable(basic_link_test basic_link_test.c)
+target_link_libraries(basic_parsing_test simgrid)
+target_link_libraries(is_router_test simgrid)
+target_link_libraries(flatifier simgrid)
+target_link_libraries(basic_link_test simgrid)
### Add definitions for compile
if(NOT WIN32)
add_executable(evaluate_get_route_time Evaluate_get_route_time.c)
target_link_libraries(evaluate_get_route_time simgrid m)
target_link_libraries(evaluate_parse_time simgrid m)
- target_link_libraries(basic_parsing_test simgrid m)
- target_link_libraries(is_router_test simgrid m)
- target_link_libraries(flatifier simgrid m)
- target_link_libraries(basic_tracing simgrid m)
- target_link_libraries(basic_link_test simgrid m)
-else()
- target_link_libraries(basic_parsing_test simgrid)
- target_link_libraries(is_router_test simgrid)
- target_link_libraries(flatifier simgrid)
- target_link_libraries(basic_tracing simgrid)
- target_link_libraries(basic_link_test simgrid)
endif()
set(tesh_files
set(teshsuite_src
${teshsuite_src}
${CMAKE_CURRENT_SOURCE_DIR}/basic_parsing_test.c
- ${CMAKE_CURRENT_SOURCE_DIR}/basic_tracing.c
${CMAKE_CURRENT_SOURCE_DIR}/basic_link_test.c
${CMAKE_CURRENT_SOURCE_DIR}/Evaluate_get_route_time.c
${CMAKE_CURRENT_SOURCE_DIR}/Evaluate_parse_time.c
SD_init(&argc, argv);
SD_create_environment(argv[1]);
- sg_host_t *workstations = sg_host_list();
- int list_size = sg_host_count();
+ sg_host_t *hosts = sg_host_list();
+ int host_count = sg_host_count();
/* Random number initialization */
srand( (int) (xbt_os_time()*1000) );
do {
- i = rand()%list_size;
- j = rand()%list_size;
+ i = rand()%host_count;
+ j = rand()%host_count;
} while(i==j);
- sg_host_t w1 = workstations[i];
- sg_host_t w2 = workstations[j];
+ sg_host_t h1 = hosts[i];
+ sg_host_t h2 = hosts[j];
printf("%d\tand\t%d\t\t",i,j);
xbt_os_cputimer_start(timer);
- SD_route_get_list(w1, w2);
+ SD_route_get_list(h1, h2);
xbt_os_cputimer_stop(timer);
printf("%f\n", xbt_os_timer_elapsed(timer) );
- xbt_free(workstations);
+ xbt_free(hosts);
SD_exit();
return 0;
//teshsuite/simdag/platforms/evaluate_parse_time ../examples/platforms/nancy.xml
#include <stdio.h>
-#include <stdlib.h>
#include "simgrid/simdag.h"
#include "surf/surf.h"
#include "xbt/xbt_os_time.h"
* under the terms of the license (GNU LGPL) which comes with this package. */
#include <stdio.h>
-#include <stdlib.h>
#include "simgrid/simdag.h"
#include "xbt/log.h"
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(basic_link_test, sd,
- "SimDag test basic_link_test");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(basic_link_test, sd, "SimDag test basic_link_test");
static int cmp_link(const void*a, const void*b) {
return strcmp(sg_link_name(*(SD_link_t*)a) , sg_link_name(*(SD_link_t*)b));
qsort((void *)links, count, sizeof(SD_link_t), cmp_link);
for (int i=0; i < count; i++){
- XBT_INFO("%s: latency = %.5f, bandwidth = %f", sg_link_name(links[i]), sg_link_latency(links[i]), sg_link_bandwidth(links[i]));
+ XBT_INFO("%s: latency = %.5f, bandwidth = %f", sg_link_name(links[i]),
+ sg_link_latency(links[i]), sg_link_bandwidth(links[i]));
sg_link_data_set(links[i], (void*) user_data);
xbt_assert(!strcmp(user_data, (const char*)sg_link_data(links[i])),"User data was corrupted.");
}
* under the terms of the license (GNU LGPL) which comes with this package. */
#include <stdio.h>
-#include <stdlib.h>
#include "simgrid/simdag.h"
int main(int argc, char **argv)
SD_create_environment(argv[1]);
printf("Workstation number: %zu, link number: %d\n", sg_host_count(), sg_link_count());
- sg_host_t *workstations = sg_host_list();
+ sg_host_t *hosts = sg_host_list();
if (argc >= 3) {
if (!strcmp(argv[2], "ONE_LINK")) {
- sg_host_t w1 = workstations[0];
- sg_host_t w2 = workstations[1];
- const char *name1 = sg_host_get_name(w1);
- const char *name2 = sg_host_get_name(w2);
+ sg_host_t h1 = hosts[0];
+ sg_host_t h2 = hosts[1];
+ const char *name1 = sg_host_get_name(h1);
+ const char *name2 = sg_host_get_name(h2);
printf("Route between %s and %s\n", name1, name2);
- SD_link_t *route = SD_route_get_list(w1, w2);
- int route_size = SD_route_get_size(w1, w2);
+ SD_link_t *route = SD_route_get_list(h1, h2);
+ int route_size = SD_route_get_size(h1, h2);
printf("Route size %d\n", route_size);
for (int i = 0; i < route_size; i++)
- printf(" Link %s: latency = %f, bandwidth = %f\n", sg_link_name(route[i]), sg_link_latency(route[i]), sg_link_bandwidth(route[i]));
- printf("Route latency = %f, route bandwidth = %f\n", SD_route_get_latency(w1, w2), SD_route_get_bandwidth(w1, w2));
+ printf(" Link %s: latency = %f, bandwidth = %f\n", sg_link_name(route[i]),
+ sg_link_latency(route[i]), sg_link_bandwidth(route[i]));
+ printf("Route latency = %f, route bandwidth = %f\n",
+ SD_route_get_latency(h1, h2), SD_route_get_bandwidth(h1, h2));
xbt_free(route);
}
if (!strcmp(argv[2], "FULL_LINK")) {
int list_size = sg_host_count();
for (int i = 0; i < list_size; i++) {
- sg_host_t w1 = workstations[i];
- const char *name1 = sg_host_get_name(w1);
+ sg_host_t h1 = hosts[i];
+ const char *name1 = sg_host_get_name(h1);
for (int j = 0; j < list_size; j++) {
- sg_host_t w2 = workstations[j];
- const char *name2 = sg_host_get_name(w2);
+ sg_host_t h2 = hosts[j];
+ const char *name2 = sg_host_get_name(h2);
printf("Route between %s and %s\n", name1, name2);
- SD_link_t *route = SD_route_get_list(w1, w2);
- int route_size = SD_route_get_size(w1, w2);
+ SD_link_t *route = SD_route_get_list(h1, h2);
+ int route_size = SD_route_get_size(h1, h2);
printf(" Route size %d\n", route_size);
for (int k = 0; k < route_size; k++) {
printf(" Link %s: latency = %f, bandwidth = %f\n",
sg_link_name(route[k]), sg_link_latency(route[k]), sg_link_bandwidth(route[k]));
}
- printf(" Route latency = %f, route bandwidth = %f\n", SD_route_get_latency(w1, w2), SD_route_get_bandwidth(w1, w2));
+ printf(" Route latency = %f, route bandwidth = %f\n",
+ SD_route_get_latency(h1, h2), SD_route_get_bandwidth(h1, h2));
xbt_free(route);
}
}
if (!strcmp(argv[2], "PROP"))
printf("SG_TEST_mem: %s\n", sg_host_get_property_value(sg_host_by_name("host1"), "SG_TEST_mem"));
}
- xbt_free(workstations);
+ xbt_free(hosts);
SD_exit();
return 0;