From 9f578fba876983544859e747044eb2d8a3290b40 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Tue, 25 Jul 2023 19:01:00 +0200 Subject: [PATCH] remove Comm::testany() --- ChangeLog | 2 +- MANIFEST.in | 5 -- examples/python/CMakeLists.txt | 2 +- examples/python/comm-testany/comm-testany.py | 72 ------------------- .../python/comm-testany/comm-testany.tesh | 16 ----- include/simgrid/s4u/Comm.hpp | 4 +- src/bindings/python/simgrid_python.cpp | 2 - 7 files changed, 3 insertions(+), 100 deletions(-) delete mode 100644 examples/python/comm-testany/comm-testany.py delete mode 100644 examples/python/comm-testany/comm-testany.tesh diff --git a/ChangeLog b/ChangeLog index cbc20d9791..5e8851bccb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,7 +16,7 @@ SMPI: Python: - Make the host_load plugin available from Python. See examples/python/plugin-host-load - Mailbox::get_async() does not return a pair anymore. Use comm.get_payload() instead. - - Comm::waitall() is gone. Please use ActivitySet() instead. + - Comm::waitall/testany() are gone. Please use ActivitySet() instead. - Comm::waitallfor() is gone too. Its semantic was unclear on timeout anyway. - Io::waitany() and waitanyfor() are gone. Please use ActivitySet() instead. diff --git a/MANIFEST.in b/MANIFEST.in index 0814d5fe90..3a7ca2bbd7 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -73,9 +73,6 @@ include examples/c/comm-wait/comm-wait2_d.xml include examples/c/comm-wait/comm-wait3_d.xml include examples/c/comm-wait/comm-wait4_d.xml include examples/c/comm-wait/comm-wait_d.xml -include examples/c/comm-waitany/comm-waitany.c -include examples/c/comm-waitany/comm-waitany.tesh -include examples/c/comm-waitany/comm-waitany_d.xml include examples/c/dht-kademlia/answer.c include examples/c/dht-kademlia/answer.h include examples/c/dht-kademlia/common.h @@ -457,8 +454,6 @@ include examples/python/comm-ready/comm-ready.py include examples/python/comm-ready/comm-ready.tesh include examples/python/comm-suspend/comm-suspend.py include examples/python/comm-suspend/comm-suspend.tesh -include examples/python/comm-testany/comm-testany.py -include examples/python/comm-testany/comm-testany.tesh include examples/python/comm-throttling/comm-throttling.py include examples/python/comm-throttling/comm-throttling.tesh include examples/python/comm-wait/comm-wait.py diff --git a/examples/python/CMakeLists.txt b/examples/python/CMakeLists.txt index c31f4e43bc..be8db8145f 100644 --- a/examples/python/CMakeLists.txt +++ b/examples/python/CMakeLists.txt @@ -2,7 +2,7 @@ foreach(example actor-create actor-daemon actor-join actor-kill actor-migrate ac activityset-testany activityset-waitall activityset-waitallfor activityset-waitany app-masterworkers comm-wait comm-waitany comm-failure comm-host2host comm-pingpong - comm-ready comm-suspend comm-testany comm-throttling comm-waituntil + comm-ready comm-suspend comm-throttling comm-waituntil exec-async exec-basic exec-dvfs exec-remote exec-ptask task-io task-simple task-switch-host task-variable-load platform-comm-serialize platform-profile platform-failures diff --git a/examples/python/comm-testany/comm-testany.py b/examples/python/comm-testany/comm-testany.py deleted file mode 100644 index 84469b078b..0000000000 --- a/examples/python/comm-testany/comm-testany.py +++ /dev/null @@ -1,72 +0,0 @@ -# Copyright (c) 2010-2023. The SimGrid Team. All rights reserved. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the license (GNU LGPL) which comes with this package. - -from argparse import ArgumentParser -from typing import List -import sys - -from simgrid import Engine, Actor, Comm, Mailbox, this_actor - - -def create_parser() -> ArgumentParser: - parser = ArgumentParser() - parser.add_argument( - '--platform', - type=str, - required=True, - help='path to the platform description' - ) - return parser - - -def rank0(): - rank0_mailbox: Mailbox = Mailbox.by_name("rank0") - this_actor.info("Post my asynchronous receives") - comm1 = rank0_mailbox.get_async() - comm2 = rank0_mailbox.get_async() - comm3 = rank0_mailbox.get_async() - pending_comms: List[Comm] = [comm1, comm2, comm3] - - this_actor.info("Send some data to rank-1") - rank1_mailbox: Mailbox = Mailbox.by_name("rank1") - for i in range(3): - rank1_mailbox.put(i, 1) - - this_actor.info("Test for completed comms") - while pending_comms: - flag = Comm.test_any(pending_comms) - if flag != -1: - pending_comms.pop(flag) - this_actor.info("Remove a pending comm.") - else: - # Nothing matches, wait for a little bit - this_actor.sleep_for(0.1) - this_actor.info("Last comm is complete") - - -def rank1(): - rank0_mailbox: Mailbox = Mailbox.by_name("rank0") - rank1_mailbox: Mailbox = Mailbox.by_name("rank1") - for i in range(3): - data: int = rank1_mailbox.get() - this_actor.info(f"Received {data}") - msg_content = f"Message {i}" - this_actor.info(f"Send '{msg_content}'") - rank0_mailbox.put(msg_content, int(1e6)) - - -def main(): - settings = create_parser().parse_known_args()[0] - e = Engine(sys.argv) - e.load_platform(settings.platform) - - Actor.create("rank0", e.host_by_name("Tremblay"), rank0) - Actor.create("rank1", e.host_by_name("Fafard"), rank1) - - e.run() - - -if __name__ == "__main__": - main() diff --git a/examples/python/comm-testany/comm-testany.tesh b/examples/python/comm-testany/comm-testany.tesh deleted file mode 100644 index 83d80f118b..0000000000 --- a/examples/python/comm-testany/comm-testany.tesh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env tesh - -$ ${pythoncmd:=python3} ${PYTHON_TOOL_OPTIONS:=} ${bindir:=.}/comm-testany.py --platform ${platfdir}/small_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%a@%h)%e%m%n" ->[ 0.000000] (1:rank0@Tremblay) Post my asynchronous receives ->[ 0.000000] (1:rank0@Tremblay) Send some data to rank-1 ->[ 0.025708] (2:rank1@Fafard) Received 0 ->[ 0.025708] (2:rank1@Fafard) Send 'Message 0' ->[ 0.209813] (2:rank1@Fafard) Received 1 ->[ 0.209813] (2:rank1@Fafard) Send 'Message 1' ->[ 0.393918] (1:rank0@Tremblay) Test for completed comms ->[ 0.393918] (2:rank1@Fafard) Received 2 ->[ 0.393918] (2:rank1@Fafard) Send 'Message 2' ->[ 0.393918] (1:rank0@Tremblay) Remove a pending comm. ->[ 0.393918] (1:rank0@Tremblay) Remove a pending comm. ->[ 0.593918] (1:rank0@Tremblay) Remove a pending comm. ->[ 0.593918] (1:rank0@Tremblay) Last comm is complete diff --git a/include/simgrid/s4u/Comm.hpp b/include/simgrid/s4u/Comm.hpp index 65bbbb3d7e..f730cf0356 100644 --- a/include/simgrid/s4u/Comm.hpp +++ b/include/simgrid/s4u/Comm.hpp @@ -184,15 +184,13 @@ public: Comm* wait_for(double timeout) override; - /*! \static take a vector s4u::CommPtr and return the rank of the first finished one (or -1 if none is done). */ - static ssize_t test_any(const std::vector& comms); - #ifndef DOXYGEN static ssize_t wait_any(const std::vector& comms) { return deprecated_wait_any_for(comms, -1); } static ssize_t wait_any_for(const std::vector& comms, double timeout) { return deprecated_wait_any_for(comms, timeout); } static ssize_t deprecated_wait_any_for(const std::vector& comms, double timeout); + XBT_ATTRIB_DEPRECATED_v339("Please use ActivitySet instead") static ssize_t test_any(const std::vector& comms); XBT_ATTRIB_DEPRECATED_v339("Please use ActivitySet instead") static void wait_all(const std::vector& comms); XBT_ATTRIB_DEPRECATED_v339("Please use ActivitySet instead") static size_t wait_all_for(const std::vector& comms, double timeout); diff --git a/src/bindings/python/simgrid_python.cpp b/src/bindings/python/simgrid_python.cpp index 8722bf4d83..d59e9c513a 100644 --- a/src/bindings/python/simgrid_python.cpp +++ b/src/bindings/python/simgrid_python.cpp @@ -690,8 +690,6 @@ PYBIND11_MODULE(simgrid, m) "Do a blocking communication between two arbitrary hosts.\n\nThis initializes a communication that " "completely bypass the mailbox and actors mechanism. There is really no limit on the hosts involved. " "In particular, the actor does not have to be on one of the involved hosts.") - .def_static("test_any", &Comm::test_any, py::call_guard(), py::arg("comms"), - "take a vector s4u::CommPtr and return the rank of the first finished one (or -1 if none is done)") .def_static("wait_any", &Comm::wait_any, py::call_guard(), py::arg("comms"), "Block until the completion of any communication in the list and return the index of the " "terminated one.") -- 2.20.1