-/* Copyright (c) 2017-2021. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2017-2022. 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. */
for (size_t j = i + 1; j < hosts_count; j++)
communication_amounts[i * hosts_count + j] = 1e7; // 10 MB
+ simgrid::s4u::ExecPtr activity =
+ simgrid::s4u::this_actor::exec_init(hosts, computation_amounts, communication_amounts);
try {
- simgrid::s4u::this_actor::exec_init(hosts, computation_amounts, communication_amounts)
- ->wait_for(10.0 /* timeout (in seconds)*/);
+ activity->wait_for(10.0 /* timeout (in seconds)*/);
xbt_die("Woops, this did not timeout as expected... Please report that bug.");
} catch (const simgrid::TimeoutException&) {
XBT_INFO("Caught the expected timeout exception.");
+ activity->cancel();
}
/* ------[ test 3 ]----------------- */
XBT_INFO("Then, Monitor the execution of a parallel activity");
computation_amounts.assign(hosts_count, 1e6 /*1Mflop*/);
communication_amounts = {0, 1e6, 0, 0, 0, 1e6, 1e6, 0, 0};
- simgrid::s4u::ExecPtr activity =
- simgrid::s4u::this_actor::exec_init(hosts, computation_amounts, communication_amounts);
+ activity = simgrid::s4u::this_actor::exec_init(hosts, computation_amounts, communication_amounts);
activity->start();
while (not activity->test()) {
xbt_assert(argc == 2, "Usage: %s <platform file>", argv[0]);
e.load_platform(argv[1]);
- simgrid::s4u::Actor::create("test", simgrid::s4u::Host::by_name("MyHost1"), runner);
+ simgrid::s4u::Actor::create("test", e.host_by_name("MyHost1"), runner);
e.run();
XBT_INFO("Simulation done.");