Skip to content

Commit

Permalink
Only using recyclable mailboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
henricasanova committed Oct 16, 2023
1 parent 16a7911 commit 8e63f98
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/wrench/action/MPIAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ActionExecutor> &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(),
Expand Down
14 changes: 11 additions & 3 deletions src/wrench/simgrid_S4U_util/S4U_Daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8e63f98

Please sign in to comment.