+ migrate_to_host = lb.get_mapping(simgrid::s4u::Actor::self());
+ if (cur_host != migrate_to_host) { // Origin and dest are not the same -> migrate
+ std::vector<simgrid::s4u::Host*> migration_hosts = {cur_host, migrate_to_host};
+ std::vector<double> comp_amount = {0, 0};
+ std::vector<double> comm_amount = {0, /*must not be 0*/ std::max(args.memory_consumption, 1.0), 0, 0};
+
+ xbt_os_timer_t timer = smpi_process()->timer();
+ xbt_os_threadtimer_start(timer);
+ simgrid::s4u::this_actor::parallel_execute(migration_hosts, comp_amount, comm_amount, -1.0);
+ xbt_os_threadtimer_stop(timer);
+ smpi_execute(xbt_os_timer_elapsed(timer));
+
+ // Update the process and host mapping in SimGrid.
+ XBT_DEBUG("Migrating process %li from %s to %s", my_proc_id, cur_host->get_cname(), migrate_to_host->get_cname());
+ TRACE_smpi_process_change_host(my_proc_id, migrate_to_host);
+ simgrid::s4u::this_actor::migrate(migrate_to_host);
+ }
+
+ smpilb_bar.wait();
+
+ smpi_bench_begin();
+ }
+};
+
+/******************************************************************************
+ * Code to include the duration of iterations in the trace. *
+ ******************************************************************************/
+
+// FIXME Move declaration
+XBT_PRIVATE void action_iteration_in(simgrid::xbt::ReplayAction& action);
+void action_iteration_in(simgrid::xbt::ReplayAction& action)
+{
+ CHECK_ACTION_PARAMS(action, 0, 0)
+ TRACE_Iteration_in(simgrid::s4u::this_actor::get_pid(), nullptr);
+ simgrid::smpi::plugin::ampi::on_iteration_in(MPI_COMM_WORLD->group()->actor(std::stol(action[0])));
+}
+
+XBT_PRIVATE void action_iteration_out(simgrid::xbt::ReplayAction& action);
+void action_iteration_out(simgrid::xbt::ReplayAction& action)
+{
+ CHECK_ACTION_PARAMS(action, 0, 0)
+ TRACE_Iteration_out(simgrid::s4u::this_actor::get_pid(), nullptr);
+ simgrid::smpi::plugin::ampi::on_iteration_out(MPI_COMM_WORLD->group()->actor(std::stol(action[0])));
+}