Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
remove Comm::testany()
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Tue, 25 Jul 2023 17:01:00 +0000 (19:01 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Tue, 25 Jul 2023 17:01:58 +0000 (19:01 +0200)
ChangeLog
MANIFEST.in
examples/python/CMakeLists.txt
examples/python/comm-testany/comm-testany.py [deleted file]
examples/python/comm-testany/comm-testany.tesh [deleted file]
include/simgrid/s4u/Comm.hpp
src/bindings/python/simgrid_python.cpp

index cbc20d9..5e8851b 100644 (file)
--- 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.
 
index 0814d5f..3a7ca2b 100644 (file)
@@ -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
index c31f4e4..be8db81 100644 (file)
@@ -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 (file)
index 84469b0..0000000
+++ /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 (file)
index 83d80f1..0000000
+++ /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
index 65bbbb3..f730cf0 100644 (file)
@@ -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<CommPtr>& comms);
-
 #ifndef DOXYGEN
   static ssize_t wait_any(const std::vector<CommPtr>& comms) { return deprecated_wait_any_for(comms, -1); }
   static ssize_t wait_any_for(const std::vector<CommPtr>& comms, double timeout) { return deprecated_wait_any_for(comms, timeout); }
 
   static ssize_t deprecated_wait_any_for(const std::vector<CommPtr>& comms, double timeout);
 
+  XBT_ATTRIB_DEPRECATED_v339("Please use ActivitySet instead") static ssize_t test_any(const std::vector<CommPtr>& comms);
   XBT_ATTRIB_DEPRECATED_v339("Please use ActivitySet instead") static void wait_all(const std::vector<CommPtr>& comms);
   XBT_ATTRIB_DEPRECATED_v339("Please use ActivitySet instead") static size_t
       wait_all_for(const std::vector<CommPtr>& comms, double timeout);
index 8722bf4..d59e9c5 100644 (file)
@@ -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::gil_scoped_release>(), 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::gil_scoped_release>(), py::arg("comms"),
                   "Block until the completion of any communication in the list and return the index of the "
                   "terminated one.")