+ migrate_to_host = lb.get_mapping();
+ if (cur_host != migrate_to_host) { // Origin and dest are not the same -> migrate
+ sg_host_t migration_hosts[2] = {cur_host, migrate_to_host};
+ // Changing this to double[2] ... will cause trouble with parallel_execute, because that fct is trying to call free().
+ double* comp_amount = new double[2]{0, 0};
+ double* comm_amount = new double[4]{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(2, 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.
+ 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])));
+}