From: Fred Suter Date: Wed, 8 Feb 2023 21:10:15 +0000 (-0500) Subject: make all Activity starts vetoable X-Git-Tag: v3.34~560 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/7f00b09c7ebfa3b4e12c96c764ee7a0e0e07ec20 make all Activity starts vetoable --- diff --git a/examples/cpp/comm-dependent/s4u-comm-dependent.cpp b/examples/cpp/comm-dependent/s4u-comm-dependent.cpp index 775aa8acbd..d40c99feff 100644 --- a/examples/cpp/comm-dependent/s4u-comm-dependent.cpp +++ b/examples/cpp/comm-dependent/s4u-comm-dependent.cpp @@ -15,7 +15,7 @@ static void sender(sg4::Mailbox* mailbox) sg4::CommPtr comm = mailbox->put_init(computation_amount, 7e6); exec->set_name("exec on sender")->add_successor(comm)->start(); - comm->set_name("comm to receiver")->vetoable_start(); + comm->set_name("comm to receiver")->start(); exec->wait(); comm->wait(); } @@ -28,7 +28,7 @@ static void receiver(sg4::Mailbox* mailbox) sg4::CommPtr comm = mailbox->get_init()->set_dst_data((void**)&received, sizeof(double)); comm->set_name("comm from sender")->add_successor(exec)->start(); - exec->set_name("exec on receiver")->vetoable_start(); + exec->set_name("exec on receiver")->start(); comm->wait(); exec->wait(); diff --git a/examples/cpp/comm-dependent/s4u-comm-dependent.tesh b/examples/cpp/comm-dependent/s4u-comm-dependent.tesh index 613464dc69..7faa65ee7b 100644 --- a/examples/cpp/comm-dependent/s4u-comm-dependent.tesh +++ b/examples/cpp/comm-dependent/s4u-comm-dependent.tesh @@ -3,6 +3,8 @@ p Testing with default compound $ ${bindir:=.}/s4u-comm-dependent ${platfdir}/small_platform.xml --log=s4u_activity.t:verbose "--log=root.fmt:[%6.2r]%e(%i:%a@%h)%e%m%n" +> [ 0.00] (1:sender@Tremblay) 'exec on sender' is assigned to a resource and all dependencies are solved. Let's start +> [ 0.00] (2:receiver@Jupiter) 'comm from sender' is assigned to a resource and all dependencies are solved. Let's start > [ 2.00] (1:sender@Tremblay) Remove a dependency from 'exec on sender' on 'comm to receiver' > [ 2.00] (1:sender@Tremblay) 'comm to receiver' is assigned to a resource and all dependencies are solved. Let's start > [ 3.07] (2:receiver@Jupiter) Remove a dependency from 'comm from sender' on 'exec on receiver' diff --git a/examples/cpp/dag-comm/s4u-dag-comm.cpp b/examples/cpp/dag-comm/s4u-dag-comm.cpp index c58c1b8a63..9e671b4dbc 100644 --- a/examples/cpp/dag-comm/s4u-dag-comm.cpp +++ b/examples/cpp/dag-comm/s4u-dag-comm.cpp @@ -42,9 +42,9 @@ int main(int argc, char* argv[]) // 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(); - transfer->set_name("transfer")->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); diff --git a/examples/cpp/dag-failure/s4u-dag-failure.cpp b/examples/cpp/dag-failure/s4u-dag-failure.cpp index fc520b8ad2..631b24c62c 100644 --- a/examples/cpp/dag-failure/s4u-dag-failure.cpp +++ b/examples/cpp/dag-failure/s4u-dag-failure.cpp @@ -36,7 +36,7 @@ int main(int argc, char** argv) /* creation of a single Exec that will poorly fail when the workstation will stop */ XBT_INFO("First test: sequential Exec activity"); - sg4::ExecPtr exec = sg4::Exec::init()->set_name("Poor task")->set_flops_amount(2e10)->vetoable_start(); + sg4::ExecPtr exec = sg4::Exec::init()->set_name("Poor task")->set_flops_amount(2e10)->start(); XBT_INFO("Schedule Activity '%s' on 'Faulty Host'", exec->get_cname()); exec->set_host(faulty); @@ -44,7 +44,7 @@ int main(int argc, char** argv) /* Add a child Exec that depends on the Poor task' */ sg4::ExecPtr child = sg4::Exec::init()->set_name("Child")->set_flops_amount(2e10)->set_host(safe); exec->add_successor(child); - child->vetoable_start(); + child->start(); XBT_INFO("Run the simulation"); e.run(); @@ -57,7 +57,7 @@ int main(int argc, char** argv) e.run(); XBT_INFO("Second test: parallel Exec activity"); - exec = sg4::Exec::init()->set_name("Poor parallel task")->set_flops_amounts({2e10, 2e10})->vetoable_start(); + exec = sg4::Exec::init()->set_name("Poor parallel task")->set_flops_amounts({2e10, 2e10})->start(); XBT_INFO("Schedule Activity '%s' on 'Safe Host' and 'Faulty Host'", exec->get_cname()); exec->set_hosts({safe, faulty}); @@ -65,7 +65,7 @@ int main(int argc, char** argv) /* Add a child Exec that depends on the Poor parallel task' */ child = sg4::Exec::init()->set_name("Child")->set_flops_amount(2e10)->set_host(safe); exec->add_successor(child); - child->vetoable_start(); + child->start(); XBT_INFO("Run the simulation"); e.run(); diff --git a/examples/cpp/dag-io/s4u-dag-io.cpp b/examples/cpp/dag-io/s4u-dag-io.cpp index 25906511a1..ee00eb03a9 100644 --- a/examples/cpp/dag-io/s4u-dag-io.cpp +++ b/examples/cpp/dag-io/s4u-dag-io.cpp @@ -50,10 +50,10 @@ int main(int argc, char* argv[]) child->set_name("child")->set_flops_amount(carl->get_speed()); // Schedule and try to start the different activities - parent->set_host(bob)->vetoable_start(); - write_output->set_disk(bob->get_disks().front())->vetoable_start(); - read_input->set_disk(carl->get_disks().front())->vetoable_start(); - child->set_host(carl)->vetoable_start(); + parent->set_host(bob)->start(); + write_output->set_disk(bob->get_disks().front())->start(); + read_input->set_disk(carl->get_disks().front())->start(); + child->set_host(carl)->start(); e.run(); diff --git a/examples/cpp/dag-simple/s4u-dag-simple.cpp b/examples/cpp/dag-simple/s4u-dag-simple.cpp index a22d3da784..aae95e7101 100644 --- a/examples/cpp/dag-simple/s4u-dag-simple.cpp +++ b/examples/cpp/dag-simple/s4u-dag-simple.cpp @@ -56,9 +56,9 @@ int main(int argc, char* argv[]) second_parent->set_host(fafard); // Start all activities that can actually start. - first_parent->vetoable_start(); - second_parent->vetoable_start(); - child->vetoable_start(); + first_parent->start(); + second_parent->start(); + child->start(); while (child->get_state() != sg4::Activity::State::FINISHED) { e.run(); diff --git a/examples/cpp/exec-dependent/s4u-exec-dependent.cpp b/examples/cpp/exec-dependent/s4u-exec-dependent.cpp index 3353d5af67..a62cfd0f43 100644 --- a/examples/cpp/exec-dependent/s4u-exec-dependent.cpp +++ b/examples/cpp/exec-dependent/s4u-exec-dependent.cpp @@ -37,8 +37,7 @@ static void worker() // Start the activities. first_parent->start(); second_parent->start(); - // child uses a vetoable start to force it to wait for the completion of its predecessors - child->vetoable_start(); + child->start(); // wait for the completion of all activities while (not pending_execs.empty()) { diff --git a/examples/cpp/exec-dependent/s4u-exec-dependent.tesh b/examples/cpp/exec-dependent/s4u-exec-dependent.tesh index a376e10d03..5c504006d2 100644 --- a/examples/cpp/exec-dependent/s4u-exec-dependent.tesh +++ b/examples/cpp/exec-dependent/s4u-exec-dependent.tesh @@ -1,6 +1,8 @@ #!/usr/bin/env tesh $ ${bindir:=.}/s4u-exec-dependent ${platfdir}/small_platform.xml --log=s4u_activity.t:verbose "--log=root.fmt:[%10.6r]%e(%i:%a@%h)%e%m%n" +> [ 0.000000] (1:worker@Fafard) 'parent 1' is assigned to a resource and all dependencies are solved. Let's start +> [ 0.000000] (1:worker@Fafard) 'parent 2' is assigned to a resource and all dependencies are solved. Let's start > [ 0.000000] (1:worker@Fafard) Activity 'child' vetoed. Dependencies: NOT solved; Ressources: NOT assigned > [ 2.000000] (1:worker@Fafard) Remove a dependency from 'parent 1' on 'child' > [ 2.000000] (1:worker@Fafard) Exec 'parent 1' is complete diff --git a/examples/cpp/exec-unassigned/s4u-exec-unassigned.cpp b/examples/cpp/exec-unassigned/s4u-exec-unassigned.cpp index db0387c835..054f81da8f 100644 --- a/examples/cpp/exec-unassigned/s4u-exec-unassigned.cpp +++ b/examples/cpp/exec-unassigned/s4u-exec-unassigned.cpp @@ -15,7 +15,7 @@ static void worker() double computation_amount = sg4::this_actor::get_host()->get_speed(); // Create an unassigned activity and start it. It will not actually start, because it's not assigned to any host yet - sg4::ExecPtr exec = sg4::Exec::init()->set_flops_amount(computation_amount)->set_name("exec")->vetoable_start(); + sg4::ExecPtr exec = sg4::Exec::init()->set_flops_amount(computation_amount)->set_name("exec")->start(); // Wait for a while sg4::this_actor::sleep_for(10); diff --git a/examples/cpp/io-dependent/s4u-io-dependent.cpp b/examples/cpp/io-dependent/s4u-io-dependent.cpp index be5e54d29f..8788e10753 100644 --- a/examples/cpp/io-dependent/s4u-io-dependent.cpp +++ b/examples/cpp/io-dependent/s4u-io-dependent.cpp @@ -39,9 +39,9 @@ static void test() // Start the activities. bob_compute->start(); - bob_write->vetoable_start(); - carl_read->vetoable_start(); - carl_compute->vetoable_start(); + bob_write->start(); + carl_read->start(); + carl_compute->start(); // wait for the completion of all activities while (not pending_activities.empty()) { diff --git a/examples/cpp/io-dependent/s4u-io-dependent.tesh b/examples/cpp/io-dependent/s4u-io-dependent.tesh index b44775f299..8feb8524d2 100644 --- a/examples/cpp/io-dependent/s4u-io-dependent.tesh +++ b/examples/cpp/io-dependent/s4u-io-dependent.tesh @@ -2,6 +2,7 @@ ! output sort $ ${bindir:=.}/s4u-io-dependent ${platfdir}/hosts_with_disks.xml --log=s4u_activity.t:verbose "--log=root.fmt:[%10.6r]%e(%i:%a@%h)%e%m%n" +> [ 0.000000] (1:bob@bob) 'bob compute' is assigned to a resource and all dependencies are solved. Let's start > [ 1.000000] (1:bob@bob) 'bob write' is assigned to a resource and all dependencies are solved. Let's start > [ 1.000000] (1:bob@bob) Remove a dependency from 'bob compute' on 'bob write' > [ 1.000000] (1:bob@bob) Activity 'bob compute' is complete diff --git a/include/simgrid/s4u/Activity.hpp b/include/simgrid/s4u/Activity.hpp index c22a047d4e..0e0b72aabc 100644 --- a/include/simgrid/s4u/Activity.hpp +++ b/include/simgrid/s4u/Activity.hpp @@ -63,7 +63,7 @@ protected: XBT_CVERB(s4u_activity, "Remove a dependency from '%s' on '%s'", get_cname(), b->get_cname()); b->dependencies_.erase(this); if (b->dependencies_solved()) { - b->vetoable_start(); + b->start(); } successors_.pop_back(); } @@ -118,12 +118,16 @@ public: /*! Add a callback fired when the activity is resumed after being suspended */ static void on_resumed_cb(const std::function& cb) { on_resumed.connect(cb); } - void vetoable_start() + XBT_ATTRIB_DEPRECATED_v334("All start() are vetoable now. Please use start() ") void vetoable_start() + { + start(); + } + void start() { state_ = State::STARTING; if (dependencies_solved() && is_assigned()) { XBT_CVERB(s4u_activity, "'%s' is assigned to a resource and all dependencies are solved. Let's start", get_cname()); - start(); + do_start(); } else { if (vetoed_activities_ != nullptr) vetoed_activities_->insert(this); @@ -151,7 +155,7 @@ public: * * This function is optional: you can call wait() even if you didn't call start() */ - virtual Activity* start() = 0; + virtual Activity* do_start() = 0; /** Tests whether the given activity is terminated yet. */ virtual bool test(); /*! take a vector s4u::ActivityPtr and return the rank of the first finished one (or -1 if none is done). */ @@ -269,10 +273,13 @@ public: { return get_data(); } - - AnyActivity* vetoable_start() + XBT_ATTRIB_DEPRECATED_v334("All start() are vetoable now. Please use start() ") AnyActivity* vetoable_start() + { + return start(); + } + AnyActivity* start() { - Activity::vetoable_start(); + Activity::start(); return static_cast(this); } diff --git a/include/simgrid/s4u/Comm.hpp b/include/simgrid/s4u/Comm.hpp index ba67bc32e8..c5f441c1fc 100644 --- a/include/simgrid/s4u/Comm.hpp +++ b/include/simgrid/s4u/Comm.hpp @@ -37,6 +37,7 @@ class XBT_PUBLIC Comm : public Activity_T { std::function copy_data_function_; Comm() = default; + Comm* do_start() override; public: /* signals and related callbacks */ @@ -148,7 +149,6 @@ public: Actor* get_sender() const; /* Comm life cycle */ - Comm* start() override; /** Start the comm, and ignore its result. It can be completely forgotten after that. */ Comm* detach(); /** Start the comm, and ignore its result. It can be completely forgotten after that. */ diff --git a/include/simgrid/s4u/Exec.hpp b/include/simgrid/s4u/Exec.hpp index cec0812e75..cd514ea08e 100644 --- a/include/simgrid/s4u/Exec.hpp +++ b/include/simgrid/s4u/Exec.hpp @@ -39,6 +39,7 @@ class XBT_PUBLIC Exec : public Activity_T { protected: explicit Exec(kernel::activity::ExecImplPtr pimpl); + Exec* do_start() override; void reset() const; @@ -53,7 +54,6 @@ public: static void on_start_cb(const std::function& cb) { on_start.connect(cb); } static ExecPtr init(); - Exec* start() override; /*! take a vector of s4u::ExecPtr and return when one of them is finished. * The return value is the rank of the first finished ExecPtr. */ diff --git a/include/simgrid/s4u/Io.hpp b/include/simgrid/s4u/Io.hpp index fbec00b9d6..8c626f774c 100644 --- a/include/simgrid/s4u/Io.hpp +++ b/include/simgrid/s4u/Io.hpp @@ -29,6 +29,7 @@ class XBT_PUBLIC Io : public Activity_T { protected: explicit Io(kernel::activity::IoImplPtr pimpl); + Io* do_start() override; public: enum class OpType { READ, WRITE }; @@ -36,7 +37,6 @@ public: static void on_start_cb(const std::function& cb) { on_start.connect(cb); } static IoPtr init(); - Io* start() override; /*! take a vector of s4u::IoPtr and return when one of them is finished. * The return value is the rank of the first finished IoPtr. */ static ssize_t wait_any(const std::vector& ios) { return wait_any_for(ios, -1); } diff --git a/include/simgrid/s4u/Mailbox.hpp b/include/simgrid/s4u/Mailbox.hpp index 3c910f6632..75201ecb39 100644 --- a/include/simgrid/s4u/Mailbox.hpp +++ b/include/simgrid/s4u/Mailbox.hpp @@ -134,7 +134,7 @@ public: template CommPtr Mailbox::get_async(T** data) { CommPtr res = get_init()->set_dst_data(reinterpret_cast(data), sizeof(void*)); - res->vetoable_start(); + res->start(); return res; } diff --git a/src/dag/loaders.cpp b/src/dag/loaders.cpp index d3c63aa082..de7b4687f8 100644 --- a/src/dag/loaders.cpp +++ b/src/dag/loaders.cpp @@ -33,7 +33,7 @@ static void uniq_transfer_task_name(simgrid::s4u::Comm* comm) std::string new_name = parent->get_name() + "_" + comm->get_name() + "_" + child->get_name(); - comm->set_name(new_name)->vetoable_start(); + comm->set_name(new_name)->start(); } static bool check_for_cycle(const std::vector& dag) @@ -92,12 +92,12 @@ std::vector create_DAG_from_DAX(const std::string& filename) dax_lineno = 1; auto root_task = Exec::init()->set_name("root")->set_flops_amount(0); - root_task->vetoable_start(); + root_task->start(); result.push_back(root_task); auto end_task = Exec::init()->set_name("end")->set_flops_amount(0); - end_task->vetoable_start(); + end_task->start(); xbt_assert(dax_lex() == 0, "Parse error in %s: %s", filename.c_str(), dax__parse_err_msg()); dax__delete_buffer(input_buffer); @@ -198,7 +198,7 @@ std::vector create_DAG_from_dot(const std::string& filename) if (activities.find(name) == activities.end()) { XBT_DEBUG("See ", name.c_str(), amount); - act = Exec::init()->set_name(name)->set_flops_amount(amount)->vetoable_start(); + act = Exec::init()->set_name(name)->set_flops_amount(amount)->start(); activities.try_emplace(name, act); if (name != "root" && name != "end") dag.push_back(act); @@ -208,12 +208,12 @@ std::vector create_DAG_from_dot(const std::string& filename) } /*Check if 'root' and 'end' nodes have been explicitly declared. If not, create them. */ if (activities.find("root") == activities.end()) - root = Exec::init()->set_name("root")->set_flops_amount(0)->vetoable_start(); + root = Exec::init()->set_name("root")->set_flops_amount(0)->start(); else root = activities.at("root"); if (activities.find("end") == activities.end()) - end = Exec::init()->set_name("end")->set_flops_amount(0)->vetoable_start(); + end = Exec::init()->set_name("end")->set_flops_amount(0)->start(); else end = activities.at("end"); @@ -238,7 +238,7 @@ std::vector create_DAG_from_dot(const std::string& filename) std::string name = std::string(src_name) + "->" + dst_name; XBT_DEBUG("See ", name.c_str(), size); if (activities.find(name) == activities.end()) { - act = Comm::sendto_init()->set_name(name)->set_payload_size(size)->vetoable_start(); + act = Comm::sendto_init()->set_name(name)->set_payload_size(size)->start(); src->add_successor(act); act->add_successor(dst); activities.try_emplace(name, act); @@ -310,7 +310,7 @@ void STag_dax__job() std::string name = std::string(A_dax__job_id) + "@" + A_dax__job_name; runtime *= 4200000000.; /* Assume that timings were done on a 4.2GFlops machine. I mean, why not? */ XBT_DEBUG("See ", A_dax__job_id, A_dax__job_runtime, runtime); - simgrid::s4u::current_job = simgrid::s4u::Exec::init()->set_name(name)->set_flops_amount(runtime)->vetoable_start(); + simgrid::s4u::current_job = simgrid::s4u::Exec::init()->set_name(name)->set_flops_amount(runtime)->start(); simgrid::s4u::jobs.try_emplace(A_dax__job_id, simgrid::s4u::current_job); simgrid::s4u::result.push_back(simgrid::s4u::current_job); } catch (const std::invalid_argument&) { diff --git a/src/s4u/s4u_Activity.cpp b/src/s4u/s4u_Activity.cpp index 383f6a039a..7b38f61bb2 100644 --- a/src/s4u/s4u_Activity.cpp +++ b/src/s4u/s4u_Activity.cpp @@ -52,7 +52,7 @@ void Activity::wait_until(double time_limit) Activity* Activity::wait_for(double timeout) { if (state_ == State::INITED) - vetoable_start(); + start(); if (state_ == State::FAILED) { if (dynamic_cast(this)) @@ -82,7 +82,7 @@ bool Activity::test() return true; if (state_ == State::INITED || state_ == State::STARTING) - this->vetoable_start(); + this->start(); kernel::actor::ActorImpl* issuer = kernel::actor::ActorImpl::self(); kernel::actor::ActivityTestSimcall observer{issuer, pimpl_.get()}; diff --git a/src/s4u/s4u_Actor.cpp b/src/s4u/s4u_Actor.cpp index 57aef00408..284faaa1f4 100644 --- a/src/s4u/s4u_Actor.cpp +++ b/src/s4u/s4u_Actor.cpp @@ -359,7 +359,7 @@ void execute(double flops) void execute(double flops, double priority) { - exec_init(flops)->set_priority(priority)->vetoable_start()->wait(); + exec_init(flops)->set_priority(priority)->start()->wait(); } void parallel_execute(const std::vector& hosts, const std::vector& flops_amounts, @@ -407,7 +407,7 @@ ExecPtr exec_init(const std::vector& hosts, const std::vectorvetoable_start(); + res->start(); return res; } diff --git a/src/s4u/s4u_Comm.cpp b/src/s4u/s4u_Comm.cpp index ad42fb4e86..dcacfd0b3e 100644 --- a/src/s4u/s4u_Comm.cpp +++ b/src/s4u/s4u_Comm.cpp @@ -178,7 +178,7 @@ CommPtr Comm::set_source(Host* from) if (state_ == State::STARTING && remains_ <= 0) XBT_DEBUG("This communication has a payload size of 0 byte. It cannot start yet"); else - vetoable_start(); + start(); return this; } @@ -196,7 +196,7 @@ CommPtr Comm::set_destination(Host* to) if (state_ == State::STARTING && remains_ <= 0) XBT_DEBUG("This communication has a payload size of 0 byte. It cannot start yet"); else - vetoable_start(); + start(); return this; } @@ -293,7 +293,7 @@ bool Comm::is_assigned() const mailbox_ != nullptr; } -Comm* Comm::start() +Comm* Comm::do_start() { xbt_assert(get_state() == State::INITED || get_state() == State::STARTING, "You cannot use %s() once your communication started (not implemented)", __FUNCTION__); @@ -356,7 +356,7 @@ Comm* Comm::detach() "You cannot use %s() once your communication is %s (not implemented)", __FUNCTION__, get_state_str()); xbt_assert(dst_buff_ == nullptr && dst_buff_size_ == 0, "You can only detach sends, not recvs"); detached_ = true; - vetoable_start(); + start(); return this; } @@ -386,7 +386,7 @@ Comm* Comm::wait_for(double timeout) case State::INITED: case State::STARTING: // It's not started yet. Do it in one simcall if it's a regular communication if (get_source() != nullptr || get_destination() != nullptr) { - return vetoable_start()->wait_for(timeout); // In the case of host2host comm, do it in two simcalls + return start()->wait_for(timeout); // In the case of host2host comm, do it in two simcalls } else if (src_buff_ != nullptr) { on_send(*this); send(sender_, mailbox_, remains_, rate_, src_buff_, src_buff_size_, match_fun_, copy_data_function_, diff --git a/src/s4u/s4u_Disk.cpp b/src/s4u/s4u_Disk.cpp index 5e5fea5f8b..9e3d59f8b3 100644 --- a/src/s4u/s4u_Disk.cpp +++ b/src/s4u/s4u_Disk.cpp @@ -120,38 +120,38 @@ IoPtr Disk::io_init(sg_size_t size, Io::OpType type) const IoPtr Disk::read_async(sg_size_t size) const { - return IoPtr(io_init(size, Io::OpType::READ))->vetoable_start(); + return IoPtr(io_init(size, Io::OpType::READ))->start(); } sg_size_t Disk::read(sg_size_t size) const { - return IoPtr(io_init(size, Io::OpType::READ))->vetoable_start()->wait()->get_performed_ioops(); + return IoPtr(io_init(size, Io::OpType::READ))->start()->wait()->get_performed_ioops(); } sg_size_t Disk::read(sg_size_t size, double priority) const { return IoPtr(io_init(size, Io::OpType::READ)) ->set_priority(priority) - ->vetoable_start() + ->start() ->wait() ->get_performed_ioops(); } IoPtr Disk::write_async(sg_size_t size) const { - return IoPtr(io_init(size, Io::OpType::WRITE)->vetoable_start()); + return IoPtr(io_init(size, Io::OpType::WRITE)->start()); } sg_size_t Disk::write(sg_size_t size) const { - return IoPtr(io_init(size, Io::OpType::WRITE))->vetoable_start()->wait()->get_performed_ioops(); + return IoPtr(io_init(size, Io::OpType::WRITE))->start()->wait()->get_performed_ioops(); } sg_size_t Disk::write(sg_size_t size, double priority) const { return IoPtr(io_init(size, Io::OpType::WRITE)) ->set_priority(priority) - ->vetoable_start() + ->start() ->wait() ->get_performed_ioops(); } diff --git a/src/s4u/s4u_Exec.cpp b/src/s4u/s4u_Exec.cpp index 5e4770db6f..597120ebeb 100644 --- a/src/s4u/s4u_Exec.cpp +++ b/src/s4u/s4u_Exec.cpp @@ -42,7 +42,7 @@ ExecPtr Exec::init() return ExecPtr(static_cast(pimpl->get_iface())); } -Exec* Exec::start() +Exec* Exec::do_start() { kernel::actor::simcall_answered([this] { (*boost::static_pointer_cast(pimpl_)) @@ -180,8 +180,8 @@ ExecPtr Exec::set_host(Host* host) pimpl_.get(), [this, host] { boost::static_pointer_cast(pimpl_)->set_host(host); }); if (state_ == State::STARTING) - // Setting the host may allow to start the activity, let's try - vetoable_start(); + // Setting the host may allow to start the activity, let's try + start(); return this; } @@ -198,7 +198,7 @@ ExecPtr Exec::set_hosts(const std::vector& hosts) // Setting the host may allow to start the activity, let's try if (state_ == State::STARTING) - vetoable_start(); + start(); return this; } @@ -213,7 +213,7 @@ ExecPtr Exec::unset_host() if (state_ == State::STARTED) cancel(); - vetoable_start(); + start(); return this; } @@ -287,7 +287,7 @@ double sg_exec_get_remaining_ratio(const_sg_exec_t exec) void sg_exec_start(sg_exec_t exec) { - exec->vetoable_start(); + exec->start(); } void sg_exec_cancel(sg_exec_t exec) diff --git a/src/s4u/s4u_Host.cpp b/src/s4u/s4u_Host.cpp index 67936f54da..b762e63859 100644 --- a/src/s4u/s4u_Host.cpp +++ b/src/s4u/s4u_Host.cpp @@ -396,7 +396,7 @@ void Host::execute(double flops) const void Host::execute(double flops, double priority) const { - this_actor::exec_init(flops)->set_priority(1 / priority)->vetoable_start()->wait(); + this_actor::exec_init(flops)->set_priority(1 / priority)->start()->wait(); } Host* Host::seal() diff --git a/src/s4u/s4u_Io.cpp b/src/s4u/s4u_Io.cpp index c88c7dc01a..191abc17ad 100644 --- a/src/s4u/s4u_Io.cpp +++ b/src/s4u/s4u_Io.cpp @@ -58,7 +58,7 @@ IoPtr Io::set_source(Host* from, const Disk* from_disk) if (state_ == State::STARTING && remains_ <= 0) XBT_DEBUG("This IO has a size of 0 byte. It cannot start yet"); else - vetoable_start(); + start(); return this; } @@ -76,12 +76,12 @@ IoPtr Io::set_destination(Host* to, const Disk* to_disk) if (state_ == State::STARTING && remains_ <= 0) XBT_DEBUG("This IO has a size of 0 byte. It cannot start yet"); else - vetoable_start(); + start(); return this; } -Io* Io::start() +Io* Io::do_start() { kernel::actor::simcall_answered( [this] { (*boost::static_pointer_cast(pimpl_)).set_name(get_name()).start(); }); @@ -111,7 +111,7 @@ IoPtr Io::set_disk(const_sg_disk_t disk) // Setting the disk may allow to start the activity, let's try if (state_ == State::STARTING) - vetoable_start(); + start(); return this; } diff --git a/src/s4u/s4u_Mailbox.cpp b/src/s4u/s4u_Mailbox.cpp index 0ebd9cfc62..6ce4a0339b 100644 --- a/src/s4u/s4u_Mailbox.cpp +++ b/src/s4u/s4u_Mailbox.cpp @@ -101,7 +101,7 @@ CommPtr Mailbox::put_async(void* payload, uint64_t simulated_size_in_bytes) xbt_assert(payload != nullptr, "You cannot send nullptr"); CommPtr res = put_init(payload, simulated_size_in_bytes); - res->vetoable_start(); + res->start(); return res; } @@ -109,7 +109,7 @@ void Mailbox::put(void* payload, uint64_t simulated_size_in_bytes) { xbt_assert(payload != nullptr, "You cannot send nullptr"); - put_init()->set_payload_size(simulated_size_in_bytes)->set_src_data(payload)->vetoable_start()->wait(); + put_init()->set_payload_size(simulated_size_in_bytes)->set_src_data(payload)->start()->wait(); } /** Blocking send with timeout */ @@ -117,7 +117,7 @@ void Mailbox::put(void* payload, uint64_t simulated_size_in_bytes, double timeou { xbt_assert(payload != nullptr, "You cannot send nullptr"); - put_init()->set_payload_size(simulated_size_in_bytes)->set_src_data(payload)->vetoable_start()->wait_for(timeout); + put_init()->set_payload_size(simulated_size_in_bytes)->set_src_data(payload)->start()->wait_for(timeout); } CommPtr Mailbox::get_init() diff --git a/teshsuite/s4u/dag-incomplete-simulation/dag-incomplete-simulation.cpp b/teshsuite/s4u/dag-incomplete-simulation/dag-incomplete-simulation.cpp index 1bd94aff8f..d81bce5219 100644 --- a/teshsuite/s4u/dag-incomplete-simulation/dag-incomplete-simulation.cpp +++ b/teshsuite/s4u/dag-incomplete-simulation/dag-incomplete-simulation.cpp @@ -25,11 +25,11 @@ int main(int argc, char** argv) auto host = e.host_by_name("cpu0"); /* creation of the tasks and their dependencies */ - simgrid::s4u::ExecPtr Init = simgrid::s4u::Exec::init()->set_name("Init")->set_flops_amount(0)->vetoable_start(); - simgrid::s4u::CommPtr A = simgrid::s4u::Comm::sendto_init()->set_name("A")->set_payload_size(1e9)->vetoable_start(); - simgrid::s4u::CommPtr B = simgrid::s4u::Comm::sendto_init()->set_name("B")->vetoable_start(); - simgrid::s4u::ExecPtr C = simgrid::s4u::Exec::init()->set_name("C")->vetoable_start(); - simgrid::s4u::CommPtr D = simgrid::s4u::Comm::sendto_init()->set_name("D")->set_payload_size(1e9)->vetoable_start(); + simgrid::s4u::ExecPtr Init = simgrid::s4u::Exec::init()->set_name("Init")->set_flops_amount(0)->start(); + simgrid::s4u::CommPtr A = simgrid::s4u::Comm::sendto_init()->set_name("A")->set_payload_size(1e9)->start(); + simgrid::s4u::CommPtr B = simgrid::s4u::Comm::sendto_init()->set_name("B")->start(); + simgrid::s4u::ExecPtr C = simgrid::s4u::Exec::init()->set_name("C")->start(); + simgrid::s4u::CommPtr D = simgrid::s4u::Comm::sendto_init()->set_name("D")->set_payload_size(1e9)->start(); std::vector activities = {Init, A, B, C, D}; Init->add_successor(A); diff --git a/teshsuite/s4u/dependencies/dependencies.cpp b/teshsuite/s4u/dependencies/dependencies.cpp index 9ac2c0b64b..b229d70e80 100644 --- a/teshsuite/s4u/dependencies/dependencies.cpp +++ b/teshsuite/s4u/dependencies/dependencies.cpp @@ -22,10 +22,10 @@ int main(int argc, char** argv) }); /* 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(); + simgrid::s4u::ExecPtr A = simgrid::s4u::Exec::init()->set_name("A")->start(); + simgrid::s4u::ExecPtr B = simgrid::s4u::Exec::init()->set_name("B")->start(); + simgrid::s4u::ExecPtr C = simgrid::s4u::Exec::init()->set_name("C")->start(); + simgrid::s4u::ExecPtr D = simgrid::s4u::Exec::init()->set_name("D")->start(); B->add_successor(A); C->add_successor(A);