include teshsuite/s4u/comm-pt2pt/comm-pt2pt.cpp
include teshsuite/s4u/concurrent_rw/concurrent_rw.cpp
include teshsuite/s4u/concurrent_rw/concurrent_rw.tesh
+include teshsuite/s4u/dependencies/dependencies.cpp
+include teshsuite/s4u/dependencies/dependencies.tesh
include teshsuite/s4u/evaluate-get-route-time/evaluate-get-route-time.cpp
include teshsuite/s4u/evaluate-parse-time/evaluate-parse-time.cpp
include teshsuite/s4u/host-multicore-speed-file/host-multicore-speed-file.cpp
SD_task_dependency_add(taskD, taskC);
SD_task_dependency_add(taskB, taskC);
- try {
- SD_task_dependency_add(taskA, taskA); /* shouldn't work and must raise an exception */
- xbt_die("Hey, I can add a dependency between Task A and Task A!");
- } catch (const std::invalid_argument& e) {
- XBT_DEBUG("Caught invalid_argument: %s", e.what());
- }
-
- try {
- SD_task_dependency_add(taskB, taskA); /* shouldn't work and must raise an exception */
- xbt_die("Oh oh, I can add an already existing dependency!");
- } catch (const std::invalid_argument& e) {
- XBT_DEBUG("Caught invalid_argument: %s", e.what());
- }
-
- try {
- SD_task_dependency_remove(taskA, taskC); /* shouldn't work and must raise an exception */
- xbt_die("Dude, I can remove an unknown dependency!");
- } catch (const std::invalid_argument& e) {
- XBT_DEBUG("Caught invalid_argument: %s", e.what());
- }
-
- try {
- SD_task_dependency_remove(taskC, taskC); /* shouldn't work and must raise an exception */
- xbt_die("Wow, I can remove a dependency between Task C and itself!");
- } catch (const std::invalid_argument& e) {
- XBT_DEBUG("Caught invalid_argument: %s", e.what());
- }
-
- /* if everything is ok, no exception is forwarded or rethrown by main() */
-
/* watch points */
SD_task_watch(taskD, SD_DONE);
SD_task_watch(taskB, SD_DONE);
void remove_successor(ActivityPtr a)
{
if(this == a)
- throw std::invalid_argument("Cannot ask to remove its from successors");
+ throw std::invalid_argument("Cannot ask to remove itself from successors list");
auto p = std::find_if(successors_.begin(), successors_.end(), [a](ActivityPtr const& i){ return i.get() == a.get(); });
if (p != successors_.end()){
comm-get-sender comm-pt2pt wait-all-for wait-any-for
cloud-interrupt-migration cloud-two-execs
concurrent_rw
+ dependencies
host-on-off host-on-off-actors host-on-off-recv host-multicore-speed-file io-set-bw
basic-link-test basic-parsing-test evaluate-get-route-time evaluate-parse-time is-router
storage_client_server listen_async pid
## Add the tests.
## Some need to be run with all factories, some don't need tesh to run
-foreach(x actor actor-autorestart actor-suspend
- activity-lifecycle comm-get-sender wait-all-for wait-any-for
- cloud-interrupt-migration cloud-two-execs concurrent_rw io-set-bw
- vm-live-migration vm-suicide)
+foreach(x actor actor-autorestart actor-suspend activity-lifecycle comm-get-sender wait-all-for wait-any-for
+ cloud-interrupt-migration cloud-two-execs concurrent_rw dependencies io-set-bw
+ vm-live-migration vm-suicide)
set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh)
ADD_TESH_FACTORIES(tesh-s4u-${x} "*" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/s4u/${x} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/s4u/${x} --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --cd ${CMAKE_BINARY_DIR}/teshsuite/s4u/${x} ${CMAKE_HOME_DIRECTORY}/teshsuite/s4u/${x}/${x}.tesh)
endforeach()
--- /dev/null
+/* Copyright (c) 2006-2021. 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/s4u.hpp"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(dependencies, "Logging specific to this test");
+
+int main(int argc, char** argv)
+{
+ simgrid::s4u::Engine e(&argc, argv);
+ xbt_assert(argc > 1, "Usage: %s platform_file\n\nExample: %s two_clusters.xml", argv[0], argv[0]);
+ e.load_platform(argv[1]);
+
+ simgrid::s4u::Exec::on_completion.connect([](simgrid::s4u::Exec const& exec) {
+ XBT_INFO("Exec '%s' start time: %f, finish time: %f", exec.get_cname(), exec.get_start_time(),
+ exec.get_finish_time());
+ });
+
+ /* creation of the activities and their dependencies */
+ simgrid::s4u::ExecPtr A = simgrid::s4u::Exec::init()->set_name("A")->vetoable_start();
+ simgrid::s4u::ExecPtr B = simgrid::s4u::Exec::init()->set_name("B")->vetoable_start();
+ simgrid::s4u::ExecPtr C = simgrid::s4u::Exec::init()->set_name("C")->vetoable_start();
+ simgrid::s4u::ExecPtr D = simgrid::s4u::Exec::init()->set_name("D")->vetoable_start();
+
+ B->add_successor(A);
+ C->add_successor(A);
+ D->add_successor(B);
+ D->add_successor(C);
+ B->add_successor(C);
+
+ try {
+ A->add_successor(A);
+ ; /* shouldn't work and must raise an exception */
+ xbt_die("Hey, I can add a dependency between A and A!");
+ } catch (const std::invalid_argument& e) {
+ XBT_INFO("Caught attempt to self-dependency creation: %s", e.what());
+ }
+
+ try {
+ B->add_successor(A); /* shouldn't work and must raise an exception */
+ xbt_die("Oh oh, I can add an already existing dependency!");
+ } catch (const std::invalid_argument& e) {
+ XBT_INFO("Caught attempt to add an already existing dependency: %s", e.what());
+ }
+
+ try {
+ A->remove_successor(C); /* shouldn't work and must raise an exception */
+ xbt_die("Dude, I can remove an unknown dependency!");
+ } catch (const std::invalid_argument& e) {
+ XBT_INFO("Caught attempt to remove an unknown dependency: %s", e.what());
+ }
+
+ try {
+ C->remove_successor(C); /* shouldn't work and must raise an exception */
+ xbt_die("Wow, I can remove a dependency between Task C and itself!");
+ } catch (const std::invalid_argument& e) {
+ XBT_INFO("Caught attempt to remove a self-dependency: %s", e.what());
+ }
+
+ /* scheduling parameters */
+ const auto hosts = e.get_all_hosts();
+ std::vector<simgrid::s4u::Host*> host_list = {hosts[2], hosts[4]};
+ std::vector<double> flops_amounts = {2000000, 1000000};
+ std::vector<double> bytes_amounts = {0, 2000000, 3000000, 0};
+
+ A->set_flops_amounts(flops_amounts)->set_bytes_amounts(bytes_amounts)->set_hosts(host_list);
+ B->set_flops_amounts(flops_amounts)->set_bytes_amounts(bytes_amounts)->set_hosts(host_list);
+ C->set_flops_amounts(flops_amounts)->set_bytes_amounts(bytes_amounts)->set_hosts(host_list);
+ D->set_flops_amounts(flops_amounts)->set_bytes_amounts(bytes_amounts)->set_hosts(host_list);
+
+ e.run();
+ return 0;
+}
--- /dev/null
+#!/usr/bin/env tesh
+
+$ ./dependencies ${platfdir}/small_platform.xml --cfg=host/model:ptask_L07
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'host/model' to 'ptask_L07'
+> [0.000000] [xbt_cfg/INFO] Switching to the L07 model to handle parallel tasks.
+> [0.000000] [dependencies/INFO] Caught attempt to self-dependency creation: Cannot be its own successor
+> [0.000000] [dependencies/INFO] Caught attempt to add an already existing dependency: Dependency already exists
+> [0.000000] [dependencies/INFO] Caught attempt to remove an unknown dependency: Dependency does not exist. Can not be removed.
+> [0.000000] [dependencies/INFO] Caught attempt to remove a self-dependency: Cannot ask to remove itself from successors list
+> [2.004027] [dependencies/INFO] Exec 'D' start time: 0.000000, finish time: 2.004027
+> [4.008055] [dependencies/INFO] Exec 'B' start time: 2.004027, finish time: 4.008055
+> [6.012082] [dependencies/INFO] Exec 'C' start time: 4.008055, finish time: 6.012082
+> [8.016109] [dependencies/INFO] Exec 'A' start time: 6.012082, finish time: 8.016109