X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/4de2a148bea34f550b79c07fb5e80ac36e6aa0e9..ae62510f83c4cd6e7967aa00897bf66671a5923a:/examples/cpp/dag-comm/s4u-dag-comm.cpp diff --git a/examples/cpp/dag-comm/s4u-dag-comm.cpp b/examples/cpp/dag-comm/s4u-dag-comm.cpp index a1cb5c9ef5..9e671b4dbc 100644 --- a/examples/cpp/dag-comm/s4u-dag-comm.cpp +++ b/examples/cpp/dag-comm/s4u-dag-comm.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2022. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-2023. 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. */ @@ -26,33 +26,31 @@ int main(int argc, char* argv[]) }); sg4::Activity::on_completion_cb([](sg4::Activity const& activity) { - const auto* exec = dynamic_cast(&activity); - if (exec != nullptr) + if (const auto* exec = dynamic_cast(&activity)) XBT_INFO("Activity '%s' is complete (start time: %f, finish time: %f)", exec->get_cname(), exec->get_start_time(), exec->get_finish_time()); - const auto* comm = dynamic_cast(&activity); - if (comm != nullptr) + if (const auto* comm = dynamic_cast(&activity)) XBT_INFO("Activity '%s' is complete", comm->get_cname()); }); - // Create a small DAG: parent->transfert->child - sg4::ExecPtr parent = sg4::Exec::init(); - sg4::CommPtr transfert = sg4::Comm::sendto_init(); - sg4::ExecPtr child = sg4::Exec::init(); - parent->add_successor(transfert); - transfert->add_successor(child); + // Create a small DAG: parent->transfer->child + sg4::ExecPtr parent = sg4::Exec::init(); + sg4::CommPtr transfer = sg4::Comm::sendto_init(); + sg4::ExecPtr child = sg4::Exec::init(); + parent->add_successor(transfer); + transfer->add_successor(child); // Set the parameters (the name is for logging purposes only) // + parent and child end after 1 second - parent->set_name("parent")->set_flops_amount(tremblay->get_speed())->vetoable_start(); - transfert->set_name("transfert")->set_payload_size(125e6)->vetoable_start(); - child->set_name("child")->set_flops_amount(jupiter->get_speed())->vetoable_start(); + parent->set_name("parent")->set_flops_amount(tremblay->get_speed())->start(); + transfer->set_name("transfer")->set_payload_size(125e6)->start(); + child->set_name("child")->set_flops_amount(jupiter->get_speed())->start(); // Schedule the different activities parent->set_host(tremblay); - transfert->set_source(tremblay); + transfer->set_source(tremblay); child->set_host(jupiter); - transfert->set_destination(jupiter); + transfer->set_destination(jupiter); e.run();