From: Fred Suter Date: Thu, 20 Jul 2023 16:44:03 +0000 (-0400) Subject: Merge branch 'master' into jbod X-Git-Tag: v3.35~136^2~1 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/f52bb9560085e6507728145fa4ee31b6cafb8075?hp=c4b7bad9496047f71e12b920ee69366769686018 Merge branch 'master' into jbod --- diff --git a/BuildSimGrid.sh b/BuildSimGrid.sh index 773ca48425..66b309eb8b 100755 --- a/BuildSimGrid.sh +++ b/BuildSimGrid.sh @@ -15,7 +15,7 @@ if [ ! -e Makefile ] && [ ! -e build.ninja ]; then fi fi -target=tests +target=examples ncores=$(grep -c processor /proc/cpuinfo) install_path=$(sed -n 's/^CMAKE_INSTALL_PREFIX:PATH=//p' CMakeCache.txt) diff --git a/CMakeLists.txt b/CMakeLists.txt index 545604e129..1a4a2459c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -757,6 +757,8 @@ add_custom_target(tests-mc COMMENT "Recompiling the MC tests and tools.") add_dependencies(tests tests-mc) add_custom_target(tests-ns3 COMMENT "Recompiling the ns3 tests and tools.") add_dependencies(tests tests-ns3) +add_custom_target(examples COMMENT "Recompiling all examples") +add_dependencies(examples tests) ### Build some Maintainer files include(${CMAKE_HOME_DIRECTORY}/tools/cmake/MaintainerMode.cmake) diff --git a/ChangeLog b/ChangeLog index 6e5f715a92..fd83efffeb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,13 @@ SimGrid (3.34.1) not released (Target: fall 2023) S4U: - New class ActivitySet to ease wait_any()/test_any()/wait_all() + - New function NetZone::add_route(host1, host2, links) when you don't need gateways + Also add a variant with s4u::Link, when you don't want to specify the directions + on symmetric routes. + +SMPI: + - New SMPI_app_instance_join(): wait for the completion of a started MPI instance + - MPI_UNIVERSE_SIZE now initialized to the total amount of hosts in the platform Python: - Make the host_load plugin available from Python. See examples/python/plugin-host-load diff --git a/docs/source/Installing_SimGrid.rst b/docs/source/Installing_SimGrid.rst index 7cd24049a8..477b53ed9a 100644 --- a/docs/source/Installing_SimGrid.rst +++ b/docs/source/Installing_SimGrid.rst @@ -325,7 +325,7 @@ existing targets are not really for public consumption so don't worry if some do not work for you. - **make**: Build the core of SimGrid that gets installed, but not any example. -- **make tests**: Build the tests and examples. +- **make examples**: Build the examples, which are needed by the tests. - **make simgrid**: Build only the SimGrid library. Not any example nor the helper tools. - **make s4u-comm-pingpong**: Build only this example (works for any example) - **make python-bindings**: Build the Python bindings diff --git a/docs/source/Models.rst b/docs/source/Models.rst index 229d61c6bb..e8ee9016e5 100644 --- a/docs/source/Models.rst +++ b/docs/source/Models.rst @@ -125,7 +125,7 @@ small delay that corresponds to the end-to-end latency. During that time, the co communications are not slowed down, because there is no contention yet). As an alternative to the above LMM-based models, it is possible to use the :ref:`ns-3 simulator as a network model `. ns-3 performs -a mushc more detailed, packet-level simulation +a much more detailed, packet-level simulation than the above models. As a result is is much slower but will produce more accurate results. Both simulators have time complexity that is linear in the size of their input, but ns-3 has a much larger input in case of large communications because it considers individual network packets. diff --git a/docs/source/Platform_routing.rst b/docs/source/Platform_routing.rst index 6cc6d75d2e..fe5a7c424d 100644 --- a/docs/source/Platform_routing.rst +++ b/docs/source/Platform_routing.rst @@ -110,11 +110,12 @@ Vivaldi ======= This routing model is particularly well adapted to Peer-to-Peer and Clouds platforms: each component is connected to the -cloud through a private link of which the upload and download rate may be asymmetric. +cloud through a private link whose upload and download rates may be asymmetric. -The network core (between the private links) is assumed to be over-sized so only the latency is taken into account. -Instead of a matrix of latencies that would become too large when the amount of peers grows, Vivaldi netzones give a -coordinate to each peer and compute the latency between host A=(xA,yA,zA) and host B=(xB,yB,zB) as follows: +The network core (between the private links) is assumed to be over-provisioned so that only the latency has to be +taken into account. Instead of a matrix of latencies that would become too large when the amount of peers grows, +Vivaldi netzones give a coordinate to each peer and compute the latency between host A=(xA,yA,zA) and host B=(xB,yB,zB) +as follows: latency = sqrt( (xA-xB)² + (yA-yB)² ) + zA + zB diff --git a/examples/cpp/app-chainsend/s4u-app-chainsend.cpp b/examples/cpp/app-chainsend/s4u-app-chainsend.cpp index 2ba057cd93..bd7e25d56a 100644 --- a/examples/cpp/app-chainsend/s4u-app-chainsend.cpp +++ b/examples/cpp/app-chainsend/s4u-app-chainsend.cpp @@ -34,8 +34,8 @@ public: sg4::Mailbox* prev = nullptr; sg4::Mailbox* next = nullptr; sg4::Mailbox* me = nullptr; - std::vector pending_recvs; - std::vector pending_sends; + sg4::ActivitySet pending_recvs; + sg4::ActivitySet pending_sends; unsigned long long received_bytes = 0; unsigned int received_pieces = 0; @@ -60,17 +60,16 @@ public: while (not done) { sg4::CommPtr comm = me->get_async(&received); - pending_recvs.push_back(comm); + pending_recvs.push(comm); - ssize_t idx = sg4::Comm::wait_any(pending_recvs); - if (idx != -1) { - comm = pending_recvs.at(idx); + auto completed_one = pending_recvs.wait_any(); + if (completed_one != nullptr) { + comm = boost::dynamic_pointer_cast(completed_one); XBT_DEBUG("Peer %s got a 'SEND_DATA' message", me->get_cname()); - pending_recvs.erase(pending_recvs.begin() + idx); if (next != nullptr) { XBT_DEBUG("Sending (asynchronously) from %s to %s", me->get_cname(), next->get_cname()); sg4::CommPtr send = next->put_async(received, MESSAGE_SEND_DATA_HEADER_SIZE + PIECE_SIZE); - pending_sends.push_back(send); + pending_sends.push(send); } else delete received; @@ -110,14 +109,14 @@ public: void sendFile() { - std::vector pending_sends; + sg4::ActivitySet pending_sends; for (unsigned int current_piece = 0; current_piece < piece_count; current_piece++) { XBT_DEBUG("Sending (send) piece %u from %s into mailbox %s", current_piece, sg4::Host::current()->get_cname(), first->get_cname()); sg4::CommPtr comm = first->put_async(new FilePiece(), MESSAGE_SEND_DATA_HEADER_SIZE + PIECE_SIZE); - pending_sends.push_back(comm); + pending_sends.push(comm); } - sg4::Comm::wait_all(pending_sends); + pending_sends.wait_all(); } Broadcaster(int hostcount, unsigned int piece_count) : piece_count(piece_count) @@ -140,7 +139,7 @@ static void peer() p.joinChain(); p.forwardFile(); - sg4::Comm::wait_all(p.pending_sends); + p.pending_sends.wait_all(); double end_time = sg4::Engine::get_clock(); XBT_INFO("### %f %llu bytes (Avg %f MB/s); copy finished (simulated).", end_time - start_time, p.received_bytes, diff --git a/examples/cpp/comm-failure/s4u-comm-failure.cpp b/examples/cpp/comm-failure/s4u-comm-failure.cpp index 90b3778d14..0ce5522add 100644 --- a/examples/cpp/comm-failure/s4u-comm-failure.cpp +++ b/examples/cpp/comm-failure/s4u-comm-failure.cpp @@ -82,18 +82,17 @@ int main(int argc, char** argv) auto* host1 = zone->create_host("Host1", "1f"); auto* host2 = zone->create_host("Host2", "1f"); auto* host3 = zone->create_host("Host3", "1f"); + auto* link2 = zone->create_link("linkto2", "1bps")->seal(); + auto* link3 = zone->create_link("linkto3", "1bps")->seal(); - sg4::LinkInRoute linkto2{zone->create_link("linkto2", "1bps")->seal()}; - sg4::LinkInRoute linkto3{zone->create_link("linkto3", "1bps")->seal()}; - - zone->add_route(host1->get_netpoint(), host2->get_netpoint(), nullptr, nullptr, {linkto2}, false); - zone->add_route(host1->get_netpoint(), host3->get_netpoint(), nullptr, nullptr, {linkto3}, false); + zone->add_route(host1, host2, {link2}); + zone->add_route(host1, host3, {link3}); zone->seal(); sg4::Actor::create("Sender", host1, Sender("mailbox2", "mailbox3")); sg4::Actor::create("Receiver", host2, Receiver("mailbox2")); sg4::Actor::create("Receiver", host3, Receiver("mailbox3")); - + sg4::Actor::create("LinkKiller", host1, [](){ sg4::this_actor::sleep_for(10.0); XBT_INFO("Turning off link 'linkto2'"); diff --git a/examples/cpp/comm-failure/s4u-comm-failure.tesh b/examples/cpp/comm-failure/s4u-comm-failure.tesh index f3dcc62823..8a5887156d 100644 --- a/examples/cpp/comm-failure/s4u-comm-failure.tesh +++ b/examples/cpp/comm-failure/s4u-comm-failure.tesh @@ -14,4 +14,4 @@ $ ${bindir:=.}/s4u-comm-failure "--log=root.fmt:[%10.6r]%e(%i:%a@%h)%e%m%n" > [ 10.000000] (1:Sender@Host1) Comm to mailbox3 has state: STARTED > [ 10.000000] (1:Sender@Host1) Waiting on a FAILED comm raises an exception: 'Cannot wait for a failed communication' > [ 10.000000] (1:Sender@Host1) Wait for remaining comm, just to be nice -> [ 16.494845] (3:Receiver@Host3) Receiver has received successfully! +> [ 17.319588] (3:Receiver@Host3) Receiver has received successfully! diff --git a/examples/cpp/exec-dependent/s4u-exec-dependent.cpp b/examples/cpp/exec-dependent/s4u-exec-dependent.cpp index f473664f1b..08129e44fc 100644 --- a/examples/cpp/exec-dependent/s4u-exec-dependent.cpp +++ b/examples/cpp/exec-dependent/s4u-exec-dependent.cpp @@ -14,16 +14,14 @@ static void worker() // Define an amount of work that should take 1 second to execute. double computation_amount = sg4::this_actor::get_host()->get_speed(); - std::vector pending_execs; // Create a small DAG // + Two parents and a child // + First parent ends after 1 second and the Second parent after 2 seconds. sg4::ExecPtr first_parent = sg4::this_actor::exec_init(computation_amount); - pending_execs.push_back(first_parent); sg4::ExecPtr second_parent = sg4::this_actor::exec_init(2 * computation_amount); - pending_execs.push_back(second_parent); sg4::ExecPtr child = sg4::Exec::init()->set_flops_amount(computation_amount); - pending_execs.push_back(child); + + sg4::ActivitySet pending_execs ({first_parent, second_parent, child}); // Name the activities (for logging purposes only) first_parent->set_name("parent 1"); @@ -41,9 +39,9 @@ static void worker() // wait for the completion of all activities while (not pending_execs.empty()) { - ssize_t changed_pos = sg4::Exec::wait_any_for(pending_execs, -1); - XBT_INFO("Exec '%s' is complete", pending_execs[changed_pos]->get_cname()); - pending_execs.erase(pending_execs.begin() + changed_pos); + auto completed_one = pending_execs.wait_any(); + if (completed_one != nullptr) + XBT_INFO("Exec '%s' is complete", completed_one->get_cname()); } } diff --git a/examples/cpp/io-dependent/s4u-io-dependent.cpp b/examples/cpp/io-dependent/s4u-io-dependent.cpp index c86a78c2c3..4772376fa3 100644 --- a/examples/cpp/io-dependent/s4u-io-dependent.cpp +++ b/examples/cpp/io-dependent/s4u-io-dependent.cpp @@ -12,16 +12,15 @@ namespace sg4 = simgrid::s4u; static void test() { - std::vector pending_activities; - sg4::ExecPtr bob_compute = sg4::this_actor::exec_init(1e9); - pending_activities.push_back(boost::dynamic_pointer_cast(bob_compute)); sg4::IoPtr bob_write = sg4::Host::current()->get_disks().front()->io_init(4000000, sg4::Io::OpType::WRITE); - pending_activities.push_back(boost::dynamic_pointer_cast(bob_write)); sg4::IoPtr carl_read = sg4::Host::by_name("carl")->get_disks().front()->io_init(4000000, sg4::Io::OpType::READ); - pending_activities.push_back(boost::dynamic_pointer_cast(carl_read)); sg4::ExecPtr carl_compute = sg4::Host::by_name("carl")->exec_init(1e9); - pending_activities.push_back(boost::dynamic_pointer_cast(carl_compute)); + + sg4::ActivitySet pending_activities ({boost::dynamic_pointer_cast(bob_compute), + boost::dynamic_pointer_cast(bob_write), + boost::dynamic_pointer_cast(carl_read), + boost::dynamic_pointer_cast(carl_compute)}); // Name the activities (for logging purposes only) bob_compute->set_name("bob compute"); @@ -45,9 +44,9 @@ static void test() // wait for the completion of all activities while (not pending_activities.empty()) { - ssize_t changed_pos = sg4::Activity::wait_any(pending_activities); - XBT_INFO("Activity '%s' is complete", pending_activities[changed_pos]->get_cname()); - pending_activities.erase(pending_activities.begin() + changed_pos); + auto completed_one = pending_activities.wait_any(); + if (completed_one != nullptr) + XBT_INFO("Activity '%s' is complete", completed_one->get_cname()); } } diff --git a/examples/cpp/network-factors/s4u-network-factors.cpp b/examples/cpp/network-factors/s4u-network-factors.cpp index 1ff67f6252..7cb94371cc 100644 --- a/examples/cpp/network-factors/s4u-network-factors.cpp +++ b/examples/cpp/network-factors/s4u-network-factors.cpp @@ -78,8 +78,8 @@ static void load_platform() /* add link UP/DOWN for communications from the host */ root->add_route(host->get_netpoint(), nullptr, nullptr, nullptr, {{l, sg4::LinkInRoute::Direction::UP}}, true); - const sg4::Link* loopback = root->create_link(hostname + "_loopback", BW_LOCAL)->set_latency(LATENCY)->seal(); - root->add_route(host->get_netpoint(), host->get_netpoint(), nullptr, nullptr, {sg4::LinkInRoute(loopback)}); + sg4::Link* loopback = root->create_link(hostname + "_loopback", BW_LOCAL)->set_latency(LATENCY)->seal(); + root->add_route(host, host, {loopback}); } root->seal(); diff --git a/examples/cpp/network-nonlinear/s4u-network-nonlinear.cpp b/examples/cpp/network-nonlinear/s4u-network-nonlinear.cpp index 6384e76ddb..d109be7d88 100644 --- a/examples/cpp/network-nonlinear/s4u-network-nonlinear.cpp +++ b/examples/cpp/network-nonlinear/s4u-network-nonlinear.cpp @@ -8,6 +8,7 @@ */ #include +#include namespace sg4 = simgrid::s4u; @@ -23,10 +24,10 @@ public: void operator()() const { // sphinx-doc: init-begin (this line helps the doc to build; ignore it) - /* Vector in which we store all ongoing communications */ - std::vector pending_comms; + /* ActivitySet in which we store all ongoing communications */ + sg4::ActivitySet pending_comms; - /* Make a vector of the mailboxes to use */ + /* Mailbox to use */ sg4::Mailbox* mbox = sg4::Mailbox::by_name("receiver"); // sphinx-doc: init-end @@ -41,13 +42,13 @@ public: /* Create a communication representing the ongoing communication, and store it in pending_comms */ sg4::CommPtr comm = mbox->put_async(payload, size); - pending_comms.push_back(comm); + pending_comms.push(comm); } XBT_INFO("Done dispatching all messages"); /* Now that all message exchanges were initiated, wait for their completion in one single call */ - sg4::Comm::wait_all(pending_comms); + pending_comms.wait_all(); // sphinx-doc: put-end XBT_INFO("Goodbye now!"); @@ -63,23 +64,28 @@ public: explicit Receiver(int count) : messages_count(count) { mbox = sg4::Mailbox::by_name("receiver"); } void operator()() { - /* Vector in which we store all incoming msgs */ - std::vector> pending_msgs; - std::vector pending_comms; + /* Where we store all incoming msgs */ + std::unordered_map> pending_msgs; + sg4::ActivitySet pending_comms; XBT_INFO("Wait for %d messages asynchronously", messages_count); for (int i = 0; i < messages_count; i++) { - pending_msgs.push_back(std::make_unique()); - pending_comms.emplace_back(mbox->get_async(pending_msgs[i].get())); + std::shared_ptr msg =std::make_shared(); + auto comm = mbox->get_async(msg.get()); + pending_comms.push(comm); + pending_msgs.insert({comm, msg}); } + while (not pending_comms.empty()) { - ssize_t index = sg4::Comm::wait_any(pending_comms); - std::string* msg = *pending_msgs[index]; - XBT_INFO("I got '%s'.", msg->c_str()); - /* cleanup memory and remove from vectors */ - delete msg; - pending_comms.erase(pending_comms.begin() + index); - pending_msgs.erase(pending_msgs.begin() + index); + auto completed_one = pending_comms.wait_any(); + if (completed_one != nullptr){ + auto comm = boost::dynamic_pointer_cast(completed_one); + auto msg = *pending_msgs[comm]; + XBT_INFO("I got '%s'.", msg->c_str()); + /* cleanup memory and remove from map */ + delete msg; + pending_msgs.erase(comm); + } } } }; @@ -125,8 +131,7 @@ static void load_platform() link->set_latency(10e-6)->seal(); /* create routes between nodes */ - zone->add_route(sender->get_netpoint(), receiver->get_netpoint(), nullptr, nullptr, - {{link, sg4::LinkInRoute::Direction::UP}}, true); + zone->add_route(sender, receiver, {link}); zone->seal(); /* create actors Sender/Receiver */ diff --git a/examples/cpp/platform-comm-serialize/s4u-platform-comm-serialize.cpp b/examples/cpp/platform-comm-serialize/s4u-platform-comm-serialize.cpp index 3fe272d415..1e637ffab2 100644 --- a/examples/cpp/platform-comm-serialize/s4u-platform-comm-serialize.cpp +++ b/examples/cpp/platform-comm-serialize/s4u-platform-comm-serialize.cpp @@ -7,7 +7,7 @@ * * This example is very similar to the other asynchronous communication examples, but messages get serialized by the platform. * Without this call to Link::set_concurrency_limit(2) in main, all messages would be received at the exact same timestamp since - * they are initiated at the same instant and are of the same size. But with this extra configuration to the link, at most 2 + * they are initiated at the same instant and are of the same size. But with this extra configuration to the link, at most 2 * messages can travel through the link at the same time. */ @@ -26,10 +26,10 @@ public: void operator()() const { // sphinx-doc: init-begin (this line helps the doc to build; ignore it) - /* Vector in which we store all ongoing communications */ - std::vector pending_comms; + /* ActivitySet in which we store all ongoing communications */ + sg4::ActivitySet pending_comms; - /* Make a vector of the mailboxes to use */ + /* Mailbox to use */ sg4::Mailbox* mbox = sg4::Mailbox::by_name("receiver"); // sphinx-doc: init-end @@ -44,13 +44,13 @@ public: /* Create a communication representing the ongoing communication, and store it in pending_comms */ sg4::CommPtr comm = mbox->put_async(payload, msg_size); - pending_comms.push_back(comm); + pending_comms.push(comm); } XBT_INFO("Done dispatching all messages"); /* Now that all message exchanges were initiated, wait for their completion in one single call */ - sg4::Comm::wait_all(pending_comms); + pending_comms.wait_all(); // sphinx-doc: put-end XBT_INFO("Goodbye now!"); @@ -66,23 +66,28 @@ public: explicit Receiver(int count) : messages_count(count) { mbox = sg4::Mailbox::by_name("receiver"); } void operator()() { - /* Vector in which we store all incoming msgs */ - std::vector> pending_msgs; - std::vector pending_comms; + /* Where we store all incoming msgs */ + std::unordered_map> pending_msgs; + sg4::ActivitySet pending_comms; XBT_INFO("Wait for %d messages asynchronously", messages_count); for (int i = 0; i < messages_count; i++) { - pending_msgs.push_back(std::make_unique()); - pending_comms.emplace_back(mbox->get_async(pending_msgs[i].get())); + std::shared_ptr msg =std::make_shared(); + auto comm = mbox->get_async(msg.get()); + pending_comms.push(comm); + pending_msgs.insert({comm, msg}); } + while (not pending_comms.empty()) { - ssize_t index = sg4::Comm::wait_any(pending_comms); - std::string* msg = *pending_msgs[index]; - XBT_INFO("I got '%s'.", msg->c_str()); - /* cleanup memory and remove from vectors */ - delete msg; - pending_comms.erase(pending_comms.begin() + index); - pending_msgs.erase(pending_msgs.begin() + index); + auto completed_one = pending_comms.wait_any(); + if (completed_one != nullptr){ + auto comm = boost::dynamic_pointer_cast(completed_one); + auto msg = *pending_msgs[comm]; + XBT_INFO("I got '%s'.", msg->c_str()); + /* cleanup memory and remove from map */ + delete msg; + pending_msgs.erase(comm); + } } } }; @@ -104,8 +109,7 @@ int main(int argc, char* argv[]) zone->create_split_duplex_link("link1", 10e9)->set_latency(10e-6)->set_concurrency_limit(2)->seal(); /* create routes between nodes */ - zone->add_route(sender->get_netpoint(), receiver->get_netpoint(), nullptr, nullptr, - {{link, sg4::LinkInRoute::Direction::UP}}, true); + zone->add_route(sender, receiver, {link}); zone->seal(); /* create actors Sender/Receiver */ diff --git a/examples/cpp/platform-failures/s4u-platform-failures.cpp b/examples/cpp/platform-failures/s4u-platform-failures.cpp index 4cafcc1634..f622d905ad 100644 --- a/examples/cpp/platform-failures/s4u-platform-failures.cpp +++ b/examples/cpp/platform-failures/s4u-platform-failures.cpp @@ -118,8 +118,8 @@ int main(int argc, char* argv[]) // Add a new host programatically, and attach a state profile to it auto* root = e.get_netzone_root(); auto* lilibeth = root->create_host("Lilibeth", 1e15); - auto link = sg4::LinkInRoute(e.link_by_name("10")); - root->add_route(e.host_by_name("Tremblay")->get_netpoint(), lilibeth->get_netpoint(), nullptr, nullptr, {link}, true); + auto link = e.link_by_name("10"); + root->add_route(e.host_by_name("Tremblay"), lilibeth, {link}); lilibeth->set_state_profile(simgrid::kernel::profile::ProfileBuilder::from_string("lilibeth_profile", R"( 4 0 5 1 diff --git a/examples/cpp/plugin-prodcons/s4u-plugin-prodcons.cpp b/examples/cpp/plugin-prodcons/s4u-plugin-prodcons.cpp index 4483303c25..828d3fc0de 100644 --- a/examples/cpp/plugin-prodcons/s4u-plugin-prodcons.cpp +++ b/examples/cpp/plugin-prodcons/s4u-plugin-prodcons.cpp @@ -70,7 +70,8 @@ int main(int argc, char* argv[]) } auto* router = cluster->create_router("cluster_router"); - cluster->add_route(router, nullptr, nullptr, nullptr, {}); + std::vector links; // empty + cluster->add_route(router, nullptr, nullptr, nullptr, links); simgrid::plugin::ProducerConsumerPtr pc = simgrid::plugin::ProducerConsumer::create(2); diff --git a/examples/python/comm-failure/comm-failure.py b/examples/python/comm-failure/comm-failure.py index 4b70b33f7a..c0ccb679f6 100644 --- a/examples/python/comm-failure/comm-failure.py +++ b/examples/python/comm-failure/comm-failure.py @@ -66,11 +66,11 @@ def main(): host2 = zone.create_host("Host2", "1f") host3 = zone.create_host("Host3", "1f") - link_to_2 = LinkInRoute(zone.create_link("link_to_2", "1bps").seal()) - link_to_3 = LinkInRoute(zone.create_link("link_to_3", "1bps").seal()) + link_to_2 = zone.create_link("link_to_2", "1bps").seal() + link_to_3 = zone.create_link("link_to_3", "1bps").seal() - zone.add_route(host1.netpoint, host2.netpoint, None, None, [link_to_2], False) - zone.add_route(host1.netpoint, host3.netpoint, None, None, [link_to_3], False) + zone.add_route(host1, host2, [link_to_2]) + zone.add_route(host1, host3, [link_to_3]) zone.seal() Actor.create("Sender", host1, sender, "mailbox2", "mailbox3") diff --git a/examples/python/comm-failure/comm-failure.tesh b/examples/python/comm-failure/comm-failure.tesh index ee26ae8d2d..8f4de0e380 100644 --- a/examples/python/comm-failure/comm-failure.tesh +++ b/examples/python/comm-failure/comm-failure.tesh @@ -14,4 +14,4 @@ $ ${pythoncmd:=python3} ${PYTHON_TOOL_OPTIONS:=} ${bindir:=.}/comm-failure.py "- > [ 10.000000] (1:Sender@Host1) Comm to mailbox3 has state: STARTED > [ 10.000000] (1:Sender@Host1) Waiting on a FAILED comm raises an exception: 'Cannot wait for a failed communication' > [ 10.000000] (1:Sender@Host1) Wait for remaining comm, just to be nice -> [ 16.494845] (3:Receiver-2@Host3) Receiver has received successfully (mailbox3)! +> [ 17.319588] (3:Receiver-2@Host3) Receiver has received successfully (mailbox3)! diff --git a/examples/python/network-nonlinear/network-nonlinear.py b/examples/python/network-nonlinear/network-nonlinear.py index fc957d818f..7bc12183b6 100644 --- a/examples/python/network-nonlinear/network-nonlinear.py +++ b/examples/python/network-nonlinear/network-nonlinear.py @@ -104,8 +104,7 @@ def load_platform(): link.set_latency(10e-6).seal() # create routes between nodes - zone.add_route(sender.netpoint, receiver.netpoint, None, None, - [LinkInRoute(link, LinkInRoute.Direction.UP)], True) + zone.add_route(sender, receiver, [link]) zone.seal() # create actors Sender/Receiver diff --git a/examples/python/platform-comm-serialize/platform-comm-serialize.py b/examples/python/platform-comm-serialize/platform-comm-serialize.py index b50b60c18b..bbd871d869 100644 --- a/examples/python/platform-comm-serialize/platform-comm-serialize.py +++ b/examples/python/platform-comm-serialize/platform-comm-serialize.py @@ -70,14 +70,7 @@ def main(): link = zone.create_split_duplex_link("link1", 10e9).set_latency(10e-6).set_concurrency_limit(2).seal() # create routes between nodes - zone.add_route( - sender_host.netpoint, - receiver_host.netpoint, - None, - None, - [LinkInRoute(link, LinkInRoute.UP)], - True - ) + zone.add_route(sender_host, receiver_host, [link]) zone.seal() # create actors Sender/Receiver diff --git a/examples/python/plugin-host-load/plugin-host-load.py b/examples/python/plugin-host-load/plugin-host-load.py index 9fce74332a..71d3ac8f4c 100644 --- a/examples/python/plugin-host-load/plugin-host-load.py +++ b/examples/python/plugin-host-load/plugin-host-load.py @@ -48,7 +48,7 @@ far: {host.computed_flops:.0E}, average load as reported by the HostLoad plugin: this_actor.info(f'Run an activity of {100E6:.0E} flops') this_actor.execute(100E6) this_actor.info(f'Done working on my activity; this took {Engine.clock - start}s; current peak speed: {host.speed:.0E} flop/s; number of flops computed so far: {host.computed_flops:.0E}') - Engine + start = Engine.clock this_actor.info("========= Requesting a reset of the computation and load counters") host.reset_load() diff --git a/examples/smpi/comm_dynamic_costs/comm-dynamic-cost.cpp b/examples/smpi/comm_dynamic_costs/comm-dynamic-cost.cpp index 9688bed95e..470836b3e9 100644 --- a/examples/smpi/comm_dynamic_costs/comm-dynamic-cost.cpp +++ b/examples/smpi/comm_dynamic_costs/comm-dynamic-cost.cpp @@ -47,8 +47,7 @@ void load_platform(const sg4::Engine& /*e*/) const sg4::Link* link9 = root->create_split_duplex_link("9", "7.20975MBps")->set_latency("1.461517ms")->seal(); - root->add_route(tremblay->get_netpoint(), jupiter->get_netpoint(), nullptr, nullptr, - {{link9, sg4::LinkInRoute::Direction::UP}}, true); + root->add_route(tremblay, jupiter, {link9}); root->seal(); /* set cost callback for MPI_Send and MPI_Recv */ diff --git a/examples/smpi/smpi_s4u_masterworker/masterworker_mailbox_smpi.cpp b/examples/smpi/smpi_s4u_masterworker/masterworker_mailbox_smpi.cpp index 0539a00a0b..d81d9fa2bd 100644 --- a/examples/smpi/smpi_s4u_masterworker/masterworker_mailbox_smpi.cpp +++ b/examples/smpi/smpi_s4u_masterworker/masterworker_mailbox_smpi.cpp @@ -127,7 +127,10 @@ int main(int argc, char* argv[]) SMPI_app_instance_start("alltoall_mpi", alltoall_mpi, {e.host_by_name_or_null("Ginette"), e.host_by_name_or_null("Bourassa"), e.host_by_name_or_null("Jupiter"), e.host_by_name_or_null("Fafard")}); + SMPI_app_instance_join("alltoall_mpi"); + XBT_INFO("This other alltoall_mpi instance terminated."); }); + e.run(); XBT_INFO("Simulation time %g", simgrid::s4u::Engine::get_clock()); diff --git a/examples/smpi/smpi_s4u_masterworker/s4u_smpi.tesh b/examples/smpi/smpi_s4u_masterworker/s4u_smpi.tesh index 00d5dc8d7a..ba6efdd22f 100644 --- a/examples/smpi/smpi_s4u_masterworker/s4u_smpi.tesh +++ b/examples/smpi/smpi_s4u_masterworker/s4u_smpi.tesh @@ -50,4 +50,5 @@ $ ./masterworker_mailbox_smpi ${srcdir:=.}/../../platforms/small_platform_with_r > [Ginette:alltoall_mpi#0:(11) 10.036773] [smpi_masterworkers/INFO] after alltoall 0 > [Bourassa:alltoall_mpi#1:(12) 10.046578] [smpi_masterworkers/INFO] after alltoall 1 > [Fafard:alltoall_mpi#3:(14) 10.046865] [smpi_masterworkers/INFO] after alltoall 3 -> [Jupiter:alltoall_mpi#2:(13) 10.046865] [smpi_masterworkers/INFO] after alltoall 2 \ No newline at end of file +> [Jupiter:alltoall_mpi#2:(13) 10.046865] [smpi_masterworkers/INFO] after alltoall 2 +> [Ginette:launcher:(10) 10.046865] [smpi_masterworkers/INFO] This other alltoall_mpi instance terminated. \ No newline at end of file diff --git a/include/simgrid/s4u/ActivitySet.hpp b/include/simgrid/s4u/ActivitySet.hpp index 172bb36991..86942a3a70 100644 --- a/include/simgrid/s4u/ActivitySet.hpp +++ b/include/simgrid/s4u/ActivitySet.hpp @@ -11,7 +11,11 @@ #include -namespace simgrid::s4u { +namespace simgrid { + +extern template class XBT_PUBLIC xbt::Extendable; + +namespace s4u { /** @brief ActivitiesSet * * This class is a container of activities, allowing to wait for the completion of any or all activities in the set. @@ -76,6 +80,7 @@ public: bool has_failed_activities() { return not failed_activities_.empty(); } }; -}; // namespace simgrid::s4u +} // namespace s4u +} // namespace simgrid #endif diff --git a/include/simgrid/s4u/NetZone.hpp b/include/simgrid/s4u/NetZone.hpp index 97ecfbbc71..e9b909fc20 100644 --- a/include/simgrid/s4u/NetZone.hpp +++ b/include/simgrid/s4u/NetZone.hpp @@ -81,6 +81,39 @@ public: */ void add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst, const std::vector& link_list, bool symmetrical = true); + /** + * @brief Add a route between 2 netpoints, and same in other direction + * + * Create a route: + * - route between 2 hosts/routers in same netzone, no gateway is needed + * - route between 2 netzones, connecting 2 gateways. + * + * @param src Source netzone's netpoint + * @param dst Destination netzone' netpoint + * @param gw_src Netpoint of the gateway in the source netzone + * @param gw_dst Netpoint of the gateway in the destination netzone + * @param link_list List of links + */ + void add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src, + kernel::routing::NetPoint* gw_dst, const std::vector& links); + + /** + * @brief Add a route between 2 hosts + * + * @param src Source host + * @param dst Destination host + * @param link_list List of links and their direction used in this communication + * @param symmetrical Bi-directional communication + */ + void add_route(const Host* src, const Host* dst, const std::vector& link_list, bool symmetrical = true); + /** + * @brief Add a route between 2 hosts + * + * @param src Source host + * @param dst Destination host + * @param link_list List of links. The UP direction will be used on src->dst and DOWN direction on dst->src + */ + void add_route(const Host* src, const Host* dst, const std::vector& links); void add_bypass_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst, diff --git a/include/smpi/smpi.h b/include/smpi/smpi.h index ad3140ca53..453a6ef0e8 100644 --- a/include/smpi/smpi.h +++ b/include/smpi/smpi.h @@ -1235,6 +1235,7 @@ SG_END_DECL #ifdef __cplusplus XBT_PUBLIC void SMPI_app_instance_start(const char* name, std::function const& code, std::vector const& hosts); +XBT_PUBLIC void SMPI_app_instance_join(const std::string& instance_id); /* This version without parameter is nice to use with SMPI_app_instance_start() */ XBT_PUBLIC void MPI_Init(); diff --git a/src/bindings/python/simgrid_python.cpp b/src/bindings/python/simgrid_python.cpp index 07517ed349..c431875445 100644 --- a/src/bindings/python/simgrid_python.cpp +++ b/src/bindings/python/simgrid_python.cpp @@ -243,6 +243,14 @@ PYBIND11_MODULE(simgrid, m) simgrid::kernel::routing::NetPoint*, simgrid::kernel::routing::NetPoint*, const std::vector&, bool>(&simgrid::s4u::NetZone::add_route), "Add a route between 2 netpoints") + .def("add_route", + py::overload_cast&, bool>(&simgrid::s4u::NetZone::add_route), + "Add a route between 2 netpoints") + .def("add_route", + py::overload_cast&>(&simgrid::s4u::NetZone::add_route), + "Add a route between 2 netpoints") .def("create_host", py::overload_cast(&simgrid::s4u::NetZone::create_host), "Creates a host") .def("create_host", diff --git a/src/kernel/actor/CommObserver.hpp b/src/kernel/actor/CommObserver.hpp index c8e2c8c3fb..ab036510ee 100644 --- a/src/kernel/actor/CommObserver.hpp +++ b/src/kernel/actor/CommObserver.hpp @@ -110,7 +110,7 @@ public: const std::function& clean_fun, // used to free the synchro in case of problem after a detached send const std::function& copy_data_fun, // used to copy data if not default one - void* payload, bool detached, std::string fun_call) + void* payload, bool detached, std::string_view fun_call) : SimcallObserver(actor) , mbox_(mbox) , payload_size_(payload_size) @@ -160,7 +160,7 @@ public: CommIrecvSimcall(ActorImpl* actor, activity::MailboxImpl* mbox, unsigned char* dst_buff, size_t* dst_buff_size, const std::function& match_fun, const std::function& copy_data_fun, void* payload, - double rate, std::string fun_call) + double rate, std::string_view fun_call) : SimcallObserver(actor) , mbox_(mbox) , dst_buff_(dst_buff) diff --git a/src/kernel/xml/sg_platf.cpp b/src/kernel/xml/sg_platf.cpp index b4b4a3294b..3d85fe3a42 100644 --- a/src/kernel/xml/sg_platf.cpp +++ b/src/kernel/xml/sg_platf.cpp @@ -331,7 +331,8 @@ static void sg_platf_new_cluster_flat(simgrid::kernel::routing::ClusterCreationA if (cluster->router_id.empty()) cluster->router_id = cluster->prefix + cluster->id + "_router" + cluster->suffix; auto* router = zone->create_router(cluster->router_id); - zone->add_route(router, nullptr, nullptr, nullptr, {}); + std::vector links; + zone->add_route(router, nullptr, nullptr, nullptr, links); simgrid::kernel::routing::on_cluster_creation(*cluster); } diff --git a/src/mc/api/strategy/UniformStrategy.hpp b/src/mc/api/strategy/UniformStrategy.hpp index 0b665a807b..472c571d3a 100644 --- a/src/mc/api/strategy/UniformStrategy.hpp +++ b/src/mc/api/strategy/UniformStrategy.hpp @@ -48,7 +48,7 @@ public: chosen = xbt::random::uniform_int(0, possibilities-1); for (auto const& [aid, actor] : actors_to_run_) { - if (((not actor.is_todo()) && must_be_todo) || actor.is_done() || (not actor.is_enabled())) + if (((not actor.is_todo()) && must_be_todo) || actor.is_done() || (not actor.is_enabled())) continue; if (chosen == 0) { return std::make_pair(aid, valuation.at(aid)); diff --git a/src/s4u/s4u_ActivitySet.cpp b/src/s4u/s4u_ActivitySet.cpp index abd272d756..4d704206ca 100644 --- a/src/s4u/s4u_ActivitySet.cpp +++ b/src/s4u/s4u_ActivitySet.cpp @@ -11,7 +11,11 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_activityset, s4u_activity, "S4U set of activities"); -namespace simgrid::s4u { +namespace simgrid { + +template class xbt::Extendable; + +namespace s4u { void ActivitySet::erase(ActivityPtr a) { @@ -90,4 +94,5 @@ ActivityPtr ActivitySet::get_failed_activity() return ret; } -}; // namespace simgrid::s4u \ No newline at end of file +} // namespace s4u +} // namespace simgrid diff --git a/src/s4u/s4u_Comm.cpp b/src/s4u/s4u_Comm.cpp index fe134094d3..d88103acea 100644 --- a/src/s4u/s4u_Comm.cpp +++ b/src/s4u/s4u_Comm.cpp @@ -314,12 +314,12 @@ Comm* Comm::do_start() xbt_assert(src_buff_ == nullptr && dst_buff_ == nullptr, "Direct host-to-host communications cannot carry any data."); XBT_DEBUG("host-to-host Comm. Pimpl already created and set, just start it."); - fire_on_start(); - fire_on_this_start(); kernel::actor::simcall_answered([this] { pimpl_->set_state(kernel::activity::State::READY); boost::static_pointer_cast(pimpl_)->start(); }); + fire_on_start(); + fire_on_this_start(); } else if (src_buff_ != nullptr) { // Sender side on_send(*this); on_this_send(*this); diff --git a/src/s4u/s4u_Netzone.cpp b/src/s4u/s4u_Netzone.cpp index 139baf6d36..49b23a0837 100644 --- a/src/s4u/s4u_Netzone.cpp +++ b/src/s4u/s4u_Netzone.cpp @@ -91,6 +91,35 @@ void NetZone::add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoin { pimpl_->add_route(src, dst, gw_src, gw_dst, link_list, symmetrical); } +void NetZone::add_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, + kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst, + const std::vector& links) +{ + std::vector links_direct; + std::vector links_reverse; + for (auto* l : links) { + links_direct.emplace_back(LinkInRoute(l, LinkInRoute::Direction::UP)); + links_reverse.emplace_back(LinkInRoute(l, LinkInRoute::Direction::DOWN)); + } + pimpl_->add_route(src, dst, gw_src, gw_dst, links_direct, false); + pimpl_->add_route(dst, src, gw_dst, gw_src, links_reverse, false); +} + +void NetZone::add_route(const Host* src, const Host* dst, const std::vector& link_list, bool symmetrical) +{ + pimpl_->add_route(src->get_netpoint(), dst->get_netpoint(), nullptr, nullptr, link_list, symmetrical); +} +void NetZone::add_route(const Host* src, const Host* dst, const std::vector& links) +{ + std::vector links_direct; + std::vector links_reverse; + for (auto* l : links) { + links_direct.emplace_back(LinkInRoute(l, LinkInRoute::Direction::UP)); + links_reverse.emplace_back(LinkInRoute(l, LinkInRoute::Direction::DOWN)); + } + pimpl_->add_route(src->get_netpoint(), dst->get_netpoint(), nullptr, nullptr, links_direct, false); + pimpl_->add_route(dst->get_netpoint(), src->get_netpoint(), nullptr, nullptr, links_reverse, false); +} void NetZone::add_bypass_route(kernel::routing::NetPoint* src, kernel::routing::NetPoint* dst, kernel::routing::NetPoint* gw_src, kernel::routing::NetPoint* gw_dst, diff --git a/src/smpi/bindings/smpi_pmpi_comm.cpp b/src/smpi/bindings/smpi_pmpi_comm.cpp index d7efa433d3..c30dfda3e9 100644 --- a/src/smpi/bindings/smpi_pmpi_comm.cpp +++ b/src/smpi/bindings/smpi_pmpi_comm.cpp @@ -6,9 +6,10 @@ #include #include "private.hpp" +#include "simgrid/s4u/Engine.hpp" #include "smpi_comm.hpp" -#include "smpi_info.hpp" #include "smpi_errhandler.hpp" +#include "smpi_info.hpp" #include "src/smpi/include/smpi_actor.hpp" XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi); @@ -248,7 +249,7 @@ int PMPI_Attr_get(MPI_Comm comm, int keyval, void* attr_value, int* flag) { return MPI_SUCCESS; case MPI_UNIVERSE_SIZE: *flag = 1; - universe_size = smpi_get_universe_size(); + universe_size = simgrid::s4u::Engine::get_instance()->get_host_count(); *static_cast(attr_value) = &universe_size; return MPI_SUCCESS; case MPI_LASTUSEDCODE: diff --git a/src/smpi/include/private.hpp b/src/smpi/include/private.hpp index 2133849028..cae46b978d 100644 --- a/src/smpi/include/private.hpp +++ b/src/smpi/include/private.hpp @@ -74,7 +74,6 @@ using MPIR_Dist_Graph_Topology = SMPI_Dist_Graph_topology*; XBT_PRIVATE simgrid::smpi::ActorExt* smpi_process(); XBT_PRIVATE simgrid::smpi::ActorExt* smpi_process_remote(simgrid::s4u::ActorPtr actor); -XBT_PRIVATE int smpi_get_universe_size(); XBT_PRIVATE void smpi_deployment_register_process(const std::string& instance_id, int rank, const simgrid::s4u::Actor* actor); diff --git a/src/smpi/internals/smpi_actor.cpp b/src/smpi/internals/smpi_actor.cpp index 66917b48f3..83bb79837f 100644 --- a/src/smpi/internals/smpi_actor.cpp +++ b/src/smpi/internals/smpi_actor.cpp @@ -224,9 +224,6 @@ int ActorExt::sampling() const void ActorExt::init() { - xbt_assert(smpi_get_universe_size() != 0, "SimGrid was not initialized properly before entering MPI_Init. " - "Aborting, please check compilation process and use smpirun."); - ActorExt* ext = smpi_process(); // if we are in MPI_Init and argc handling has already been done. if (ext->initialized()) diff --git a/src/smpi/internals/smpi_deployment.cpp b/src/smpi/internals/smpi_deployment.cpp index e73865cc55..9c9d7c8bdf 100644 --- a/src/smpi/internals/smpi_deployment.cpp +++ b/src/smpi/internals/smpi_deployment.cpp @@ -15,15 +15,12 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi); namespace simgrid::smpi::app { -static int universe_size = 0; - class Instance { public: explicit Instance(int max_no_processes) : size_(max_no_processes) { auto* group = new simgrid::smpi::Group(size_); comm_world_ = new simgrid::smpi::Comm(group, nullptr, false, -1); - universe_size += max_no_processes; bar_ = s4u::Barrier::create(size_); } s4u::BarrierPtr bar_; @@ -75,6 +72,17 @@ void SMPI_app_instance_start(const char* name, const std::function& code rank++; } } +void SMPI_app_instance_join(const std::string& instance_id) +{ + std::vector actors = + simgrid::s4u::Engine::get_instance()->get_filtered_actors([instance_id](simgrid::s4u::ActorPtr act) { + auto* actor_instance = act->get_property("instance_id"); + return actor_instance != nullptr && strcmp(actor_instance, instance_id.c_str()) == 0; + }); + + for (auto& act : actors) + act->join(); +} void smpi_deployment_register_process(const std::string& instance_id, int rank, const simgrid::s4u::Actor* actor) { @@ -113,11 +121,6 @@ void smpi_deployment_cleanup_instances(){ smpi_instances.clear(); } -int smpi_get_universe_size() -{ - return simgrid::smpi::app::universe_size; -} - /** @brief Auxiliary method to get list of hosts to deploy app */ static std::vector smpi_get_hosts(const simgrid::s4u::Engine* e, const std::string& hostfile) { diff --git a/teshsuite/models/cm02-set-lat-bw/cm02-set-lat-bw.cpp b/teshsuite/models/cm02-set-lat-bw/cm02-set-lat-bw.cpp index 5f2c22e5fc..1751a7d6e5 100644 --- a/teshsuite/models/cm02-set-lat-bw/cm02-set-lat-bw.cpp +++ b/teshsuite/models/cm02-set-lat-bw/cm02-set-lat-bw.cpp @@ -112,11 +112,8 @@ int main(int argc, char** argv) links[name] = zone->create_link(name, 1e9)->set_latency(1e-9)->seal(); } links["L0"] = zone->create_link("L0", 1e3)->seal(); - zone->add_route(hosts["S1"]->get_netpoint(), hosts["C1"]->get_netpoint(), nullptr, nullptr, - {sg4::LinkInRoute(links["L1"]), sg4::LinkInRoute(links["L0"]), sg4::LinkInRoute(links["L2"])}); - zone->add_route(hosts["S2"]->get_netpoint(), hosts["C2"]->get_netpoint(), nullptr, nullptr, - {sg4::LinkInRoute(links["L3"]), sg4::LinkInRoute(links["L0"]), sg4::LinkInRoute(links["L4"])}); - + zone->add_route(hosts["S1"], hosts["C1"], {links["L1"], links["L0"], links["L2"]}); + zone->add_route(hosts["S2"], hosts["C2"], {links["L3"], links["L0"], links["L4"]}); zone->seal(); sg4::Actor::create("", hosts["S1"], sender, "C1", nullptr); diff --git a/teshsuite/models/cm02-tcpgamma/cm02-tcpgamma.cpp b/teshsuite/models/cm02-tcpgamma/cm02-tcpgamma.cpp index 966f54832b..4dfd24f098 100644 --- a/teshsuite/models/cm02-tcpgamma/cm02-tcpgamma.cpp +++ b/teshsuite/models/cm02-tcpgamma/cm02-tcpgamma.cpp @@ -86,7 +86,7 @@ int main(int argc, char** argv) auto const* host1 = zone->create_host("host1", 1e6)->seal(); auto const* host2 = zone->create_host("host2", 1e6)->seal(); auto* testlink = zone->create_link("L1", 1e10)->seal(); - zone->add_route(host1->get_netpoint(), host2->get_netpoint(), nullptr, nullptr, {sg4::LinkInRoute(testlink)}); + zone->add_route(host1, host2, {testlink}); simgrid::s4u::Actor::create("dispatcher", engine.host_by_name("host1"), main_dispatcher, testlink); engine.run(); diff --git a/teshsuite/models/issue105/issue105.cpp b/teshsuite/models/issue105/issue105.cpp index 8268a370ed..940248f4b0 100644 --- a/teshsuite/models/issue105/issue105.cpp +++ b/teshsuite/models/issue105/issue105.cpp @@ -75,8 +75,7 @@ int main(int argc, char* argv[]) ->set_bandwidth_profile(linkSaBandwidthProfile) ->seal(); - world->add_route(hostGl01->get_netpoint(), hostSa01->get_netpoint(), nullptr, nullptr, - {{linkSa, sg4::LinkInRoute::Direction::NONE}}, true); + world->add_route(hostGl01, hostSa01, {{linkSa, sg4::LinkInRoute::Direction::NONE}}, true); world->seal(); sg4::Mailbox* mb1 = e.mailbox_by_name_or_create("Mailbox 1"); diff --git a/teshsuite/models/ptask-subflows/ptask-subflows.cpp b/teshsuite/models/ptask-subflows/ptask-subflows.cpp index 4a134292a3..4cea0bbce5 100644 --- a/teshsuite/models/ptask-subflows/ptask-subflows.cpp +++ b/teshsuite/models/ptask-subflows/ptask-subflows.cpp @@ -47,8 +47,8 @@ int main(int argc, char* argv[]) auto* rootzone = sg4::create_full_zone("root"); auto* hostA = rootzone->create_host("hostA", 1e9); auto* hostB = rootzone->create_host("hostB", 1e9); - sg4::LinkInRoute link(rootzone->create_link("backbone", "1")->set_latency("1s")->seal()); - rootzone->add_route(hostA->get_netpoint(), hostB->get_netpoint(), nullptr, nullptr, {link}, true); + auto* backb = rootzone->create_link("backbone", "1")->set_latency("1s")->seal(); + rootzone->add_route(hostA, hostB, {backb}); rootzone->seal(); sg4::Actor::create("ptask", hostA, ptask, hostA, hostB); diff --git a/teshsuite/python/platform-mix/platform-mix.py b/teshsuite/python/platform-mix/platform-mix.py index a28a5325eb..5bab3cbfe4 100644 --- a/teshsuite/python/platform-mix/platform-mix.py +++ b/teshsuite/python/platform-mix/platform-mix.py @@ -63,8 +63,8 @@ def load_platform(): hosts.append(host2) link1 = dijkstra.create_link("link1_up", [1e9]).set_latency(1e-3).set_concurrency_limit(10).seal() link2 = dijkstra.create_link("link1_down", ["1GBps"]).set_latency("1ms").seal() - dijkstra.add_route(host1.netpoint, host2.netpoint, None, None, [LinkInRoute(link1)], False) - dijkstra.add_route(host2.netpoint, host1.netpoint, None, None, [LinkInRoute(link2)], False) + dijkstra.add_route(host1, host2, [LinkInRoute(link1)], False) + dijkstra.add_route(host2, host1, [LinkInRoute(link2)], False) dijkstra.seal() # vivaldi diff --git a/teshsuite/s4u/comm-fault-scenarios/comm-fault-scenarios.cpp b/teshsuite/s4u/comm-fault-scenarios/comm-fault-scenarios.cpp index 1723741e6b..b996076738 100644 --- a/teshsuite/s4u/comm-fault-scenarios/comm-fault-scenarios.cpp +++ b/teshsuite/s4u/comm-fault-scenarios/comm-fault-scenarios.cpp @@ -409,8 +409,7 @@ int main(int argc, char* argv[]) pr::Profile* profile_link = pr::ProfileBuilder::from_string("link_profile", ctx.link_profile.str(), 0); sg4::Link const* link = zone->create_link("link", LinkBandwidth)->set_latency(LinkLatency)->set_state_profile(profile_link)->seal(); - zone->add_route(sender_host->get_netpoint(), receiver_host->get_netpoint(), nullptr, nullptr, - {sg4::LinkInRoute{link}}, false); + zone->add_route(sender_host, receiver_host, {link}); zone->seal(); sg4::Host::on_onoff_cb([mbox](sg4::Host const& host) { diff --git a/teshsuite/s4u/monkey-masterworkers/monkey-masterworkers.cpp b/teshsuite/s4u/monkey-masterworkers/monkey-masterworkers.cpp index 72bbbec1d8..4a4fca3b71 100644 --- a/teshsuite/s4u/monkey-masterworkers/monkey-masterworkers.cpp +++ b/teshsuite/s4u/monkey-masterworkers/monkey-masterworkers.cpp @@ -114,8 +114,8 @@ int main(int argc, char* argv[]) for (int i = 1; i < cfg_host_count; i++) { auto hostname = "lilibeth " + std::to_string(i); auto* host = rootzone->create_host(hostname, 1e9); - sg4::LinkInRoute link(rootzone->create_link(hostname, "1MBps")->set_latency("24us")->seal()); - rootzone->add_route(master_host->get_netpoint(), host->get_netpoint(), nullptr, nullptr, {link}, true); + auto* link = rootzone->create_link(hostname, "1MBps")->set_latency("24us")->seal(); + rootzone->add_route(master_host, host, {link}); worker_hosts.push_back(host); } rootzone->seal(); diff --git a/teshsuite/s4u/monkey-masterworkers/monkey-masterworkers.py b/teshsuite/s4u/monkey-masterworkers/monkey-masterworkers.py index 26944b7027..863b39244e 100644 --- a/teshsuite/s4u/monkey-masterworkers/monkey-masterworkers.py +++ b/teshsuite/s4u/monkey-masterworkers/monkey-masterworkers.py @@ -92,7 +92,7 @@ if __name__ == '__main__': for i in range(1, host_count): link = rootzone.create_split_duplex_link(f"link {i}", "1MBps").set_latency("24us") host = rootzone.create_host(f"lilibeth {i}", 1e9) - rootzone.add_route(main.netpoint, host.netpoint, None, None, [LinkInRoute(link, LinkInRoute.Direction.UP)], True) + rootzone.add_route(main, host, [link]) Actor.create("worker", host, worker, i).set_auto_restart(True) e.netzone_root.seal() diff --git a/teshsuite/s4u/monkey-semaphore/monkey-semaphore.cpp b/teshsuite/s4u/monkey-semaphore/monkey-semaphore.cpp index 828303af78..6e73575767 100644 --- a/teshsuite/s4u/monkey-semaphore/monkey-semaphore.cpp +++ b/teshsuite/s4u/monkey-semaphore/monkey-semaphore.cpp @@ -116,8 +116,8 @@ int main(int argc, char** argv) auto* rootzone = sg4::create_full_zone("root"); auto* paul = rootzone->create_host("Paul", 1e9); auto* carol = rootzone->create_host("Carol", 1e9); - sg4::LinkInRoute link(rootzone->create_link("link", "1MBps")->set_latency("24us")->seal()); - rootzone->add_route(paul->get_netpoint(), carol->get_netpoint(), nullptr, nullptr, {link}, true); + auto* link = rootzone->create_link("link", "1MBps")->set_latency("24us")->seal(); + rootzone->add_route(paul, carol, {link}); SharedBuffer buffer; sg4::Actor::create("producer", paul, producer, std::ref(buffer))->set_auto_restart(); diff --git a/teshsuite/s4u/seal-platform/seal-platform.cpp b/teshsuite/s4u/seal-platform/seal-platform.cpp index a3315e667f..6d49d7d49a 100644 --- a/teshsuite/s4u/seal-platform/seal-platform.cpp +++ b/teshsuite/s4u/seal-platform/seal-platform.cpp @@ -68,7 +68,7 @@ static sg4::NetZone* create_zone(const sg4::NetZone* root, const std::string& id auto* host = zone->create_host(hostname, 1e9); host->create_disk("disk-" + hostname, 1e9, 1e6); const auto* link = zone->create_link("link-" + hostname, 1e9); - zone->add_route(host->get_netpoint(), router, nullptr, nullptr, {sg4::LinkInRoute(link)}); + zone->add_route(host->get_netpoint(), router, nullptr, nullptr, {link}); } return zone; } diff --git a/tools/jenkins/build.sh b/tools/jenkins/build.sh index 9c8fc76470..a9d9d64f6b 100755 --- a/tools/jenkins/build.sh +++ b/tools/jenkins/build.sh @@ -2,6 +2,13 @@ # This script is used by various build projects on Jenkins +case "$JENKINS_HOME" in +*-qualif) + echo "Build skipped on $JENKINS_HOME." + exit 0 + ;; +esac + # See https://ci.inria.fr/simgrid/job/SimGrid/configure # See https://ci.inria.fr/simgrid/job/Simgrid-Windows/configure