From: Frederic Suter Date: Thu, 18 Aug 2016 09:07:21 +0000 (+0200) Subject: factor these 2 basic tests X-Git-Tag: v3_14~531 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/b50c9fa3664989731fa39e880b1b07601fe258f0?hp=ecf5eb0b909ccd533cf7797099d9b9e976e5adcb factor these 2 basic tests --- diff --git a/teshsuite/simdag/CMakeLists.txt b/teshsuite/simdag/CMakeLists.txt index 38b0776784..cde7cfceb7 100644 --- a/teshsuite/simdag/CMakeLists.txt +++ b/teshsuite/simdag/CMakeLists.txt @@ -1,4 +1,4 @@ -foreach(x availability basic0 basic1 basic2 basic3 basic4 basic5 basic6 basic-link-test basic-parsing-test +foreach(x availability basic0 basic1 basic3 basic4 basic5 basic6 basic-link-test basic-parsing-test comm-mxn-all2all comm-mxn-independent comm-mxn-scatter comm-p2p-latency-1 comm-p2p-latency-2 comm-p2p-latency-3 comm-p2p-latency-bound comp-only-par comp-only-seq incomplete) add_executable (${x} ${x}/${x}.c) @@ -70,7 +70,7 @@ set(txt_files ${txt_files} ${CMAKE_CURRENT_SOURCE_DIR}/platforms/carol. ${CMAKE_CURRENT_SOURCE_DIR}/platforms/link.fail ${CMAKE_CURRENT_SOURCE_DIR}/platforms/link.lat PARENT_SCOPE) -foreach(x availability basic0 basic1 basic2 basic3 basic4 basic5 basic6 basic-link-test basic-parsing-test +foreach(x availability basic0 basic1 basic3 basic4 basic5 basic6 basic-link-test basic-parsing-test comm-mxn-all2all comm-mxn-independent comm-mxn-scatter comm-p2p-latency-1 flatifier is-router comm-p2p-latency-2 comm-p2p-latency-3 comm-p2p-latency-bound comp-only-par comp-only-seq incomplete) ADD_TESH(tesh-simdag-${x} --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/simdag/${x} --setenv srcdir=${CMAKE_HOME_DIRECTORY} --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/${x} ${x}.tesh) diff --git a/teshsuite/simdag/basic1/basic1.c b/teshsuite/simdag/basic1/basic1.c index c296bcbb98..318911f5d9 100644 --- a/teshsuite/simdag/basic1/basic1.c +++ b/teshsuite/simdag/basic1/basic1.c @@ -5,7 +5,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "simgrid/simdag.h" -#include "xbt/log.h" +#include "xbt/str.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(basic1, sd, "SimDag test basic1"); @@ -21,16 +21,15 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(basic1, sd, "SimDag test basic1"); */ int main(int argc, char **argv) { - /* scheduling parameters */ - double communication_amount1 = 1e9; - double communication_amount2 = 1e9; - double no_cost = 0.0; /* initialization of SD */ SD_init(&argc, argv); /* creation of the environment */ SD_create_environment(argv[1]); + /* scheduling parameters */ + double communication_amount1 = xbt_str_parse_double(argv[2], "Invalid communication size: %s"); + double communication_amount2 = xbt_str_parse_double(argv[3], "Invalid communication size: %s"); /* creation of the tasks and their dependencies */ SD_task_t taskInit = SD_task_create("Init", NULL, 1.0); @@ -41,9 +40,9 @@ int main(int argc, char **argv) SD_task_dependency_add(NULL, NULL, taskInit, taskB); sg_host_t *hosts = sg_host_list(); - SD_task_schedule(taskInit, 1, hosts, &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); + SD_task_schedule(taskInit, 1, hosts, SD_SCHED_NO_COST, SD_SCHED_NO_COST, -1.0); + SD_task_schedule(taskA, 1, &hosts[0], SD_SCHED_NO_COST, &communication_amount1, -1.0); + SD_task_schedule(taskB, 1, &hosts[1], SD_SCHED_NO_COST, &communication_amount2, -1.0); xbt_free(hosts); /* let's launch the simulation! */ diff --git a/teshsuite/simdag/basic1/basic1.tesh b/teshsuite/simdag/basic1/basic1.tesh index c6f62d986e..72369bb5f8 100644 --- a/teshsuite/simdag/basic1/basic1.tesh +++ b/teshsuite/simdag/basic1/basic1.tesh @@ -1,3 +1,7 @@ -$ ${bindir:=.}/basic1 ../../../examples/platforms/two_hosts_platform_shared.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" +$ ${bindir:=.}/basic1 ../../../examples/platforms/two_hosts_platform_shared.xml 1e9 1e9 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" > [ 0.000000] (0:maestro@) Switching to the L07 model to handle parallel tasks. > [ 16.000100] (0:maestro@) Simulation time: 16.000100 + +$ ${bindir:=.}/basic1 ../../../examples/platforms/two_hosts_platform_shared.xml 1e9 1e8 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" +> [ 0.000000] (0:maestro@) Switching to the L07 model to handle parallel tasks. +> [ 8.800100] (0:maestro@) Simulation time: 8.800100 diff --git a/teshsuite/simdag/basic2/basic2.c b/teshsuite/simdag/basic2/basic2.c deleted file mode 100644 index 5e308c401a..0000000000 --- a/teshsuite/simdag/basic2/basic2.c +++ /dev/null @@ -1,59 +0,0 @@ -/* Copyright (c) 2007-2012, 2014-2015. The SimGrid Team. - * All rights reserved. */ - -/* This program is free software; you can redistribute it and/or modify it - * under the terms of the license (GNU LGPL) which comes with this package. */ - -#include "simgrid/simdag.h" -#include "xbt/log.h" - -XBT_LOG_NEW_DEFAULT_SUBCATEGORY(basic2, sd, "SimDag test basic2"); - -/* Basic SimDag Test 2 - * Scenario: - * - 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. - * Simulated time should be: - * 1e8/(1/2*1.25e8) + 9e8/1.25e8) + 1e-4 = 8.8001 seconds - */ -int main(int argc, char **argv) -{ - /* scheduling parameters */ - double communication_amount1 = 1e9; - double communication_amount2 = 1e8; - double no_cost = 0.0; - - /* initialization of SD */ - SD_init(&argc, argv); - - /* creation of the environment */ - SD_create_environment(argv[1]); - - /* creation of the tasks and their dependencies */ - 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); - - sg_host_t *hosts = sg_host_list(); - SD_task_schedule(taskInit, 1, hosts, &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); - xbt_free(hosts); - - /* let's launch the simulation! */ - SD_simulate(-1.0); - SD_task_destroy(taskA); - SD_task_destroy(taskB); - SD_task_destroy(taskInit); - - XBT_INFO("Simulation time: %f", SD_get_clock()); - - SD_exit(); - return 0; -} diff --git a/teshsuite/simdag/basic2/basic2.tesh b/teshsuite/simdag/basic2/basic2.tesh deleted file mode 100644 index 8dadc8e627..0000000000 --- a/teshsuite/simdag/basic2/basic2.tesh +++ /dev/null @@ -1,3 +0,0 @@ -$ ${bindir:=.}/basic2 ../../../examples/platforms/two_hosts_platform_shared.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" -> [ 0.000000] (0:maestro@) Switching to the L07 model to handle parallel tasks. -> [ 8.800100] (0:maestro@) Simulation time: 8.800100