From 8e63f98af579c9274d246036863bd4565e1dbc7f Mon Sep 17 00:00:00 2001 From: Henri Casanova Date: Sun, 15 Oct 2023 22:26:49 -1000 Subject: [PATCH] Only using recyclable mailboxes --- src/wrench/action/MPIAction.cpp | 4 +++- src/wrench/simgrid_S4U_util/S4U_Daemon.cpp | 14 +++++++++++--- .../BareMetalComputeServiceHostFailuresTest.cpp | 3 ++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/wrench/action/MPIAction.cpp b/src/wrench/action/MPIAction.cpp index b9a947013e..ca60deb594 100644 --- a/src/wrench/action/MPIAction.cpp +++ b/src/wrench/action/MPIAction.cpp @@ -81,9 +81,11 @@ namespace wrench { auto barrier = simgrid::s4u::Barrier::create(1 + simgrid_hosts.size()); // Start actors auto meta_lambda = [this](const std::shared_ptr &action_executor) { - S4U_Daemon::map_actor_to_recv_mailbox[simgrid::s4u::this_actor::get_pid()] = S4U_Mailbox::generateUniqueMailbox("rmb"); + auto mailbox = S4U_Mailbox::getTemporaryMailbox(); + S4U_Daemon::map_actor_to_recv_mailbox[simgrid::s4u::this_actor::get_pid()] = mailbox; this->lambda_mpi(action_executor); S4U_Daemon::map_actor_to_recv_mailbox.erase(simgrid::s4u::this_actor::get_pid()); + S4U_Mailbox::retireTemporaryMailbox(mailbox); }; SMPI_app_instance_start(("MPI_Action_" + std::to_string(simgrid::s4u::this_actor::get_pid())).c_str(), diff --git a/src/wrench/simgrid_S4U_util/S4U_Daemon.cpp b/src/wrench/simgrid_S4U_util/S4U_Daemon.cpp index 30761265ee..1c6d6849de 100755 --- a/src/wrench/simgrid_S4U_util/S4U_Daemon.cpp +++ b/src/wrench/simgrid_S4U_util/S4U_Daemon.cpp @@ -75,9 +75,14 @@ namespace wrench { this->host = S4U_Simulation::get_host_or_vm_by_name(hostname); this->simulation = nullptr; unsigned long seq = S4U_Mailbox::generateUniqueSequenceNumber(); - this->mailbox = S4U_Mailbox::generateUniqueMailbox("mb"); - this->recv_mailbox = S4U_Mailbox::generateUniqueMailbox("rmb"); this->process_name = process_name_prefix + "_" + std::to_string(seq); + +// this->mailbox = S4U_Mailbox::generateUniqueMailbox("mb"); +// this->recv_mailbox = S4U_Mailbox::generateUniqueMailbox("rmb"); + + this->mailbox = S4U_Mailbox::getTemporaryMailbox(); + this->recv_mailbox = S4U_Mailbox::getTemporaryMailbox(); + this->has_returned_from_main = false; // std::cerr << "IN DAEMON CONSTRUCTOR: " << this->process_name << "\n"; @@ -265,8 +270,11 @@ namespace wrench { this->has_returned_from_main = true; this->state = State::DOWN; S4U_Daemon::map_actor_to_recv_mailbox.erase(simgrid::s4u::this_actor::get_pid()); + this->mailbox->set_receiver(nullptr); - // this->recv_mailbox->set_receiver(nullptr); + S4U_Mailbox::retireTemporaryMailbox(this->mailbox); + this->recv_mailbox->set_receiver(nullptr); + S4U_Mailbox::retireTemporaryMailbox(this->recv_mailbox); } diff --git a/test/simulated_failures/host_failures/BareMetalComputeServiceHostFailuresTest.cpp b/test/simulated_failures/host_failures/BareMetalComputeServiceHostFailuresTest.cpp index ef8200c32b..272768239c 100755 --- a/test/simulated_failures/host_failures/BareMetalComputeServiceHostFailuresTest.cpp +++ b/test/simulated_failures/host_failures/BareMetalComputeServiceHostFailuresTest.cpp @@ -421,11 +421,12 @@ void BareMetalComputeServiceHostFailuresTest::do_BareMetalComputeServiceRandomFa // Create and initialize a simulation auto simulation = wrench::Simulation::createSimulation(); - int argc = 3; + int argc = 4; auto argv = (char **) calloc(argc, sizeof(char *)); argv[0] = strdup("unit_test"); argv[1] = strdup("--wrench-host-shutdown-simulation"); argv[2] = strdup("--cfg=contexts/stack-size:100"); + argv[3] = strdup("--wrench-mailbox-pool-size=20000"); // argv[2] = strdup("--wrench-full-logs"); simulation->init(&argc, argv);