3 // FIXME: could cause trouble with multithreaded procs on same host...
4 void smpi_bench_begin()
6 int rank = smpi_mpi_comm_rank_self(smpi_mpi_global->mpi_comm_world);
7 SIMIX_mutex_lock(smpi_global->timers_mutexes[rank]);
8 xbt_os_timer_start(smpi_global->timers[rank]);
14 int rank = smpi_mpi_comm_rank_self(smpi_mpi_global->mpi_comm_world);
17 smx_action_t compute_action;
21 xbt_os_timer_stop(smpi_global->timers[rank]);
23 duration = xbt_os_timer_elapsed(smpi_global->timers[rank]);
24 SIMIX_mutex_unlock(smpi_global->timers_mutexes[rank]);
26 host = smpi_mpi_global->mpi_comm_world->simdata->hosts[rank];
27 compute_action = SIMIX_action_execute(host, NULL, duration * SMPI_DEFAULT_SPEED);
28 mutex = SIMIX_mutex_init();
29 cond = SIMIX_cond_init();
31 SIMIX_mutex_lock(mutex);
32 SIMIX_register_action_to_condition(compute_action, cond);
33 SIMIX_cond_wait(cond, mutex);
34 SIMIX_unregister_action_to_condition(compute_action, cond);
35 SIMIX_mutex_unlock(mutex);
37 SIMIX_mutex_destroy(mutex);
38 SIMIX_cond_destroy(cond);
40 // FIXME: check for success/failure?