From: Martin Quinson Date: Sun, 8 Apr 2018 20:32:26 +0000 (+0200) Subject: start snake_casing s4u::Actor X-Git-Tag: v3.20~500 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/4ff3a4cf6e03165421f65616a22be86b8f528e21 start snake_casing s4u::Actor --- diff --git a/examples/s4u/actor-create/s4u-actor-create.cpp b/examples/s4u/actor-create/s4u-actor-create.cpp index 8757433184..95f6ac66a5 100644 --- a/examples/s4u/actor-create/s4u-actor-create.cpp +++ b/examples/s4u/actor-create/s4u-actor-create.cpp @@ -98,14 +98,14 @@ int main(int argc, char** argv) * You can first directly start your actor, as follows. Note the last parameter: 'Sender()', * as if you would call the Sender function. */ - simgrid::s4u::Actor::createActor("sender1", simgrid::s4u::Host::by_name("Tremblay"), Sender()); + simgrid::s4u::Actor::create("sender1", simgrid::s4u::Host::by_name("Tremblay"), Sender()); /* The second way is to first register your function, and then retrieve it */ e.registerFunction("sender"); // The sender is passed as a template parameter here std::vector args; // Here we declare the parameter that the actor will get args.push_back("GloubiBoulga"); // Add a parameter to the set (we could have done it in the first approach too) - simgrid::s4u::Actor::createActor("sender2", simgrid::s4u::Host::by_name("Jupiter"), "sender", args); + simgrid::s4u::Actor::create("sender2", simgrid::s4u::Host::by_name("Jupiter"), "sender", args); /* The third way to start your actors is to use a deployment file. */ e.registerFunction("receiver"); // You first have to register the actor as with the second approach diff --git a/examples/s4u/actor-daemon/s4u-actor-daemon.cpp b/examples/s4u/actor-daemon/s4u-actor-daemon.cpp index 4c8d19ca20..9e83e959c5 100644 --- a/examples/s4u/actor-daemon/s4u-actor-daemon.cpp +++ b/examples/s4u/actor-daemon/s4u-actor-daemon.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2017-2018. 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. */ @@ -34,8 +34,8 @@ int main(int argc, char* argv[]) simgrid::s4u::Engine e(&argc, argv); e.loadPlatform(argv[1]); - simgrid::s4u::Actor::createActor("worker", simgrid::s4u::Host::by_name("Boivin"), worker); - simgrid::s4u::Actor::createActor("daemon", simgrid::s4u::Host::by_name("Tremblay"), my_daemon); + simgrid::s4u::Actor::create("worker", simgrid::s4u::Host::by_name("Boivin"), worker); + simgrid::s4u::Actor::create("daemon", simgrid::s4u::Host::by_name("Tremblay"), my_daemon); e.run(); return 0; diff --git a/examples/s4u/actor-join/s4u-actor-join.cpp b/examples/s4u/actor-join/s4u-actor-join.cpp index 843594f518..e91264c1cb 100644 --- a/examples/s4u/actor-join/s4u-actor-join.cpp +++ b/examples/s4u/actor-join/s4u-actor-join.cpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2017. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2017-2018. 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. */ @@ -20,22 +19,22 @@ static void master() simgrid::s4u::ActorPtr actor; XBT_INFO("Start sleeper"); - actor = simgrid::s4u::Actor::createActor("sleeper from master", simgrid::s4u::Host::current(), sleeper); + actor = simgrid::s4u::Actor::create("sleeper from master", simgrid::s4u::Host::current(), sleeper); XBT_INFO("Join the sleeper (timeout 2)"); actor->join(2); XBT_INFO("Start sleeper"); - actor = simgrid::s4u::Actor::createActor("sleeper from master", simgrid::s4u::Host::current(), sleeper); + actor = simgrid::s4u::Actor::create("sleeper from master", simgrid::s4u::Host::current(), sleeper); XBT_INFO("Join the sleeper (timeout 4)"); actor->join(4); XBT_INFO("Start sleeper"); - actor = simgrid::s4u::Actor::createActor("sleeper from master", simgrid::s4u::Host::current(), sleeper); + actor = simgrid::s4u::Actor::create("sleeper from master", simgrid::s4u::Host::current(), sleeper); XBT_INFO("Join the sleeper (timeout 2)"); actor->join(2); XBT_INFO("Start sleeper"); - actor = simgrid::s4u::Actor::createActor("sleeper from master", simgrid::s4u::Host::current(), sleeper); + actor = simgrid::s4u::Actor::create("sleeper from master", simgrid::s4u::Host::current(), sleeper); XBT_INFO("Waiting 4"); simgrid::s4u::this_actor::sleep_for(4); XBT_INFO("Join the sleeper after its end (timeout 1)"); @@ -55,7 +54,7 @@ int main(int argc, char* argv[]) e.loadPlatform(argv[1]); - simgrid::s4u::Actor::createActor("master", simgrid::s4u::Host::by_name("Tremblay"), master); + simgrid::s4u::Actor::create("master", simgrid::s4u::Host::by_name("Tremblay"), master); e.run(); diff --git a/examples/s4u/actor-kill/s4u-actor-kill.cpp b/examples/s4u/actor-kill/s4u-actor-kill.cpp index 51c90b62d0..d9767141f3 100644 --- a/examples/s4u/actor-kill/s4u-actor-kill.cpp +++ b/examples/s4u/actor-kill/s4u-actor-kill.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2017 The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2017-2018 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. */ @@ -33,9 +33,9 @@ static void killer() { XBT_INFO("Hello!"); /* - First start a victim process */ simgrid::s4u::ActorPtr victimA = - simgrid::s4u::Actor::createActor("victim A", simgrid::s4u::Host::by_name("Fafard"), victimA_fun); + simgrid::s4u::Actor::create("victim A", simgrid::s4u::Host::by_name("Fafard"), victimA_fun); simgrid::s4u::ActorPtr victimB = - simgrid::s4u::Actor::createActor("victim B", simgrid::s4u::Host::by_name("Jupiter"), victimB_fun); + simgrid::s4u::Actor::create("victim B", simgrid::s4u::Host::by_name("Jupiter"), victimB_fun); simgrid::s4u::this_actor::sleep_for(10); /* - Wait for 10 seconds */ XBT_INFO("Resume the victim A"); /* - Resume it from its suspended state */ @@ -43,7 +43,7 @@ static void killer() simgrid::s4u::this_actor::sleep_for(2); XBT_INFO("Kill the victim A"); /* - and then kill it */ - simgrid::s4u::Actor::kill(victimA->getPid()); // Kill by PID is legit + simgrid::s4u::Actor::kill(victimA->get_pid()); // Kill by PID is legit simgrid::s4u::this_actor::sleep_for(1); @@ -54,7 +54,7 @@ static void killer() XBT_INFO("Start a new actor, and kill it right away"); simgrid::s4u::ActorPtr victimC = - simgrid::s4u::Actor::createActor("victim C", simgrid::s4u::Host::by_name("Jupiter"), victimA_fun); + simgrid::s4u::Actor::create("victim C", simgrid::s4u::Host::by_name("Jupiter"), victimA_fun); victimC->kill(); simgrid::s4u::this_actor::sleep_for(1); @@ -75,7 +75,7 @@ int main(int argc, char* argv[]) e.loadPlatform(argv[1]); /* - Load the platform description */ /* - Create and deploy killer process, that will create the victim actors */ - simgrid::s4u::Actor::createActor("killer", simgrid::s4u::Host::by_name("Tremblay"), killer); + simgrid::s4u::Actor::create("killer", simgrid::s4u::Host::by_name("Tremblay"), killer); e.run(); /* - Run the simulation */ diff --git a/examples/s4u/actor-migration/s4u-actor-migration.cpp b/examples/s4u/actor-migration/s4u-actor-migration.cpp index caa9d5df13..983068383b 100644 --- a/examples/s4u/actor-migration/s4u-actor-migration.cpp +++ b/examples/s4u/actor-migration/s4u-actor-migration.cpp @@ -13,7 +13,7 @@ * Then another migration is done by the monitor while the worker is suspended. * * Note that worker() takes an uncommon set of parameters, - * and that this is perfectly accepted by createActor(). + * and that this is perfectly accepted by create(). */ #include @@ -45,7 +45,7 @@ static void monitor() simgrid::s4u::Host* jacquelin = simgrid::s4u::Host::by_name("Jacquelin"); simgrid::s4u::Host* fafard = simgrid::s4u::Host::by_name("Fafard"); - simgrid::s4u::ActorPtr actor = simgrid::s4u::Actor::createActor("worker", fafard, worker, boivin, jacquelin); + simgrid::s4u::ActorPtr actor = simgrid::s4u::Actor::create("worker", fafard, worker, boivin, jacquelin); simgrid::s4u::this_actor::sleep_for(5); @@ -64,7 +64,7 @@ int main(int argc, char* argv[]) xbt_assert(argc == 2, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]); e.loadPlatform(argv[1]); - simgrid::s4u::Actor::createActor("monitor", simgrid::s4u::Host::by_name("Boivin"), monitor); + simgrid::s4u::Actor::create("monitor", simgrid::s4u::Host::by_name("Boivin"), monitor); e.run(); return 0; diff --git a/examples/s4u/actor-suspend/s4u-actor-suspend.cpp b/examples/s4u/actor-suspend/s4u-actor-suspend.cpp index 60aa8efd91..e2b9c849e5 100644 --- a/examples/s4u/actor-suspend/s4u-actor-suspend.cpp +++ b/examples/s4u/actor-suspend/s4u-actor-suspend.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2017-2018. 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. */ @@ -32,7 +32,7 @@ static void lazy_guy() static void dream_master() { XBT_INFO("Let's create a lazy guy."); /* - Create a lazy_guy process */ - simgrid::s4u::ActorPtr lazy = simgrid::s4u::Actor::createActor("Lazy", simgrid::s4u::this_actor::getHost(), lazy_guy); + simgrid::s4u::ActorPtr lazy = simgrid::s4u::Actor::create("Lazy", simgrid::s4u::this_actor::getHost(), lazy_guy); XBT_INFO("Let's wait a little bit..."); simgrid::s4u::this_actor::sleep_for(10); /* - Wait for 10 seconds */ XBT_INFO("Let's wake the lazy guy up! >:) BOOOOOUUUHHH!!!!"); @@ -71,7 +71,7 @@ int main(int argc, char* argv[]) e.loadPlatform(argv[1]); /* - Load the platform description */ std::vector list = e.getAllHosts(); - simgrid::s4u::Actor::createActor("dream_master", list.front(), dream_master); + simgrid::s4u::Actor::create("dream_master", list.front(), dream_master); e.run(); /* - Run the simulation */ diff --git a/examples/s4u/app-chainsend/s4u-app-chainsend.cpp b/examples/s4u/app-chainsend/s4u-app-chainsend.cpp index 0ea2afdb19..e465c208f0 100644 --- a/examples/s4u/app-chainsend/s4u-app-chainsend.cpp +++ b/examples/s4u/app-chainsend/s4u-app-chainsend.cpp @@ -189,16 +189,16 @@ int main(int argc, char* argv[]) e.loadPlatform(argv[1]); - simgrid::s4u::Actor::createActor("broadcaster", simgrid::s4u::Host::by_name("node-0.acme.org"), broadcaster, 8, 256); - - simgrid::s4u::Actor::createActor("peer", simgrid::s4u::Host::by_name("node-1.acme.org"), peer); - simgrid::s4u::Actor::createActor("peer", simgrid::s4u::Host::by_name("node-2.acme.org"), peer); - simgrid::s4u::Actor::createActor("peer", simgrid::s4u::Host::by_name("node-3.acme.org"), peer); - simgrid::s4u::Actor::createActor("peer", simgrid::s4u::Host::by_name("node-4.acme.org"), peer); - simgrid::s4u::Actor::createActor("peer", simgrid::s4u::Host::by_name("node-5.acme.org"), peer); - simgrid::s4u::Actor::createActor("peer", simgrid::s4u::Host::by_name("node-6.acme.org"), peer); - simgrid::s4u::Actor::createActor("peer", simgrid::s4u::Host::by_name("node-7.acme.org"), peer); - simgrid::s4u::Actor::createActor("peer", simgrid::s4u::Host::by_name("node-8.acme.org"), peer); + simgrid::s4u::Actor::create("broadcaster", simgrid::s4u::Host::by_name("node-0.acme.org"), broadcaster, 8, 256); + + simgrid::s4u::Actor::create("peer", simgrid::s4u::Host::by_name("node-1.acme.org"), peer); + simgrid::s4u::Actor::create("peer", simgrid::s4u::Host::by_name("node-2.acme.org"), peer); + simgrid::s4u::Actor::create("peer", simgrid::s4u::Host::by_name("node-3.acme.org"), peer); + simgrid::s4u::Actor::create("peer", simgrid::s4u::Host::by_name("node-4.acme.org"), peer); + simgrid::s4u::Actor::create("peer", simgrid::s4u::Host::by_name("node-5.acme.org"), peer); + simgrid::s4u::Actor::create("peer", simgrid::s4u::Host::by_name("node-6.acme.org"), peer); + simgrid::s4u::Actor::create("peer", simgrid::s4u::Host::by_name("node-7.acme.org"), peer); + simgrid::s4u::Actor::create("peer", simgrid::s4u::Host::by_name("node-8.acme.org"), peer); e.run(); XBT_INFO("Total simulation time: %e", simgrid::s4u::Engine::getClock()); diff --git a/examples/s4u/app-pingpong/s4u-app-pingpong.cpp b/examples/s4u/app-pingpong/s4u-app-pingpong.cpp index 9d42450660..f208785615 100644 --- a/examples/s4u/app-pingpong/s4u-app-pingpong.cpp +++ b/examples/s4u/app-pingpong/s4u-app-pingpong.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-2018. 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. */ @@ -59,12 +59,12 @@ int main(int argc, char* argv[]) e.loadPlatform(argv[1]); std::vector args; args.push_back("Jupiter"); - simgrid::s4u::Actor::createActor("pinger", simgrid::s4u::Host::by_name("Tremblay"), pinger, args); + simgrid::s4u::Actor::create("pinger", simgrid::s4u::Host::by_name("Tremblay"), pinger, args); args.pop_back(); args.push_back("Tremblay"); - simgrid::s4u::Actor::createActor("ponger", simgrid::s4u::Host::by_name("Jupiter"), ponger, args); + simgrid::s4u::Actor::create("ponger", simgrid::s4u::Host::by_name("Jupiter"), ponger, args); e.run(); diff --git a/examples/s4u/app-token-ring/s4u-app-token-ring.cpp b/examples/s4u/app-token-ring/s4u-app-token-ring.cpp index d27e25f635..fec72b7ccc 100644 --- a/examples/s4u/app-token-ring/s4u-app-token-ring.cpp +++ b/examples/s4u/app-token-ring/s4u-app-token-ring.cpp @@ -63,7 +63,7 @@ int main(int argc, char** argv) std::vector list = e.getAllHosts(); for (auto const& host : list) { /* - Give a unique rank to each host and create a @ref relay_runner process on each */ - simgrid::s4u::Actor::createActor((std::to_string(id)).c_str(), host, RelayRunner()); + simgrid::s4u::Actor::create((std::to_string(id)).c_str(), host, RelayRunner()); id++; } e.run(); diff --git a/examples/s4u/cloud-capping/s4u-cloud-capping.cpp b/examples/s4u/cloud-capping/s4u-cloud-capping.cpp index 93fbad8d45..7674ad2a61 100644 --- a/examples/s4u/cloud-capping/s4u-cloud-capping.cpp +++ b/examples/s4u/cloud-capping/s4u-cloud-capping.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-2018. 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. */ @@ -62,8 +62,8 @@ static void test_dynamic_change() vm0->start(); vm1->start(); - simgrid::s4u::Actor::createActor("worker0", vm0, worker_busy_loop, "Task0", -1); - simgrid::s4u::Actor::createActor("worker1", vm1, worker_busy_loop, "Task1", pm0->getSpeed()); + simgrid::s4u::Actor::create("worker0", vm0, worker_busy_loop, "Task0", -1); + simgrid::s4u::Actor::create("worker1", vm1, worker_busy_loop, "Task1", pm0->getSpeed()); simgrid::s4u::this_actor::sleep_for(3000); // let the tasks end vm0->destroy(); @@ -78,27 +78,27 @@ static void test_one_task(simgrid::s4u::Host* host) XBT_INFO("### Test: with/without MSG_task_set_bound"); XBT_INFO("### Test: no bound for Task1@%s", host->get_cname()); - simgrid::s4u::Actor::createActor("worker0", host, worker, computation_amount, false, 0); + simgrid::s4u::Actor::create("worker0", host, worker, computation_amount, false, 0); simgrid::s4u::this_actor::sleep_for(1000); XBT_INFO("### Test: 50%% for Task1@%s", host->get_cname()); - simgrid::s4u::Actor::createActor("worker0", host, worker, computation_amount, true, cpu_speed / 2); + simgrid::s4u::Actor::create("worker0", host, worker, computation_amount, true, cpu_speed / 2); simgrid::s4u::this_actor::sleep_for(1000); XBT_INFO("### Test: 33%% for Task1@%s", host->get_cname()); - simgrid::s4u::Actor::createActor("worker0", host, worker, computation_amount, true, cpu_speed / 3); + simgrid::s4u::Actor::create("worker0", host, worker, computation_amount, true, cpu_speed / 3); simgrid::s4u::this_actor::sleep_for(1000); XBT_INFO("### Test: zero for Task1@%s (i.e., unlimited)", host->get_cname()); - simgrid::s4u::Actor::createActor("worker0", host, worker, computation_amount, true, 0); + simgrid::s4u::Actor::create("worker0", host, worker, computation_amount, true, 0); simgrid::s4u::this_actor::sleep_for(1000); XBT_INFO("### Test: 200%% for Task1@%s (i.e., meaningless)", host->get_cname()); - simgrid::s4u::Actor::createActor("worker0", host, worker, computation_amount, true, cpu_speed * 2); + simgrid::s4u::Actor::create("worker0", host, worker, computation_amount, true, cpu_speed * 2); simgrid::s4u::this_actor::sleep_for(1000); } @@ -112,44 +112,44 @@ static void test_two_tasks(simgrid::s4u::Host* hostA, simgrid::s4u::Host* hostB) const char* hostB_name = hostB->get_cname(); XBT_INFO("### Test: no bound for Task1@%s, no bound for Task2@%s", hostA_name, hostB_name); - simgrid::s4u::Actor::createActor("worker0", hostA, worker, computation_amount, false, 0); - simgrid::s4u::Actor::createActor("worker1", hostB, worker, computation_amount, false, 0); + simgrid::s4u::Actor::create("worker0", hostA, worker, computation_amount, false, 0); + simgrid::s4u::Actor::create("worker1", hostB, worker, computation_amount, false, 0); simgrid::s4u::this_actor::sleep_for(1000); XBT_INFO("### Test: 0 for Task1@%s, 0 for Task2@%s (i.e., unlimited)", hostA_name, hostB_name); - simgrid::s4u::Actor::createActor("worker0", hostA, worker, computation_amount, true, 0); - simgrid::s4u::Actor::createActor("worker1", hostB, worker, computation_amount, true, 0); + simgrid::s4u::Actor::create("worker0", hostA, worker, computation_amount, true, 0); + simgrid::s4u::Actor::create("worker1", hostB, worker, computation_amount, true, 0); simgrid::s4u::this_actor::sleep_for(1000); XBT_INFO("### Test: 50%% for Task1@%s, 50%% for Task2@%s", hostA_name, hostB_name); - simgrid::s4u::Actor::createActor("worker0", hostA, worker, computation_amount, true, cpu_speed / 2); - simgrid::s4u::Actor::createActor("worker1", hostB, worker, computation_amount, true, cpu_speed / 2); + simgrid::s4u::Actor::create("worker0", hostA, worker, computation_amount, true, cpu_speed / 2); + simgrid::s4u::Actor::create("worker1", hostB, worker, computation_amount, true, cpu_speed / 2); simgrid::s4u::this_actor::sleep_for(1000); XBT_INFO("### Test: 25%% for Task1@%s, 25%% for Task2@%s", hostA_name, hostB_name); - simgrid::s4u::Actor::createActor("worker0", hostA, worker, computation_amount, true, cpu_speed / 4); - simgrid::s4u::Actor::createActor("worker1", hostB, worker, computation_amount, true, cpu_speed / 4); + simgrid::s4u::Actor::create("worker0", hostA, worker, computation_amount, true, cpu_speed / 4); + simgrid::s4u::Actor::create("worker1", hostB, worker, computation_amount, true, cpu_speed / 4); simgrid::s4u::this_actor::sleep_for(1000); XBT_INFO("### Test: 75%% for Task1@%s, 100%% for Task2@%s", hostA_name, hostB_name); - simgrid::s4u::Actor::createActor("worker0", hostA, worker, computation_amount, true, cpu_speed * 0.75); - simgrid::s4u::Actor::createActor("worker1", hostB, worker, computation_amount, true, cpu_speed); + simgrid::s4u::Actor::create("worker0", hostA, worker, computation_amount, true, cpu_speed * 0.75); + simgrid::s4u::Actor::create("worker1", hostB, worker, computation_amount, true, cpu_speed); simgrid::s4u::this_actor::sleep_for(1000); XBT_INFO("### Test: no bound for Task1@%s, 25%% for Task2@%s", hostA_name, hostB_name); - simgrid::s4u::Actor::createActor("worker0", hostA, worker, computation_amount, false, 0); - simgrid::s4u::Actor::createActor("worker1", hostB, worker, computation_amount, true, cpu_speed / 4); + simgrid::s4u::Actor::create("worker0", hostA, worker, computation_amount, false, 0); + simgrid::s4u::Actor::create("worker1", hostB, worker, computation_amount, true, cpu_speed / 4); simgrid::s4u::this_actor::sleep_for(1000); XBT_INFO("### Test: 75%% for Task1@%s, 25%% for Task2@%s", hostA_name, hostB_name); - simgrid::s4u::Actor::createActor("worker0", hostA, worker, computation_amount, true, cpu_speed * 0.75); - simgrid::s4u::Actor::createActor("worker1", hostB, worker, computation_amount, true, cpu_speed / 4); + simgrid::s4u::Actor::create("worker0", hostA, worker, computation_amount, true, cpu_speed * 0.75); + simgrid::s4u::Actor::create("worker1", hostB, worker, computation_amount, true, cpu_speed / 4); simgrid::s4u::this_actor::sleep_for(1000); } @@ -216,13 +216,13 @@ static void master_main() const double computation_amount = cpu_speed * 10; XBT_INFO("# 10. (a) Put a task on a VM without any bound."); - simgrid::s4u::Actor::createActor("worker0", vm0, worker, computation_amount, false, 0); + simgrid::s4u::Actor::create("worker0", vm0, worker, computation_amount, false, 0); simgrid::s4u::this_actor::sleep_for(1000); XBT_INFO(" "); XBT_INFO("# 10. (b) set 10%% bound to the VM, and then put a task on the VM."); vm0->setBound(cpu_speed / 10); - simgrid::s4u::Actor::createActor("worker0", vm0, worker, computation_amount, false, 0); + simgrid::s4u::Actor::create("worker0", vm0, worker, computation_amount, false, 0); simgrid::s4u::this_actor::sleep_for(1000); XBT_INFO(" "); @@ -232,7 +232,7 @@ static void master_main() XBT_INFO(" "); XBT_INFO("# 10. (d) Put a task again on the VM."); - simgrid::s4u::Actor::createActor("worker0", vm0, worker, computation_amount, false, 0); + simgrid::s4u::Actor::create("worker0", vm0, worker, computation_amount, false, 0); simgrid::s4u::this_actor::sleep_for(1000); XBT_INFO(" "); @@ -251,7 +251,7 @@ int main(int argc, char* argv[]) e.loadPlatform(argv[1]); - simgrid::s4u::Actor::createActor("master_", simgrid::s4u::Host::by_name("Fafard"), master_main); + simgrid::s4u::Actor::create("master_", simgrid::s4u::Host::by_name("Fafard"), master_main); e.run(); XBT_INFO("Bye (simulation time %g)", simgrid::s4u::Engine::getClock()); diff --git a/examples/s4u/cloud-migration/s4u-cloud-migration.cpp b/examples/s4u/cloud-migration/s4u-cloud-migration.cpp index 2471b44cc6..51e747b188 100644 --- a/examples/s4u/cloud-migration/s4u-cloud-migration.cpp +++ b/examples/s4u/cloud-migration/s4u-cloud-migration.cpp @@ -21,7 +21,7 @@ static void vm_migrate(simgrid::s4u::VirtualMachine* vm, simgrid::s4u::Host* dst static void vm_migrate_async(simgrid::s4u::VirtualMachine* vm, simgrid::s4u::Host* dst_pm) { - simgrid::s4u::Actor::createActor("mig_wrk", simgrid::s4u::Host::current(), vm_migrate, vm, dst_pm); + simgrid::s4u::Actor::create("mig_wrk", simgrid::s4u::Host::current(), vm_migrate, vm, dst_pm); } static void master_main() @@ -90,7 +90,7 @@ int main(int argc, char* argv[]) /* load the platform file */ e.loadPlatform(argv[1]); - simgrid::s4u::Actor::createActor("master_", simgrid::s4u::Host::by_name("Fafard"), master_main); + simgrid::s4u::Actor::create("master_", simgrid::s4u::Host::by_name("Fafard"), master_main); e.run(); diff --git a/examples/s4u/cloud-simple/s4u-cloud-simple.cpp b/examples/s4u/cloud-simple/s4u-cloud-simple.cpp index b1fb9508dd..1e3bc4190a 100644 --- a/examples/s4u/cloud-simple/s4u-cloud-simple.cpp +++ b/examples/s4u/cloud-simple/s4u-cloud-simple.cpp @@ -21,7 +21,7 @@ static void computation_fun() static void launch_computation_worker(s4u_Host* host) { - simgrid::s4u::Actor::createActor("compute", host, computation_fun); + simgrid::s4u::Actor::create("compute", host, computation_fun); } struct s_payload { @@ -62,9 +62,9 @@ static void launch_communication_worker(s4u_Host* tx_host, s4u_Host* rx_host) std::vector args; args.push_back(mbox_name); - simgrid::s4u::Actor::createActor("comm_tx", tx_host, communication_tx_fun, args); + simgrid::s4u::Actor::create("comm_tx", tx_host, communication_tx_fun, args); - simgrid::s4u::Actor::createActor("comm_rx", rx_host, communication_rx_fun, args); + simgrid::s4u::Actor::create("comm_rx", rx_host, communication_rx_fun, args); } static void master_main() @@ -212,7 +212,7 @@ int main(int argc, char* argv[]) sg_vm_live_migration_plugin_init(); e.loadPlatform(argv[1]); /* - Load the platform description */ - simgrid::s4u::Actor::createActor("master_", simgrid::s4u::Host::by_name("Fafard"), master_main); + simgrid::s4u::Actor::create("master_", simgrid::s4u::Host::by_name("Fafard"), master_main); e.run(); diff --git a/examples/s4u/energy-boot/s4u-energy-boot.cpp b/examples/s4u/energy-boot/s4u-energy-boot.cpp index 22c47af165..607862c4c7 100644 --- a/examples/s4u/energy-boot/s4u-energy-boot.cpp +++ b/examples/s4u/energy-boot/s4u-energy-boot.cpp @@ -105,7 +105,7 @@ int main(int argc, char* argv[]) xbt_assert(argc == 2, "Usage: %s platform_file\n\tExample: %s platform.xml\n", argv[0], argv[0]); e.loadPlatform(argv[1]); - simgrid::s4u::Actor::createActor("Boot Monitor", simgrid::s4u::Host::by_name("MyHost2"), monitor); + simgrid::s4u::Actor::create("Boot Monitor", simgrid::s4u::Host::by_name("MyHost2"), monitor); e.run(); diff --git a/examples/s4u/energy-exec/s4u-energy-exec.cpp b/examples/s4u/energy-exec/s4u-energy-exec.cpp index 981e2c7d60..b91d7ec07a 100644 --- a/examples/s4u/energy-exec/s4u-energy-exec.cpp +++ b/examples/s4u/energy-exec/s4u-energy-exec.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-2018. 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. */ @@ -71,7 +71,7 @@ int main(int argc, char* argv[]) xbt_assert(argc == 2, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]); e.loadPlatform(argv[1]); - simgrid::s4u::Actor::createActor("dvfs_test", simgrid::s4u::Host::by_name("MyHost1"), dvfs); + simgrid::s4u::Actor::create("dvfs_test", simgrid::s4u::Host::by_name("MyHost1"), dvfs); e.run(); diff --git a/examples/s4u/energy-link/s4u-energy-link.cpp b/examples/s4u/energy-link/s4u-energy-link.cpp index 37af2797fc..2ebdf30155 100644 --- a/examples/s4u/energy-link/s4u-energy-link.cpp +++ b/examples/s4u/energy-link/s4u-energy-link.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2017-2018. 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. */ @@ -109,8 +109,8 @@ int main(int argc, char* argv[]) } else { // No parameter at all? Then use the default value argSender.push_back("25000"); } - simgrid::s4u::Actor::createActor("sender", simgrid::s4u::Host::by_name("MyHost1"), sender, argSender); - simgrid::s4u::Actor::createActor("receiver", simgrid::s4u::Host::by_name("MyHost2"), receiver, argReceiver); + simgrid::s4u::Actor::create("sender", simgrid::s4u::Host::by_name("MyHost1"), sender, argSender); + simgrid::s4u::Actor::create("receiver", simgrid::s4u::Host::by_name("MyHost2"), receiver, argReceiver); /* And now, launch the simulation */ e.run(); diff --git a/examples/s4u/energy-vm/s4u-energy-vm.cpp b/examples/s4u/energy-vm/s4u-energy-vm.cpp index 54d5c97e22..6add343a4a 100644 --- a/examples/s4u/energy-vm/s4u-energy-vm.cpp +++ b/examples/s4u/energy-vm/s4u-energy-vm.cpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2007-2010, 2013-2015, 2017. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2007-2018. 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. */ @@ -30,16 +29,16 @@ static void dvfs() vm_host2->start(); XBT_INFO("Create two tasks on Host1: both inside a VM"); - simgrid::s4u::Actor::createActor("p11", vm_host1, executor); - simgrid::s4u::Actor::createActor("p12", vm_host1, executor); + simgrid::s4u::Actor::create("p11", vm_host1, executor); + simgrid::s4u::Actor::create("p12", vm_host1, executor); XBT_INFO("Create two tasks on Host2: one inside a VM, the other directly on the host"); - simgrid::s4u::Actor::createActor("p21", vm_host2, executor); - simgrid::s4u::Actor::createActor("p22", host2, executor); + simgrid::s4u::Actor::create("p21", vm_host2, executor); + simgrid::s4u::Actor::create("p22", host2, executor); XBT_INFO("Create two tasks on Host3: both directly on the host"); - simgrid::s4u::Actor::createActor("p31", host3, executor); - simgrid::s4u::Actor::createActor("p32", host3, executor); + simgrid::s4u::Actor::create("p31", host3, executor); + simgrid::s4u::Actor::create("p32", host3, executor); XBT_INFO("Wait 5 seconds. The tasks are still running (they run for 3 seconds, but 2 tasks are co-located, " "so they run for 6 seconds)"); @@ -60,7 +59,7 @@ int main(int argc, char* argv[]) e.loadPlatform(argv[1]); - simgrid::s4u::Actor::createActor("dvfs", simgrid::s4u::Host::by_name("MyHost1"), dvfs); + simgrid::s4u::Actor::create("dvfs", simgrid::s4u::Host::by_name("MyHost1"), dvfs); e.run(); diff --git a/examples/s4u/exec-async/s4u-exec-async.cpp b/examples/s4u/exec-async/s4u-exec-async.cpp index 1b75fc98f8..2b6c83725c 100644 --- a/examples/s4u/exec-async/s4u-exec-async.cpp +++ b/examples/s4u/exec-async/s4u-exec-async.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-2018. 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. */ @@ -24,8 +24,8 @@ int main(int argc, char* argv[]) { simgrid::s4u::Engine e(&argc, argv); e.loadPlatform(argv[1]); - simgrid::s4u::Actor::createActor("test", simgrid::s4u::Host::by_name("Fafard"), test, 7.6296e+07, 1.0); - simgrid::s4u::Actor::createActor("test", simgrid::s4u::Host::by_name("Fafard"), test, 7.6296e+07, 2.0); + simgrid::s4u::Actor::create("test", simgrid::s4u::Host::by_name("Fafard"), test, 7.6296e+07, 1.0); + simgrid::s4u::Actor::create("test", simgrid::s4u::Host::by_name("Fafard"), test, 7.6296e+07, 2.0); e.run(); diff --git a/examples/s4u/exec-basic/s4u-exec-basic.cpp b/examples/s4u/exec-basic/s4u-exec-basic.cpp index e69d444ab4..8a9683c420 100644 --- a/examples/s4u/exec-basic/s4u-exec-basic.cpp +++ b/examples/s4u/exec-basic/s4u-exec-basic.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2010-2018. 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. */ @@ -45,8 +45,8 @@ int main(int argc, char* argv[]) e.loadPlatform(argv[1]); - simgrid::s4u::Actor::createActor("executor", simgrid::s4u::Host::by_name("Tremblay"), executor, args); - simgrid::s4u::Actor::createActor("privileged", simgrid::s4u::Host::by_name("Tremblay"), privileged, args); + simgrid::s4u::Actor::create("executor", simgrid::s4u::Host::by_name("Tremblay"), executor, args); + simgrid::s4u::Actor::create("privileged", simgrid::s4u::Host::by_name("Tremblay"), privileged, args); e.run(); diff --git a/examples/s4u/exec-dvfs/s4u-exec-dvfs.cpp b/examples/s4u/exec-dvfs/s4u-exec-dvfs.cpp index 0f844e8135..7fdadea58e 100644 --- a/examples/s4u/exec-dvfs/s4u-exec-dvfs.cpp +++ b/examples/s4u/exec-dvfs/s4u-exec-dvfs.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-2018. 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. */ @@ -54,8 +54,8 @@ int main(int argc, char* argv[]) e.loadPlatform(argv[1]); - simgrid::s4u::Actor::createActor("dvfs_test", simgrid::s4u::Host::by_name("MyHost1"), dvfs); - simgrid::s4u::Actor::createActor("dvfs_test", simgrid::s4u::Host::by_name("MyHost2"), dvfs); + simgrid::s4u::Actor::create("dvfs_test", simgrid::s4u::Host::by_name("MyHost1"), dvfs); + simgrid::s4u::Actor::create("dvfs_test", simgrid::s4u::Host::by_name("MyHost2"), dvfs); e.run(); diff --git a/examples/s4u/exec-monitor/s4u-exec-monitor.cpp b/examples/s4u/exec-monitor/s4u-exec-monitor.cpp index 17428abf1b..be0022bd54 100644 --- a/examples/s4u/exec-monitor/s4u-exec-monitor.cpp +++ b/examples/s4u/exec-monitor/s4u-exec-monitor.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2017-2018. 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. */ @@ -24,15 +24,15 @@ static void executor() { XBT_INFO("Create one monitored task, and wait for it"); simgrid::s4u::ExecPtr activity = simgrid::s4u::this_actor::exec_async(1e9); - simgrid::s4u::Actor::createActor("monitor 1", simgrid::s4u::Host::by_name("Tremblay"), monitor, activity); + simgrid::s4u::Actor::create("monitor 1", simgrid::s4u::Host::by_name("Tremblay"), monitor, activity); activity->wait(); // This blocks until the activity is over XBT_INFO("The monitored task is over. Let's start 3 of them now."); - simgrid::s4u::Actor::createActor("monitor 2", simgrid::s4u::Host::by_name("Jupiter"), monitor, - simgrid::s4u::this_actor::exec_async(1e9)); - simgrid::s4u::Actor::createActor("monitor 3", simgrid::s4u::Host::by_name("Ginette"), monitor, - simgrid::s4u::this_actor::exec_async(1e9)); - simgrid::s4u::Actor::createActor("monitor 4", simgrid::s4u::Host::by_name("Bourassa"), monitor, - simgrid::s4u::this_actor::exec_async(1e9)); + simgrid::s4u::Actor::create("monitor 2", simgrid::s4u::Host::by_name("Jupiter"), monitor, + simgrid::s4u::this_actor::exec_async(1e9)); + simgrid::s4u::Actor::create("monitor 3", simgrid::s4u::Host::by_name("Ginette"), monitor, + simgrid::s4u::this_actor::exec_async(1e9)); + simgrid::s4u::Actor::create("monitor 4", simgrid::s4u::Host::by_name("Bourassa"), monitor, + simgrid::s4u::this_actor::exec_async(1e9)); XBT_INFO("All activities are started; finish now"); // Waiting execution activities is not mandatory: they go to completion once started @@ -44,7 +44,7 @@ int main(int argc, char* argv[]) simgrid::s4u::Engine e(&argc, argv); e.loadPlatform(argv[1]); - simgrid::s4u::Actor::createActor("executor", simgrid::s4u::Host::by_name("Fafard"), executor); + simgrid::s4u::Actor::create("executor", simgrid::s4u::Host::by_name("Fafard"), executor); e.run(); diff --git a/examples/s4u/exec-ptask/s4u-exec-ptask.cpp b/examples/s4u/exec-ptask/s4u-exec-ptask.cpp index a09f342fb9..4da47fe0dd 100644 --- a/examples/s4u/exec-ptask/s4u-exec-ptask.cpp +++ b/examples/s4u/exec-ptask/s4u-exec-ptask.cpp @@ -98,7 +98,7 @@ int main(int argc, char* argv[]) e.loadPlatform(argv[1]); /* Pick a process, no matter which, from the platform file */ - simgrid::s4u::Actor::createActor("test", simgrid::s4u::Host::by_name("MyHost1"), runner); + simgrid::s4u::Actor::create("test", simgrid::s4u::Host::by_name("MyHost1"), runner); e.run(); XBT_INFO("Simulation done."); diff --git a/examples/s4u/exec-remote/s4u-exec-remote.cpp b/examples/s4u/exec-remote/s4u-exec-remote.cpp index 8e147951be..1cb60a8fce 100644 --- a/examples/s4u/exec-remote/s4u-exec-remote.cpp +++ b/examples/s4u/exec-remote/s4u-exec-remote.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-2018. 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. */ @@ -50,7 +50,7 @@ int main(int argc, char* argv[]) { simgrid::s4u::Engine e(&argc, argv); e.loadPlatform(argv[1]); - simgrid::s4u::Actor::createActor("test", simgrid::s4u::Host::by_name("Fafard"), wizard); + simgrid::s4u::Actor::create("test", simgrid::s4u::Host::by_name("Fafard"), wizard); e.run(); diff --git a/examples/s4u/io-file-system/s4u-io-file-system.cpp b/examples/s4u/io-file-system/s4u-io-file-system.cpp index 52311394eb..2e33319f0c 100644 --- a/examples/s4u/io-file-system/s4u-io-file-system.cpp +++ b/examples/s4u/io-file-system/s4u-io-file-system.cpp @@ -95,7 +95,7 @@ int main(int argc, char** argv) simgrid::s4u::Engine e(&argc, argv); sg_storage_file_system_init(); e.loadPlatform(argv[1]); - simgrid::s4u::Actor::createActor("host", simgrid::s4u::Host::by_name("denise"), MyHost()); + simgrid::s4u::Actor::create("host", simgrid::s4u::Host::by_name("denise"), MyHost()); e.run(); return 0; diff --git a/examples/s4u/io-storage-raw/s4u-io-storage-raw.cpp b/examples/s4u/io-storage-raw/s4u-io-storage-raw.cpp index 17bf750a9b..caf074f966 100644 --- a/examples/s4u/io-storage-raw/s4u-io-storage-raw.cpp +++ b/examples/s4u/io-storage-raw/s4u-io-storage-raw.cpp @@ -49,7 +49,7 @@ int main(int argc, char** argv) simgrid::s4u::Engine e(&argc, argv); e.loadPlatform(argv[1]); - simgrid::s4u::Actor::createActor("", simgrid::s4u::Host::by_name("denise"), host); + simgrid::s4u::Actor::create("", simgrid::s4u::Host::by_name("denise"), host); e.run(); XBT_INFO("Simulated time: %g", simgrid::s4u::Engine::getClock()); diff --git a/examples/s4u/mutex/s4u-mutex.cpp b/examples/s4u/mutex/s4u-mutex.cpp index b1e352334f..10b9120c6a 100644 --- a/examples/s4u/mutex/s4u-mutex.cpp +++ b/examples/s4u/mutex/s4u-mutex.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2006-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2006-2018. 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. */ @@ -49,9 +49,10 @@ static void master() for (int i = 0; i < NB_ACTOR * 2 ; i++) { // To create a worker use the static method simgrid::s4u::Actor. if((i % 2) == 0 ) - simgrid::s4u::Actor::createActor("worker", simgrid::s4u::Host::by_name("Jupiter"), workerLockGuard, mutex, std::ref(result)); + simgrid::s4u::Actor::create("worker", simgrid::s4u::Host::by_name("Jupiter"), workerLockGuard, mutex, + std::ref(result)); else - simgrid::s4u::Actor::createActor("worker", simgrid::s4u::Host::by_name("Tremblay"), worker, mutex, std::ref(result)); + simgrid::s4u::Actor::create("worker", simgrid::s4u::Host::by_name("Tremblay"), worker, mutex, std::ref(result)); } simgrid::s4u::this_actor::sleep_for(10); @@ -62,7 +63,7 @@ int main(int argc, char **argv) { simgrid::s4u::Engine e(&argc, argv); e.loadPlatform("../../platforms/two_hosts.xml"); - simgrid::s4u::Actor::createActor("main", simgrid::s4u::Host::by_name("Tremblay"), master); + simgrid::s4u::Actor::create("main", simgrid::s4u::Host::by_name("Tremblay"), master); e.run(); return 0; diff --git a/examples/s4u/plugin-hostload/s4u-plugin-hostload.cpp b/examples/s4u/plugin-hostload/s4u-plugin-hostload.cpp index e043adf26e..7a5087a8dd 100644 --- a/examples/s4u/plugin-hostload/s4u-plugin-hostload.cpp +++ b/examples/s4u/plugin-hostload/s4u-plugin-hostload.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-2018. 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. */ @@ -85,8 +85,8 @@ int main(int argc, char* argv[]) xbt_assert(argc == 2, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]); e.loadPlatform(argv[1]); - simgrid::s4u::Actor::createActor("load_test", simgrid::s4u::Host::by_name("MyHost1"), execute_load_test); - simgrid::s4u::Actor::createActor("change_speed", simgrid::s4u::Host::by_name("MyHost1"), change_speed); + simgrid::s4u::Actor::create("load_test", simgrid::s4u::Host::by_name("MyHost1"), execute_load_test); + simgrid::s4u::Actor::create("change_speed", simgrid::s4u::Host::by_name("MyHost1"), change_speed); e.run(); diff --git a/include/simgrid/s4u/Actor.hpp b/include/simgrid/s4u/Actor.hpp index efdc1bd822..87e2f596b6 100644 --- a/include/simgrid/s4u/Actor.hpp +++ b/include/simgrid/s4u/Actor.hpp @@ -163,20 +163,20 @@ public: static ActorPtr self(); /** Signal to others that a new actor has been created **/ - static simgrid::xbt::signal onCreation; + static simgrid::xbt::signal on_creation; /** Signal indicating that the given actor is about to disappear */ - static simgrid::xbt::signal onDestruction; + static simgrid::xbt::signal on_destruction; /** Create an actor using a function * * If the actor is restarted, the actor has a fresh copy of the function. */ - static ActorPtr createActor(const char* name, s4u::Host* host, std::function code); + static ActorPtr create(const char* name, s4u::Host* host, std::function code); - static ActorPtr createActor(const char* name, s4u::Host* host, std::function*)> code, - std::vector* args) + static ActorPtr create(const char* name, s4u::Host* host, std::function*)> code, + std::vector* args) { - return createActor(name, host, [code](std::vector* args) { code(args); }, args); + return create(name, host, [code](std::vector* args) { code(args); }, args); } /** Create an actor using code @@ -186,46 +186,38 @@ public: * state. In order to use auto-restart, an explicit `function` must be passed * instead. */ - template::type - > - static ActorPtr createActor(const char* name, s4u::Host *host, F code, Args... args) + template ::type> + static ActorPtr create(const char* name, s4u::Host* host, F code, Args... args) { - return createActor(name, host, wrap_task(std::move(code), std::move(args)...)); + return create(name, host, wrap_task(std::move(code), std::move(args)...)); } // Create actor from function name: - - static ActorPtr createActor(const char* name, s4u::Host* host, const char* function, std::vector args); + static ActorPtr create(const char* name, s4u::Host* host, const char* function, std::vector args); // ***** Methods ***** /** This actor will be automatically terminated when the last non-daemon actor finishes **/ void daemonize(); /** Returns whether or not this actor has been daemonized or not **/ - bool isDaemon(); - - XBT_ATTRIB_DEPRECATED_v323("Please use Actor::get_name()") const simgrid::xbt::string& getName() const - { - return get_name(); - } - XBT_ATTRIB_DEPRECATED_v323("Please use Actor::get_cname()") const char* getCname() const { return get_cname(); } + bool is_daemon() const; /** Retrieves the name of that actor as a C++ string */ const simgrid::xbt::string& get_name() const; /** Retrieves the name of that actor as a C string */ const char* get_cname() const; /** Retrieves the host on which that actor is running */ - s4u::Host* getHost(); + s4u::Host* get_host(); /** Retrieves the PID of that actor * * aid_t is an alias for long */ - aid_t getPid(); + aid_t get_pid(); /** Retrieves the PPID of that actor * * aid_t is an alias for long */ - aid_t getPpid(); + aid_t get_ppid(); /** Suspend an actor by suspending the task on which it was waiting for the completion. */ void suspend(); @@ -289,6 +281,38 @@ public: const char* getProperty(const char* key); void setProperty(const char* key, const char* value); Actor* restart(); + + XBT_ATTRIB_DEPRECATED_v323("Please use Actor::create()") static ActorPtr + createActor(const char* name, s4u::Host* host, std::function code) + { + return create(name, host, code); + } + XBT_ATTRIB_DEPRECATED_v323("Please use Actor::create()") static ActorPtr + createActor(const char* name, s4u::Host* host, std::function*)> code, + std::vector* args) + { + return create(name, host, code, args); + } + template ::type> + XBT_ATTRIB_DEPRECATED_v323("Please use Actor::create()") static ActorPtr + createActor(const char* name, s4u::Host* host, F code, Args... args) + { + return create(name, host, code, std::move(args)...); + } + XBT_ATTRIB_DEPRECATED_v323("Please use Actor::create()") static ActorPtr + createActor(const char* name, s4u::Host* host, const char* function, std::vector args) + { + return create(name, host, function, args); + } + XBT_ATTRIB_DEPRECATED_v323("Please use Actor::is_daemon()") bool isDaemon() const; + XBT_ATTRIB_DEPRECATED_v323("Please use Actor::get_name()") const simgrid::xbt::string& getName() const + { + return get_name(); + } + XBT_ATTRIB_DEPRECATED_v323("Please use Actor::get_cname()") const char* getCname() const { return get_cname(); } + XBT_ATTRIB_DEPRECATED_v323("Please use Actor::get_host()") Host* getHost() { return get_host(); } + XBT_ATTRIB_DEPRECATED_v323("Please use Actor::get_pid()") aid_t getPid() { return get_pid(); } + XBT_ATTRIB_DEPRECATED_v323("Please use Actor::get_ppid()") aid_t getPpid() { return get_ppid(); } }; /** @ingroup s4u_api diff --git a/src/msg/instr_msg_process.cpp b/src/msg/instr_msg_process.cpp index 0e235a7976..1631086dbb 100644 --- a/src/msg/instr_msg_process.cpp +++ b/src/msg/instr_msg_process.cpp @@ -12,7 +12,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_msg_process, instr, "MSG process"); std::string instr_pid(msg_process_t proc) { - return std::string(proc->get_cname()) + "-" + std::to_string(proc->getPid()); + return std::string(proc->get_cname()) + "-" + std::to_string(proc->get_pid()); } void TRACE_msg_process_kill(smx_process_exit_status_t status, msg_process_t process) diff --git a/src/plugins/vm/VmLiveMigration.cpp b/src/plugins/vm/VmLiveMigration.cpp index ba14579fbc..f06a6d4801 100644 --- a/src/plugins/vm/VmLiveMigration.cpp +++ b/src/plugins/vm/VmLiveMigration.cpp @@ -351,9 +351,9 @@ void sg_vm_migrate(simgrid::s4u::VirtualMachine* vm, simgrid::s4u::Host* dst_pm) std::string("__pr_mig_tx:") + vm->get_cname() + "(" + src_pm->get_cname() + "-" + dst_pm->get_cname() + ")"; simgrid::s4u::ActorPtr rx = - simgrid::s4u::Actor::createActor(rx_name.c_str(), dst_pm, simgrid::vm::MigrationRx(vm, dst_pm)); + simgrid::s4u::Actor::create(rx_name.c_str(), dst_pm, simgrid::vm::MigrationRx(vm, dst_pm)); simgrid::s4u::ActorPtr tx = - simgrid::s4u::Actor::createActor(tx_name.c_str(), src_pm, simgrid::vm::MigrationTx(vm, dst_pm)); + simgrid::s4u::Actor::create(tx_name.c_str(), src_pm, simgrid::vm::MigrationTx(vm, dst_pm)); vm->extension_set(new simgrid::vm::VmMigrationExt(simgrid::s4u::Actor::self(), rx, tx)); diff --git a/src/s4u/s4u_actor.cpp b/src/s4u/s4u_actor.cpp index 03cd93b128..4ed7584c77 100644 --- a/src/s4u/s4u_actor.cpp +++ b/src/s4u/s4u_actor.cpp @@ -14,8 +14,8 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_actor, "S4U actors"); namespace simgrid { namespace s4u { -simgrid::xbt::signal s4u::Actor::onCreation; -simgrid::xbt::signal s4u::Actor::onDestruction; +simgrid::xbt::signal s4u::Actor::on_creation; +simgrid::xbt::signal s4u::Actor::on_destruction; // ***** Actor creation ***** ActorPtr Actor::self() @@ -27,13 +27,13 @@ ActorPtr Actor::self() return self_context->process()->iface(); } -ActorPtr Actor::createActor(const char* name, s4u::Host* host, std::function code) +ActorPtr Actor::create(const char* name, s4u::Host* host, std::function code) { simgrid::kernel::actor::ActorImpl* actor = simcall_process_create(name, std::move(code), nullptr, host, nullptr); return actor->iface(); } -ActorPtr Actor::createActor(const char* name, s4u::Host* host, const char* function, std::vector args) +ActorPtr Actor::create(const char* name, s4u::Host* host, const char* function, std::vector args) { simgrid::simix::ActorCodeFactory& factory = SIMIX_get_actor_code_factory(function); simgrid::simix::ActorCode code = factory(std::move(args)); @@ -118,7 +118,7 @@ void Actor::migrate(Host* new_host) } } -s4u::Host* Actor::getHost() +s4u::Host* Actor::get_host() { return this->pimpl_->host; } @@ -128,7 +128,7 @@ void Actor::daemonize() simgrid::simix::kernelImmediate([this]() { pimpl_->daemonize(); }); } -bool Actor::isDaemon() +bool Actor::is_daemon() const { return this->pimpl_->isDaemon(); } @@ -143,12 +143,12 @@ const char* Actor::get_cname() const return this->pimpl_->get_cname(); } -aid_t Actor::getPid() +aid_t Actor::get_pid() { return this->pimpl_->pid; } -aid_t Actor::getPpid() +aid_t Actor::get_ppid() { return this->pimpl_->ppid; } @@ -408,7 +408,7 @@ int sg_actor_get_PID(sg_actor_t actor) * and the exceptions, so it would be called back again and again */ if (actor == nullptr || actor->getImpl() == nullptr) return 0; - return actor->getPid(); + return actor->get_pid(); } /** \ingroup m_actor_management @@ -419,7 +419,7 @@ int sg_actor_get_PID(sg_actor_t actor) */ int sg_actor_get_PPID(sg_actor_t actor) { - return actor->getPpid(); + return actor->get_ppid(); } /** \ingroup m_actor_management @@ -432,7 +432,7 @@ const char* sg_actor_get_name(sg_actor_t actor) sg_host_t sg_actor_get_host(sg_actor_t actor) { - return actor->getHost(); + return actor->get_host(); } /** \ingroup m_actor_management diff --git a/src/simix/ActorImpl.cpp b/src/simix/ActorImpl.cpp index 231296700b..0f9b3308ca 100644 --- a/src/simix/ActorImpl.cpp +++ b/src/simix/ActorImpl.cpp @@ -342,7 +342,7 @@ smx_actor_t SIMIX_process_create(const char* name, std::function code, v simgrid::instr::Container::byName(process->host->get_name())->createChild(instr_pid(process->ciface()), "ACTOR"); /* The onCreation() signal must be delayed until there, where the pid and everything is set */ simgrid::s4u::ActorPtr tmp = process->iface(); // Passing this directly to onCreation will lead to crashes - simgrid::s4u::Actor::onCreation(tmp); + simgrid::s4u::Actor::on_creation(tmp); return process; } @@ -757,7 +757,7 @@ smx_actor_t SIMIX_process_from_PID(aid_t PID) } void SIMIX_process_on_exit_runall(smx_actor_t process) { - simgrid::s4u::Actor::onDestruction(process->iface()); + simgrid::s4u::Actor::on_destruction(process->iface()); smx_process_exit_status_t exit_status = (process->context->iwannadie) ? SMX_EXIT_FAILURE : SMX_EXIT_SUCCESS; while (not process->on_exit.empty()) { s_smx_process_exit_fun_t exit_fun = process->on_exit.back(); diff --git a/src/smpi/bindings/smpi_pmpi_request.cpp b/src/smpi/bindings/smpi_pmpi_request.cpp index ec183c4549..d9039b47aa 100644 --- a/src/smpi/bindings/smpi_pmpi_request.cpp +++ b/src/smpi/bindings/smpi_pmpi_request.cpp @@ -15,7 +15,7 @@ static int getPid(MPI_Comm, int); static int getPid(MPI_Comm comm, int id) { simgrid::s4u::ActorPtr actor = comm->group()->actor(id); - return (actor == nullptr) ? MPI_UNDEFINED : actor->getPid(); + return (actor == nullptr) ? MPI_UNDEFINED : actor->get_pid(); } /* PMPI User level calls */ diff --git a/src/smpi/bindings/smpi_pmpi_win.cpp b/src/smpi/bindings/smpi_pmpi_win.cpp index 0447347469..77bd23e0e6 100644 --- a/src/smpi/bindings/smpi_pmpi_win.cpp +++ b/src/smpi/bindings/smpi_pmpi_win.cpp @@ -276,7 +276,7 @@ int PMPI_Put( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int my_proc_id = simgrid::s4u::this_actor::getPid(); MPI_Group group; win->get_group(&group); - int dst_traced = group->actor(target_rank)->getPid(); + int dst_traced = group->actor(target_rank)->get_pid(); TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::Pt2PtTIData("Put", target_rank, origin_datatype->is_replayable() ? origin_count @@ -319,7 +319,7 @@ int PMPI_Rput( void *origin_addr, int origin_count, MPI_Datatype origin_datatype int my_proc_id = simgrid::s4u::this_actor::getPid(); MPI_Group group; win->get_group(&group); - int dst_traced = group->actor(target_rank)->getPid(); + int dst_traced = group->actor(target_rank)->get_pid(); TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::Pt2PtTIData( "Rput", target_rank, diff --git a/src/smpi/internals/smpi_bench.cpp b/src/smpi/internals/smpi_bench.cpp index 574f7c2b3f..857a057e68 100644 --- a/src/smpi/internals/smpi_bench.cpp +++ b/src/smpi/internals/smpi_bench.cpp @@ -48,7 +48,7 @@ void smpi_execute_(double *duration) void smpi_execute_flops(double flops) { xbt_assert(flops >= 0, "You're trying to execute a negative amount of flops (%f)!", flops); XBT_DEBUG("Handle real computation time: %f flops", flops); - smx_activity_t action = simcall_execution_start("computation", flops, 1, 0, smpi_process()->process()->getHost()); + smx_activity_t action = simcall_execution_start("computation", flops, 1, 0, smpi_process()->process()->get_host()); simcall_set_category (action, TRACE_internal_smpi_get_category()); simcall_execution_wait(action); smpi_switch_data_segment(simgrid::s4u::Actor::self()); diff --git a/src/smpi/internals/smpi_global.cpp b/src/smpi/internals/smpi_global.cpp index 81cadf5eb2..ebf13d8d52 100644 --- a/src/smpi/internals/smpi_global.cpp +++ b/src/smpi/internals/smpi_global.cpp @@ -606,12 +606,12 @@ int smpi_main(const char* executable, int argc, char *argv[]) // Called either directly from the user code, or from the code called by smpirun void SMPI_init(){ - simgrid::s4u::Actor::onCreation.connect([](simgrid::s4u::ActorPtr actor) { - if (not actor->isDaemon()) { + simgrid::s4u::Actor::on_creation.connect([](simgrid::s4u::ActorPtr actor) { + if (not actor->is_daemon()) { process_data.insert({actor, new simgrid::smpi::Process(actor, nullptr)}); } }); - simgrid::s4u::Actor::onDestruction.connect([](simgrid::s4u::ActorPtr actor) { + simgrid::s4u::Actor::on_destruction.connect([](simgrid::s4u::ActorPtr actor) { auto it = process_data.find(actor); if (it != process_data.end()) { delete it->second; diff --git a/src/smpi/internals/smpi_memory.cpp b/src/smpi/internals/smpi_memory.cpp index a6ea8dd78f..d700934d40 100644 --- a/src/smpi/internals/smpi_memory.cpp +++ b/src/smpi/internals/smpi_memory.cpp @@ -99,7 +99,7 @@ static void* asan_safe_memcpy(void* dest, void* src, size_t n) /** Map a given SMPI privatization segment (make a SMPI process active) */ void smpi_switch_data_segment(simgrid::s4u::ActorPtr actor) { - if (smpi_loaded_page == actor->getPid()) // no need to switch, we've already loaded the one we want + if (smpi_loaded_page == actor->get_pid()) // no need to switch, we've already loaded the one we want return; // So the job: @@ -118,14 +118,14 @@ void smpi_really_switch_data_segment(simgrid::s4u::ActorPtr actor) #if HAVE_PRIVATIZATION // FIXME, cross-process support (mmap across process when necessary) - XBT_DEBUG("Switching data frame to the one of process %ld", actor->getPid()); + XBT_DEBUG("Switching data frame to the one of process %ld", actor->get_pid()); simgrid::smpi::Process* process = smpi_process_remote(actor); int current = process->privatized_region()->file_descriptor; void* tmp = mmap(TOPAGE(smpi_data_exe_start), smpi_data_exe_size, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED, current, 0); if (tmp != TOPAGE(smpi_data_exe_start)) xbt_die("Couldn't map the new region (errno %d): %s", errno, strerror(errno)); - smpi_loaded_page = actor->getPid(); + smpi_loaded_page = actor->get_pid(); #endif } diff --git a/src/smpi/internals/smpi_process.cpp b/src/smpi/internals/smpi_process.cpp index 31fd2b93ba..eda3a6857f 100644 --- a/src/smpi/internals/smpi_process.cpp +++ b/src/smpi/internals/smpi_process.cpp @@ -24,8 +24,8 @@ using simgrid::s4u::ActorPtr; Process::Process(ActorPtr actor, msg_bar_t finalization_barrier) : finalization_barrier_(finalization_barrier), process_(actor) { - mailbox_ = simgrid::s4u::Mailbox::byName("SMPI-" + std::to_string(process_->getPid())); - mailbox_small_ = simgrid::s4u::Mailbox::byName("small-" + std::to_string(process_->getPid())); + mailbox_ = simgrid::s4u::Mailbox::byName("SMPI-" + std::to_string(process_->get_pid())); + mailbox_small_ = simgrid::s4u::Mailbox::byName("small-" + std::to_string(process_->get_pid())); mailboxes_mutex_ = xbt_mutex_init(); timer_ = xbt_os_timer_new(); state_ = SMPI_UNINITIALIZED; @@ -81,14 +81,14 @@ void Process::set_data(int* argc, char*** argv) argv_ = argv; // set the process attached to the mailbox mailbox_small_->setReceiver(process_); - XBT_DEBUG("<%ld> SMPI process has been initialized: %p", process_->getPid(), process_.get()); + XBT_DEBUG("<%ld> SMPI process has been initialized: %p", process_->get_pid(), process_.get()); } /** @brief Prepares the current process for termination. */ void Process::finalize() { state_ = SMPI_FINALIZED; - XBT_DEBUG("<%ld> Process left the game", process_->getPid()); + XBT_DEBUG("<%ld> Process left the game", process_->get_pid()); // This leads to an explosion of the search graph which cannot be reduced: if(MC_is_active() || MC_record_replay_is_active()) diff --git a/src/smpi/internals/smpi_replay.cpp b/src/smpi/internals/smpi_replay.cpp index fc047a634f..40f5cdbd15 100644 --- a/src/smpi/internals/smpi_replay.cpp +++ b/src/smpi/internals/smpi_replay.cpp @@ -465,7 +465,7 @@ public: explicit SendAction(std::string name) : ReplayAction(name) {} void kernel(simgrid::xbt::ReplayAction& action) override { - int dst_traced = MPI_COMM_WORLD->group()->actor(args.partner)->getPid(); + int dst_traced = MPI_COMM_WORLD->group()->actor(args.partner)->get_pid(); TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::Pt2PtTIData(name, args.partner, args.size, Datatype::encode(args.datatype1))); @@ -491,7 +491,7 @@ public: explicit RecvAction(std::string name) : ReplayAction(name) {} void kernel(simgrid::xbt::ReplayAction& action) override { - int src_traced = MPI_COMM_WORLD->group()->actor(args.partner)->getPid(); + int src_traced = MPI_COMM_WORLD->group()->actor(args.partner)->get_pid(); TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::Pt2PtTIData(name, args.partner, args.size, Datatype::encode(args.datatype1))); @@ -622,7 +622,7 @@ public: void kernel(simgrid::xbt::ReplayAction& action) override { TRACE_smpi_comm_in(my_proc_id, "action_bcast", - new simgrid::instr::CollTIData("bcast", MPI_COMM_WORLD->group()->actor(args.root)->getPid(), + new simgrid::instr::CollTIData("bcast", MPI_COMM_WORLD->group()->actor(args.root)->get_pid(), -1.0, args.size, -1, Datatype::encode(args.datatype1), "")); Colls::bcast(send_buffer(args.size * args.datatype1->size()), args.size, args.datatype1, args.root, MPI_COMM_WORLD); @@ -637,8 +637,9 @@ public: void kernel(simgrid::xbt::ReplayAction& action) override { TRACE_smpi_comm_in(my_proc_id, "action_reduce", - new simgrid::instr::CollTIData("reduce", MPI_COMM_WORLD->group()->actor(args.root)->getPid(), args.comp_size, - args.comm_size, -1, Datatype::encode(args.datatype1), "")); + new simgrid::instr::CollTIData("reduce", MPI_COMM_WORLD->group()->actor(args.root)->get_pid(), + args.comp_size, args.comm_size, -1, + Datatype::encode(args.datatype1), "")); Colls::reduce(send_buffer(args.comm_size * args.datatype1->size()), recv_buffer(args.comm_size * args.datatype1->size()), args.comm_size, args.datatype1, MPI_OP_NULL, args.root, MPI_COMM_WORLD); diff --git a/src/smpi/mpi/smpi_group.cpp b/src/smpi/mpi/smpi_group.cpp index 2128c4c876..9d9d115808 100644 --- a/src/smpi/mpi/smpi_group.cpp +++ b/src/smpi/mpi/smpi_group.cpp @@ -45,7 +45,7 @@ Group::Group(MPI_Group origin) void Group::set_mapping(simgrid::s4u::ActorPtr actor, int rank) { if (0 <= rank && rank < size_) { - int index = actor->getPid(); + int index = actor->get_pid(); rank_to_index_map_[rank] = index; if (index != MPI_UNDEFINED) { if ((unsigned)index >= index_to_rank_map_.size()) diff --git a/src/smpi/mpi/smpi_request.cpp b/src/smpi/mpi/smpi_request.cpp index c0bd4f674d..b8fa3dbcfa 100644 --- a/src/smpi/mpi/smpi_request.cpp +++ b/src/smpi/mpi/smpi_request.cpp @@ -180,19 +180,19 @@ MPI_Request Request::send_init(void *buf, int count, MPI_Datatype datatype, int { return new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::this_actor::getPid(), - comm->group()->actor(dst)->getPid(), tag, comm, PERSISTENT | SEND | PREPARED); + comm->group()->actor(dst)->get_pid(), tag, comm, PERSISTENT | SEND | PREPARED); } MPI_Request Request::ssend_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm) { return new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::this_actor::getPid(), - comm->group()->actor(dst)->getPid(), tag, comm, PERSISTENT | SSEND | SEND | PREPARED); + comm->group()->actor(dst)->get_pid(), tag, comm, PERSISTENT | SSEND | SEND | PREPARED); } MPI_Request Request::isend_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm) { return new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::this_actor::getPid(), - comm->group()->actor(dst)->getPid(), tag, comm, PERSISTENT | ISEND | SEND | PREPARED); + comm->group()->actor(dst)->get_pid(), tag, comm, PERSISTENT | ISEND | SEND | PREPARED); } @@ -201,13 +201,13 @@ MPI_Request Request::rma_send_init(void *buf, int count, MPI_Datatype datatype, { MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */ if(op==MPI_OP_NULL){ - request = new Request(buf==MPI_BOTTOM ? nullptr : buf , count, datatype, comm->group()->actor(src)->getPid(), - comm->group()->actor(dst)->getPid(), tag, - comm, RMA | NON_PERSISTENT | ISEND | SEND | PREPARED); + request = + new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, comm->group()->actor(src)->get_pid(), + comm->group()->actor(dst)->get_pid(), tag, comm, RMA | NON_PERSISTENT | ISEND | SEND | PREPARED); }else{ - request = new Request(buf==MPI_BOTTOM ? nullptr : buf, count, datatype, comm->group()->actor(src)->getPid(), - comm->group()->actor(dst)->getPid(), tag, - comm, RMA | NON_PERSISTENT | ISEND | SEND | PREPARED | ACCUMULATE); + request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, comm->group()->actor(src)->get_pid(), + comm->group()->actor(dst)->get_pid(), tag, comm, + RMA | NON_PERSISTENT | ISEND | SEND | PREPARED | ACCUMULATE); request->op_ = op; } return request; @@ -216,7 +216,7 @@ MPI_Request Request::rma_send_init(void *buf, int count, MPI_Datatype datatype, MPI_Request Request::recv_init(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm) { return new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, - src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : comm->group()->actor(src)->getPid(), + src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : comm->group()->actor(src)->get_pid(), simgrid::s4u::this_actor::getPid(), tag, comm, PERSISTENT | RECV | PREPARED); } @@ -225,10 +225,11 @@ MPI_Request Request::rma_recv_init(void *buf, int count, MPI_Datatype datatype, { MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */ if(op==MPI_OP_NULL){ - request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, comm->group()->actor(src)->getPid(), comm->group()->actor(dst)->getPid(), tag, comm, - RMA | NON_PERSISTENT | RECV | PREPARED); + request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, comm->group()->actor(src)->get_pid(), + comm->group()->actor(dst)->get_pid(), tag, comm, RMA | NON_PERSISTENT | RECV | PREPARED); }else{ - request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, comm->group()->actor(src)->getPid(), comm->group()->actor(dst)->getPid(), tag, comm, + request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, comm->group()->actor(src)->get_pid(), + comm->group()->actor(dst)->get_pid(), tag, comm, RMA | NON_PERSISTENT | RECV | PREPARED | ACCUMULATE); request->op_ = op; } @@ -238,7 +239,7 @@ MPI_Request Request::rma_recv_init(void *buf, int count, MPI_Datatype datatype, MPI_Request Request::irecv_init(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm) { return new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, - src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : comm->group()->actor(src)->getPid(), + src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : comm->group()->actor(src)->get_pid(), simgrid::s4u::this_actor::getPid(), tag, comm, PERSISTENT | RECV | PREPARED); } @@ -246,7 +247,7 @@ MPI_Request Request::isend(void *buf, int count, MPI_Datatype datatype, int dst, { MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */ request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::this_actor::getPid(), - comm->group()->actor(dst)->getPid(), tag, comm, NON_PERSISTENT | ISEND | SEND); + comm->group()->actor(dst)->get_pid(), tag, comm, NON_PERSISTENT | ISEND | SEND); request->start(); return request; } @@ -255,7 +256,7 @@ MPI_Request Request::issend(void *buf, int count, MPI_Datatype datatype, int dst { MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */ request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::this_actor::getPid(), - comm->group()->actor(dst)->getPid(), tag, comm, NON_PERSISTENT | ISEND | SSEND | SEND); + comm->group()->actor(dst)->get_pid(), tag, comm, NON_PERSISTENT | ISEND | SSEND | SEND); request->start(); return request; } @@ -265,7 +266,7 @@ MPI_Request Request::irecv(void *buf, int count, MPI_Datatype datatype, int src, { MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */ request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, - src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : comm->group()->actor(src)->getPid(), + src == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : comm->group()->actor(src)->get_pid(), simgrid::s4u::this_actor::getPid(), tag, comm, NON_PERSISTENT | RECV); request->start(); return request; @@ -283,7 +284,7 @@ void Request::send(void *buf, int count, MPI_Datatype datatype, int dst, int tag { MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */ request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::this_actor::getPid(), - comm->group()->actor(dst)->getPid(), tag, comm, NON_PERSISTENT | SEND); + comm->group()->actor(dst)->get_pid(), tag, comm, NON_PERSISTENT | SEND); request->start(); wait(&request, MPI_STATUS_IGNORE); @@ -294,7 +295,7 @@ void Request::ssend(void *buf, int count, MPI_Datatype datatype, int dst, int ta { MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */ request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::this_actor::getPid(), - comm->group()->actor(dst)->getPid(), tag, comm, NON_PERSISTENT | SSEND | SEND); + comm->group()->actor(dst)->get_pid(), tag, comm, NON_PERSISTENT | SSEND | SEND); request->start(); wait(&request,MPI_STATUS_IGNORE); @@ -308,15 +309,15 @@ void Request::sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,int d MPI_Request requests[2]; MPI_Status stats[2]; int myid = simgrid::s4u::this_actor::getPid(); - if ((comm->group()->actor(dst)->getPid() == myid) && (comm->group()->actor(src)->getPid() == myid)){ - Datatype::copy(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype); - if(status !=MPI_STATUS_IGNORE){ - status->MPI_SOURCE = src; - status->MPI_TAG = recvtag; - status->MPI_ERROR = MPI_SUCCESS; - status->count = sendcount*sendtype->size(); - } - return; + if ((comm->group()->actor(dst)->get_pid() == myid) && (comm->group()->actor(src)->get_pid() == myid)) { + Datatype::copy(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype); + if (status != MPI_STATUS_IGNORE) { + status->MPI_SOURCE = src; + status->MPI_TAG = recvtag; + status->MPI_ERROR = MPI_SUCCESS; + status->count = sendcount * sendtype->size(); + } + return; } requests[0] = isend_init(sendbuf, sendcount, sendtype, dst, sendtag, comm); requests[1] = irecv_init(recvbuf, recvcount, recvtype, src, recvtag, comm); @@ -429,8 +430,8 @@ void Request::start() if (detached_ != 0 || ((flags_ & (ISEND | SSEND)) != 0)) { // issend should be treated as isend // isend and send timings may be different sleeptime = ((flags_ & ISEND) != 0) - ? simgrid::s4u::Actor::self()->getHost()->extension()->oisend(size_) - : simgrid::s4u::Actor::self()->getHost()->extension()->osend(size_); + ? simgrid::s4u::Actor::self()->get_host()->extension()->oisend(size_) + : simgrid::s4u::Actor::self()->get_host()->extension()->osend(size_); } if(sleeptime > 0.0){ @@ -635,10 +636,10 @@ void Request::iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* // nsleeps is a multiplier to the sleeptime, to increase speed of execution, each failed iprobe will increase it // This can speed up the execution of certain applications by an order of magnitude, such as HPL static int nsleeps = 1; - double speed = simgrid::s4u::Actor::self()->getHost()->getSpeed(); + double speed = simgrid::s4u::Actor::self()->get_host()->getSpeed(); double maxrate = xbt_cfg_get_double("smpi/iprobe-cpu-usage"); MPI_Request request = new Request(nullptr, 0, MPI_CHAR, - source == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : comm->group()->actor(source)->getPid(), + source == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : comm->group()->actor(source)->get_pid(), simgrid::s4u::this_actor::getPid(), tag, comm, PERSISTENT | RECV); if (smpi_iprobe_sleep > 0) { smx_activity_t iprobe_sleep = simcall_execution_start( @@ -736,7 +737,7 @@ void Request::finish_wait(MPI_Request* request, MPI_Status * status) if(req->detached_sender_ != nullptr){ //integrate pseudo-timing for buffering of small messages, do not bother to execute the simcall if 0 double sleeptime = - simgrid::s4u::Actor::self()->getHost()->extension()->orecv(req->real_size()); + simgrid::s4u::Actor::self()->get_host()->extension()->orecv(req->real_size()); if(sleeptime > 0.0){ simcall_process_sleep(sleeptime); XBT_DEBUG("receiving size of %zu : sleep %f ", req->real_size_, sleeptime); diff --git a/src/smpi/mpi/smpi_win.cpp b/src/smpi/mpi/smpi_win.cpp index 212f0f5c0d..a7a61117a4 100644 --- a/src/smpi/mpi/smpi_win.cpp +++ b/src/smpi/mpi/smpi_win.cpp @@ -694,7 +694,7 @@ int Win::finish_comms(int rank){ size = 0; std::vector myreqqs; std::vector::iterator iter = reqqs->begin(); - int proc_id = comm_->group()->actor(rank)->getPid(); + int proc_id = comm_->group()->actor(rank)->get_pid(); while (iter != reqqs->end()){ // Let's see if we're either the destination or the sender of this request // because we only wait for requests that we are responsible for. diff --git a/src/surf/plugins/host_dvfs.cpp b/src/surf/plugins/host_dvfs.cpp index 1a169b4585..09405af1c0 100644 --- a/src/surf/plugins/host_dvfs.cpp +++ b/src/surf/plugins/host_dvfs.cpp @@ -234,44 +234,44 @@ static void on_host_added(simgrid::s4u::Host& host) return; std::string name = std::string("dvfs-daemon-") + host.get_cname(); - simgrid::s4u::ActorPtr daemon = simgrid::s4u::Actor::createActor(name.c_str(), &host, []() { + simgrid::s4u::ActorPtr daemon = simgrid::s4u::Actor::create(name.c_str(), &host, []() { /** * This lambda function is the function the actor (daemon) will execute * all the time - in the case of the dvfs plugin, this controls when to * lower/raise the frequency. */ - simgrid::s4u::ActorPtr daemonProc = simgrid::s4u::Actor::self(); + simgrid::s4u::ActorPtr daemon_proc = simgrid::s4u::Actor::self(); - XBT_DEBUG("DVFS process on %s is a daemon: %d", daemonProc->getHost()->get_cname(), daemonProc->isDaemon()); + XBT_DEBUG("DVFS process on %s is a daemon: %d", daemon_proc->get_host()->get_cname(), daemon_proc->is_daemon()); std::string dvfs_governor; - const char* host_conf = daemonProc->getHost()->getProperty(property_governor); + const char* host_conf = daemon_proc->get_host()->getProperty(property_governor); if (host_conf != nullptr) { - dvfs_governor = std::string(daemonProc->getHost()->getProperty(property_governor)); + dvfs_governor = std::string(daemon_proc->get_host()->getProperty(property_governor)); boost::algorithm::to_lower(dvfs_governor); } else { dvfs_governor = xbt_cfg_get_string(property_governor); boost::algorithm::to_lower(dvfs_governor); } - auto governor = [&dvfs_governor, &daemonProc]() { + auto governor = [&dvfs_governor, &daemon_proc]() { if (dvfs_governor == "conservative") { return std::unique_ptr( - new simgrid::plugin::dvfs::Conservative(daemonProc->getHost())); + new simgrid::plugin::dvfs::Conservative(daemon_proc->get_host())); } else if (dvfs_governor == "ondemand") { return std::unique_ptr( - new simgrid::plugin::dvfs::OnDemand(daemonProc->getHost())); + new simgrid::plugin::dvfs::OnDemand(daemon_proc->get_host())); } else if (dvfs_governor == "performance") { return std::unique_ptr( - new simgrid::plugin::dvfs::Performance(daemonProc->getHost())); + new simgrid::plugin::dvfs::Performance(daemon_proc->get_host())); } else if (dvfs_governor == "powersave") { return std::unique_ptr( - new simgrid::plugin::dvfs::Powersave(daemonProc->getHost())); + new simgrid::plugin::dvfs::Powersave(daemon_proc->get_host())); } else { XBT_CRITICAL("No governor specified for host %s, falling back to Performance", - daemonProc->getHost()->get_cname()); + daemon_proc->get_host()->get_cname()); return std::unique_ptr( - new simgrid::plugin::dvfs::Performance(daemonProc->getHost())); + new simgrid::plugin::dvfs::Performance(daemon_proc->get_host())); } }(); diff --git a/teshsuite/s4u/actor/actor.cpp b/teshsuite/s4u/actor/actor.cpp index de47145a5e..259f917489 100644 --- a/teshsuite/s4u/actor/actor.cpp +++ b/teshsuite/s4u/actor/actor.cpp @@ -26,25 +26,25 @@ static void master() simgrid::s4u::this_actor::getHost()->actorList(actor_list); for (auto const& actor : *actor_list) { - XBT_INFO("Actor (pid=%ld, ppid=%ld, name=%s)", actor->getPid(), actor->getPpid(), actor->get_cname()); - if (simgrid::s4u::this_actor::getPid() != actor->getPid()) + XBT_INFO("Actor (pid=%ld, ppid=%ld, name=%s)", actor->get_pid(), actor->get_ppid(), actor->get_cname()); + if (simgrid::s4u::this_actor::getPid() != actor->get_pid()) actor->kill(); } simgrid::s4u::ActorPtr actor = - simgrid::s4u::Actor::createActor("worker from master", simgrid::s4u::this_actor::getHost(), worker); + simgrid::s4u::Actor::create("worker from master", simgrid::s4u::this_actor::getHost(), worker); simgrid::s4u::this_actor::sleep_for(2); - XBT_INFO("Suspend Actor (pid=%ld)", actor->getPid()); + XBT_INFO("Suspend Actor (pid=%ld)", actor->get_pid()); actor->suspend(); - XBT_INFO("Actor (pid=%ld) is %ssuspended", actor->getPid(), actor->isSuspended() ? "" : "not "); + XBT_INFO("Actor (pid=%ld) is %ssuspended", actor->get_pid(), actor->isSuspended() ? "" : "not "); simgrid::s4u::this_actor::sleep_for(2); - XBT_INFO("Resume Actor (pid=%ld)", actor->getPid()); + XBT_INFO("Resume Actor (pid=%ld)", actor->get_pid()); actor->resume(); - XBT_INFO("Actor (pid=%ld) is %ssuspended", actor->getPid(), actor->isSuspended() ? "" : "not "); + XBT_INFO("Actor (pid=%ld) is %ssuspended", actor->get_pid(), actor->isSuspended() ? "" : "not "); simgrid::s4u::this_actor::sleep_for(2); actor->kill(); @@ -57,8 +57,8 @@ int main(int argc, char* argv[]) simgrid::s4u::Engine e(&argc, argv); e.loadPlatform(argv[1]); - simgrid::s4u::Actor::createActor("master", simgrid::s4u::Host::by_name("Tremblay"), master); - simgrid::s4u::Actor::createActor("worker", simgrid::s4u::Host::by_name("Tremblay"), worker); + simgrid::s4u::Actor::create("master", simgrid::s4u::Host::by_name("Tremblay"), master); + simgrid::s4u::Actor::create("worker", simgrid::s4u::Host::by_name("Tremblay"), worker); e.run(); XBT_INFO("Simulation time %g", e.getClock()); diff --git a/teshsuite/s4u/cloud-interrupt-migration/cloud-interrupt-migration.cpp b/teshsuite/s4u/cloud-interrupt-migration/cloud-interrupt-migration.cpp index 74768e4e86..746e06ed75 100644 --- a/teshsuite/s4u/cloud-interrupt-migration/cloud-interrupt-migration.cpp +++ b/teshsuite/s4u/cloud-interrupt-migration/cloud-interrupt-migration.cpp @@ -21,7 +21,7 @@ static void vm_migrate(simgrid::s4u::VirtualMachine* vm, simgrid::s4u::Host* dst static simgrid::s4u::ActorPtr vm_migrate_async(simgrid::s4u::VirtualMachine* vm, simgrid::s4u::Host* dst_pm) { - return simgrid::s4u::Actor::createActor("mig_wrk", simgrid::s4u::Host::current(), vm_migrate, vm, dst_pm); + return simgrid::s4u::Actor::create("mig_wrk", simgrid::s4u::Host::current(), vm_migrate, vm, dst_pm); } static void master_main() @@ -61,7 +61,7 @@ int main(int argc, char* argv[]) /* load the platform file */ e.loadPlatform(argv[1]); - simgrid::s4u::Actor::createActor("master_", simgrid::s4u::Host::by_name("Fafard"), master_main); + simgrid::s4u::Actor::create("master_", simgrid::s4u::Host::by_name("Fafard"), master_main); e.run(); diff --git a/teshsuite/s4u/comm-pt2pt/comm-pt2pt.cpp b/teshsuite/s4u/comm-pt2pt/comm-pt2pt.cpp index c28714e19a..d5f6391c72 100644 --- a/teshsuite/s4u/comm-pt2pt/comm-pt2pt.cpp +++ b/teshsuite/s4u/comm-pt2pt/comm-pt2pt.cpp @@ -184,8 +184,8 @@ int main(int argc, char* argv[]) std::vector hosts = e.getAllHosts(); - simgrid::s4u::Actor::createActor("sender", hosts[0], sender, argSend); - simgrid::s4u::Actor::createActor("recver", hosts[1], receiver, argRecv); + simgrid::s4u::Actor::create("sender", hosts[0], sender, argSend); + simgrid::s4u::Actor::create("recver", hosts[1], receiver, argRecv); e.run(); XBT_INFO("Simulation time %g", e.getClock()); diff --git a/teshsuite/s4u/concurrent_rw/concurrent_rw.cpp b/teshsuite/s4u/concurrent_rw/concurrent_rw.cpp index 6872b3f726..ea8850b003 100644 --- a/teshsuite/s4u/concurrent_rw/concurrent_rw.cpp +++ b/teshsuite/s4u/concurrent_rw/concurrent_rw.cpp @@ -33,7 +33,7 @@ int main(int argc, char** argv) e.loadPlatform(argv[1]); for (int i = 0; i < 5; i++) - simgrid::s4u::Actor::createActor("host", simgrid::s4u::Host::by_name("bob"), host); + simgrid::s4u::Actor::create("host", simgrid::s4u::Host::by_name("bob"), host); e.run(); XBT_INFO("Simulation time %g", e.getClock()); diff --git a/teshsuite/s4u/host_on_off_wait/host_on_off_wait.cpp b/teshsuite/s4u/host_on_off_wait/host_on_off_wait.cpp index 90dfdeeb26..4268f6f20e 100644 --- a/teshsuite/s4u/host_on_off_wait/host_on_off_wait.cpp +++ b/teshsuite/s4u/host_on_off_wait/host_on_off_wait.cpp @@ -31,8 +31,8 @@ int main(int argc, char* argv[]) simgrid::s4u::Engine e(&argc, argv); e.loadPlatform(argv[1]); - simgrid::s4u::Actor::createActor("master", simgrid::s4u::Host::by_name("Tremblay"), master); - simgrid::s4u::Actor::createActor("worker", simgrid::s4u::Host::by_name("Jupiter"), worker); + simgrid::s4u::Actor::create("master", simgrid::s4u::Host::by_name("Tremblay"), master); + simgrid::s4u::Actor::create("worker", simgrid::s4u::Host::by_name("Jupiter"), worker); e.run(); XBT_INFO("Simulation time %g", e.getClock()); diff --git a/teshsuite/s4u/listen_async/listen_async.cpp b/teshsuite/s4u/listen_async/listen_async.cpp index 0951f56316..53dde41004 100644 --- a/teshsuite/s4u/listen_async/listen_async.cpp +++ b/teshsuite/s4u/listen_async/listen_async.cpp @@ -48,7 +48,7 @@ int main(int argc, char* argv[]) simgrid::s4u::Engine e(&argc, argv); e.loadPlatform(argv[1]); - simgrid::s4u::Actor::createActor("test", simgrid::s4u::Host::by_name("Tremblay"), server); + simgrid::s4u::Actor::create("test", simgrid::s4u::Host::by_name("Tremblay"), server); e.run(); diff --git a/teshsuite/s4u/pid/pid.cpp b/teshsuite/s4u/pid/pid.cpp index 69b7ff8b73..293859ac03 100644 --- a/teshsuite/s4u/pid/pid.cpp +++ b/teshsuite/s4u/pid/pid.cpp @@ -44,10 +44,10 @@ int main(int argc, char* argv[]) simgrid::s4u::Actor::killAll(); - simgrid::s4u::Actor::createActor("sendpid", simgrid::s4u::Host::by_name("Tremblay"), sendpid); - simgrid::s4u::Actor::createActor("sendpid", simgrid::s4u::Host::by_name("Tremblay"), sendpid); - simgrid::s4u::Actor::createActor("sendpid", simgrid::s4u::Host::by_name("Tremblay"), sendpid); - simgrid::s4u::Actor::createActor("killall", simgrid::s4u::Host::by_name("Tremblay"), killall); + simgrid::s4u::Actor::create("sendpid", simgrid::s4u::Host::by_name("Tremblay"), sendpid); + simgrid::s4u::Actor::create("sendpid", simgrid::s4u::Host::by_name("Tremblay"), sendpid); + simgrid::s4u::Actor::create("sendpid", simgrid::s4u::Host::by_name("Tremblay"), sendpid); + simgrid::s4u::Actor::create("killall", simgrid::s4u::Host::by_name("Tremblay"), killall); e.run(); diff --git a/teshsuite/s4u/storage_client_server/storage_client_server.cpp b/teshsuite/s4u/storage_client_server/storage_client_server.cpp index 78e962a945..d3dd770ab9 100644 --- a/teshsuite/s4u/storage_client_server/storage_client_server.cpp +++ b/teshsuite/s4u/storage_client_server/storage_client_server.cpp @@ -159,8 +159,8 @@ int main(int argc, char* argv[]) xbt_assert(argc == 2, "Usage: %s platform_file\n", argv[0]); e.loadPlatform(argv[1]); - simgrid::s4u::Actor::createActor("server", simgrid::s4u::Host::by_name("alice"), server); - simgrid::s4u::Actor::createActor("client", simgrid::s4u::Host::by_name("bob"), client); + simgrid::s4u::Actor::create("server", simgrid::s4u::Host::by_name("alice"), server); + simgrid::s4u::Actor::create("client", simgrid::s4u::Host::by_name("bob"), client); e.run();