void smpi_global_init(void);
void smpi_global_destroy(void);
int smpi_host_index(void);
-int smpi_run_simulation(int argc, char **argv);
+int smpi_run_simulation(int *argc, char **argv);
int smpi_create_request(void *buf, int count, smpi_mpi_datatype_t datatype,
int src, int dst, int tag, smpi_mpi_communicator_t comm, smpi_mpi_request_t *request);
SIMIX_register_action_to_condition(action, smpi_global->timer_cond);
SIMIX_cond_wait(smpi_global->timer_cond, smpi_global->timer_mutex);
SIMIX_unregister_action_to_condition(action, smpi_global->timer_cond);
+ SIMIX_action_destroy(action);
SIMIX_mutex_unlock(smpi_global->timer_mutex);
SIMIX_mutex_lock(smpi_global->timer_mutex);
host = SIMIX_host_self();
- action = SIMIX_action_execute(host, "computation", duration * SMPI_DEFAULT_SPEED);
+ action = SIMIX_action_execute(host, "computation", duration * SMPI_DEFAULT_SPEED);
SIMIX_register_action_to_condition(action, smpi_global->timer_cond);
SIMIX_cond_wait(smpi_global->timer_cond, smpi_global->timer_mutex);
SIMIX_unregister_action_to_condition(action, smpi_global->timer_cond);
+ SIMIX_action_destroy(action);
SIMIX_mutex_unlock(smpi_global->timer_mutex);
return hdata->index;
}
-int smpi_run_simulation(int argc, char **argv)
+int smpi_run_simulation(int *argc, char **argv)
{
xbt_fifo_item_t cond_item = NULL;
smx_cond_t cond = NULL;
srand(SMPI_RAND_SEED);
- SIMIX_global_init(&argc, argv);
+ SIMIX_global_init(argc, argv);
SIMIX_function_register("smpi_simulated_main", smpi_simulated_main);
SIMIX_function_register("smpi_sender", smpi_sender);
SIMIX_register_action_to_condition(action, request->cond);
SIMIX_cond_wait(request->cond, request->mutex);
SIMIX_unregister_action_to_condition(action, request->cond);
+ SIMIX_action_destroy(action);
SIMIX_mutex_unlock(request->mutex);
unsigned int smpi_sleep(unsigned int seconds)
{
- smx_mutex_t mutex;
- smx_cond_t cond;
smx_host_t host;
smx_action_t action;
smpi_bench_end();
- host = SIMIX_host_self();
+
+ host = SIMIX_host_self();
+
+ SIMIX_mutex_lock(smpi_global->timer_mutex);
+
action = SIMIX_action_sleep(host, seconds);
- mutex = SIMIX_mutex_init();
- cond = SIMIX_cond_init();
-
- SIMIX_mutex_lock(mutex);
- SIMIX_register_action_to_condition(action, cond);
- SIMIX_cond_wait(cond, mutex);
- SIMIX_unregister_action_to_condition(action, cond);
- SIMIX_mutex_unlock(mutex);
-
- SIMIX_mutex_destroy(mutex);
- SIMIX_cond_destroy(cond);
- //SIMIX_action_destroy(action);
+
+ SIMIX_register_action_to_condition(action, smpi_global->timer_cond);
+ SIMIX_cond_wait(smpi_global->timer_cond, smpi_global->timer_mutex);
+ SIMIX_unregister_action_to_condition(action, smpi_global->timer_cond);
+ SIMIX_action_destroy(action);
+
+ SIMIX_mutex_unlock(smpi_global->timer_mutex);
smpi_bench_begin();
return 0;