Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Allow to call SMPI_app_instance_start() once the simulation started
[simgrid.git] / examples / smpi / smpi_s4u_masterworker / masterworker_mailbox_smpi.cpp
index a76fa88..0539a00 100644 (file)
@@ -116,11 +116,18 @@ int main(int argc, char* argv[])
   SMPI_app_instance_register("master_mpi", master_mpi, 2);
   e.load_deployment(argv[2]);
   // the second performing an alltoall on 4 nodes, started directly, not from the deployment file
-  auto all_hosts = e.get_all_hosts();
   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")});
 
+  // Start a third MPI application, from a S4U actor after a delay of 10 sec
+  simgrid::s4u::Actor::create("launcher", e.host_by_name_or_null("Ginette"), [&e]() {
+    simgrid::s4u::this_actor::sleep_for(10);
+    XBT_INFO("Start another alltoall_mpi instance");
+    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")});
+  });
   e.run();
 
   XBT_INFO("Simulation time %g", simgrid::s4u::Engine::get_clock());