From e798113213523f9bafbcb59805ed2545a3716261 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Wed, 22 Jul 2015 01:17:46 +0200 Subject: [PATCH] Simplify the process_execute simcall Don't pass the host on which it has to run, as everybody pass SIMIX_process_self(). Get the inner layers guess that themselves. (also move a bunch of simcalls in the definition file. Sorry for the noise) --- include/simgrid/simix.h | 2 +- src/msg/msg_gos.c | 1 - src/simix/libsmx.c | 4 +- src/simix/popping_accessors.h | 377 ++++++++++++++-------------- src/simix/popping_bodies.c | 449 +++++++++++++++++----------------- src/simix/popping_enum.h | 20 +- src/simix/popping_generated.c | 118 ++++----- src/simix/simcalls.in | 22 +- src/simix/smx_host.c | 19 +- src/simix/smx_host_private.h | 4 +- src/simix/smx_process.c | 2 +- src/smpi/smpi_bench.c | 4 +- 12 files changed, 509 insertions(+), 513 deletions(-) diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index 2d414f813b..6bc2e58803 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -321,7 +321,7 @@ XBT_PUBLIC(double) simcall_host_get_consumed_energy(sg_host_t host); XBT_PUBLIC(double) simcall_host_get_wattmin_at(sg_host_t host, int pstate); XBT_PUBLIC(double) simcall_host_get_wattmax_at(sg_host_t host, int pstate); -XBT_PUBLIC(smx_synchro_t) simcall_process_execute(const char *name, sg_host_t host, +XBT_PUBLIC(smx_synchro_t) simcall_process_execute(const char *name, double flops_amount, double priority, double bound, unsigned long affinity_mask); XBT_PUBLIC(smx_synchro_t) simcall_process_parallel_execute(const char *name, diff --git a/src/msg/msg_gos.c b/src/msg/msg_gos.c index 9cb139c20d..92e78159db 100644 --- a/src/msg/msg_gos.c +++ b/src/msg/msg_gos.c @@ -85,7 +85,6 @@ msg_error_t MSG_parallel_task_execute(msg_task_t task) XBT_DEBUG("execute %s@%s with affinity(0x%04lx)", MSG_task_get_name(task), MSG_host_get_name(p_simdata->m_host), affinity_mask); simdata->compute = simcall_process_execute(task->name, - p_simdata->m_host, simdata->flops_amount, simdata->priority, simdata->bound, diff --git a/src/simix/libsmx.c b/src/simix/libsmx.c index e39e2d57e9..9dbb56f375 100644 --- a/src/simix/libsmx.c +++ b/src/simix/libsmx.c @@ -242,7 +242,7 @@ double simcall_host_get_wattmax_at(msg_host_t host, int pstate){ * \param affinity_mask * \return A new SIMIX execution synchronization */ -smx_synchro_t simcall_process_execute(const char *name, sg_host_t host, +smx_synchro_t simcall_process_execute(const char *name, double flops_amount, double priority, double bound, unsigned long affinity_mask) { @@ -250,7 +250,7 @@ smx_synchro_t simcall_process_execute(const char *name, sg_host_t host, xbt_assert(isfinite(flops_amount), "flops_amount is not finite!"); xbt_assert(isfinite(priority), "priority is not finite!"); - return simcall_BODY_process_execute(name, host, flops_amount, priority, bound, affinity_mask); + return simcall_BODY_process_execute(name, flops_amount, priority, bound, affinity_mask); } /** diff --git a/src/simix/popping_accessors.h b/src/simix/popping_accessors.h index 0437433e59..b2aaa30fb0 100644 --- a/src/simix/popping_accessors.h +++ b/src/simix/popping_accessors.h @@ -241,196 +241,6 @@ static inline void simcall_host_get_consumed_energy__set__result(smx_simcall_t s simcall->result.d = result; } -static inline const char* simcall_process_execute__get__name(smx_simcall_t simcall) { - return simcall->args[0].cc; -} -static inline void simcall_process_execute__set__name(smx_simcall_t simcall, const char* arg) { - simcall->args[0].cc = arg; -} -static inline sg_host_t simcall_process_execute__get__host(smx_simcall_t simcall) { - return (sg_host_t) simcall->args[1].dp; -} -static inline void simcall_process_execute__set__host(smx_simcall_t simcall, void* arg) { - simcall->args[1].dp = arg; -} -static inline double simcall_process_execute__get__flops_amount(smx_simcall_t simcall) { - return simcall->args[2].d; -} -static inline void simcall_process_execute__set__flops_amount(smx_simcall_t simcall, double arg) { - simcall->args[2].d = arg; -} -static inline double simcall_process_execute__get__priority(smx_simcall_t simcall) { - return simcall->args[3].d; -} -static inline void simcall_process_execute__set__priority(smx_simcall_t simcall, double arg) { - simcall->args[3].d = arg; -} -static inline double simcall_process_execute__get__bound(smx_simcall_t simcall) { - return simcall->args[4].d; -} -static inline void simcall_process_execute__set__bound(smx_simcall_t simcall, double arg) { - simcall->args[4].d = arg; -} -static inline unsigned long simcall_process_execute__get__affinity_mask(smx_simcall_t simcall) { - return simcall->args[5].ul; -} -static inline void simcall_process_execute__set__affinity_mask(smx_simcall_t simcall, unsigned long arg) { - simcall->args[5].ul = arg; -} -static inline smx_synchro_t simcall_process_execute__get__result(smx_simcall_t simcall){ - return (smx_synchro_t) simcall->result.dp; -} -static inline void simcall_process_execute__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} - -static inline const char* simcall_process_parallel_execute__get__name(smx_simcall_t simcall) { - return simcall->args[0].cc; -} -static inline void simcall_process_parallel_execute__set__name(smx_simcall_t simcall, const char* arg) { - simcall->args[0].cc = arg; -} -static inline int simcall_process_parallel_execute__get__host_nb(smx_simcall_t simcall) { - return simcall->args[1].i; -} -static inline void simcall_process_parallel_execute__set__host_nb(smx_simcall_t simcall, int arg) { - simcall->args[1].i = arg; -} -static inline sg_host_t* simcall_process_parallel_execute__get__host_list(smx_simcall_t simcall) { - return (sg_host_t*) simcall->args[2].dp; -} -static inline void simcall_process_parallel_execute__set__host_list(smx_simcall_t simcall, void* arg) { - simcall->args[2].dp = arg; -} -static inline double* simcall_process_parallel_execute__get__flops_amount(smx_simcall_t simcall) { - return (double*) simcall->args[3].dp; -} -static inline void simcall_process_parallel_execute__set__flops_amount(smx_simcall_t simcall, void* arg) { - simcall->args[3].dp = arg; -} -static inline double* simcall_process_parallel_execute__get__bytes_amount(smx_simcall_t simcall) { - return (double*) simcall->args[4].dp; -} -static inline void simcall_process_parallel_execute__set__bytes_amount(smx_simcall_t simcall, void* arg) { - simcall->args[4].dp = arg; -} -static inline double simcall_process_parallel_execute__get__amount(smx_simcall_t simcall) { - return simcall->args[5].d; -} -static inline void simcall_process_parallel_execute__set__amount(smx_simcall_t simcall, double arg) { - simcall->args[5].d = arg; -} -static inline double simcall_process_parallel_execute__get__rate(smx_simcall_t simcall) { - return simcall->args[6].d; -} -static inline void simcall_process_parallel_execute__set__rate(smx_simcall_t simcall, double arg) { - simcall->args[6].d = arg; -} -static inline smx_synchro_t simcall_process_parallel_execute__get__result(smx_simcall_t simcall){ - return (smx_synchro_t) simcall->result.dp; -} -static inline void simcall_process_parallel_execute__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} - -static inline smx_synchro_t simcall_process_execution_destroy__get__execution(smx_simcall_t simcall) { - return (smx_synchro_t) simcall->args[0].dp; -} -static inline void simcall_process_execution_destroy__set__execution(smx_simcall_t simcall, void* arg) { - simcall->args[0].dp = arg; -} - -static inline smx_synchro_t simcall_process_execution_cancel__get__execution(smx_simcall_t simcall) { - return (smx_synchro_t) simcall->args[0].dp; -} -static inline void simcall_process_execution_cancel__set__execution(smx_simcall_t simcall, void* arg) { - simcall->args[0].dp = arg; -} - -static inline smx_synchro_t simcall_process_execution_get_remains__get__execution(smx_simcall_t simcall) { - return (smx_synchro_t) simcall->args[0].dp; -} -static inline void simcall_process_execution_get_remains__set__execution(smx_simcall_t simcall, void* arg) { - simcall->args[0].dp = arg; -} -static inline double simcall_process_execution_get_remains__get__result(smx_simcall_t simcall){ - return simcall->result.d; -} -static inline void simcall_process_execution_get_remains__set__result(smx_simcall_t simcall, double result){ - simcall->result.d = result; -} - -static inline smx_synchro_t simcall_process_execution_get_state__get__execution(smx_simcall_t simcall) { - return (smx_synchro_t) simcall->args[0].dp; -} -static inline void simcall_process_execution_get_state__set__execution(smx_simcall_t simcall, void* arg) { - simcall->args[0].dp = arg; -} -static inline e_smx_state_t simcall_process_execution_get_state__get__result(smx_simcall_t simcall){ - return (e_smx_state_t) simcall->result.i; -} -static inline void simcall_process_execution_get_state__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} - -static inline smx_synchro_t simcall_process_execution_set_priority__get__execution(smx_simcall_t simcall) { - return (smx_synchro_t) simcall->args[0].dp; -} -static inline void simcall_process_execution_set_priority__set__execution(smx_simcall_t simcall, void* arg) { - simcall->args[0].dp = arg; -} -static inline double simcall_process_execution_set_priority__get__priority(smx_simcall_t simcall) { - return simcall->args[1].d; -} -static inline void simcall_process_execution_set_priority__set__priority(smx_simcall_t simcall, double arg) { - simcall->args[1].d = arg; -} - -static inline smx_synchro_t simcall_process_execution_set_bound__get__execution(smx_simcall_t simcall) { - return (smx_synchro_t) simcall->args[0].dp; -} -static inline void simcall_process_execution_set_bound__set__execution(smx_simcall_t simcall, void* arg) { - simcall->args[0].dp = arg; -} -static inline double simcall_process_execution_set_bound__get__bound(smx_simcall_t simcall) { - return simcall->args[1].d; -} -static inline void simcall_process_execution_set_bound__set__bound(smx_simcall_t simcall, double arg) { - simcall->args[1].d = arg; -} - -static inline smx_synchro_t simcall_process_execution_set_affinity__get__execution(smx_simcall_t simcall) { - return (smx_synchro_t) simcall->args[0].dp; -} -static inline void simcall_process_execution_set_affinity__set__execution(smx_simcall_t simcall, void* arg) { - simcall->args[0].dp = arg; -} -static inline sg_host_t simcall_process_execution_set_affinity__get__ws(smx_simcall_t simcall) { - return (sg_host_t) simcall->args[1].dp; -} -static inline void simcall_process_execution_set_affinity__set__ws(smx_simcall_t simcall, void* arg) { - simcall->args[1].dp = arg; -} -static inline unsigned long simcall_process_execution_set_affinity__get__mask(smx_simcall_t simcall) { - return simcall->args[2].ul; -} -static inline void simcall_process_execution_set_affinity__set__mask(smx_simcall_t simcall, unsigned long arg) { - simcall->args[2].ul = arg; -} - -static inline smx_synchro_t simcall_process_execution_wait__get__execution(smx_simcall_t simcall) { - return (smx_synchro_t) simcall->args[0].dp; -} -static inline void simcall_process_execution_wait__set__execution(smx_simcall_t simcall, void* arg) { - simcall->args[0].dp = arg; -} -static inline int simcall_process_execution_wait__get__result(smx_simcall_t simcall){ - return simcall->result.i; -} -static inline void simcall_process_execution_wait__set__result(smx_simcall_t simcall, int result){ - simcall->result.i = result; -} - static inline sg_host_t simcall_host_get_mounted_storage_list__get__host(smx_simcall_t simcall) { return (sg_host_t) simcall->args[0].dp; } @@ -893,6 +703,190 @@ static inline void simcall_process_sleep__set__result(smx_simcall_t simcall, int simcall->result.i = result; } +static inline const char* simcall_process_execute__get__name(smx_simcall_t simcall) { + return simcall->args[0].cc; +} +static inline void simcall_process_execute__set__name(smx_simcall_t simcall, const char* arg) { + simcall->args[0].cc = arg; +} +static inline double simcall_process_execute__get__flops_amount(smx_simcall_t simcall) { + return simcall->args[1].d; +} +static inline void simcall_process_execute__set__flops_amount(smx_simcall_t simcall, double arg) { + simcall->args[1].d = arg; +} +static inline double simcall_process_execute__get__priority(smx_simcall_t simcall) { + return simcall->args[2].d; +} +static inline void simcall_process_execute__set__priority(smx_simcall_t simcall, double arg) { + simcall->args[2].d = arg; +} +static inline double simcall_process_execute__get__bound(smx_simcall_t simcall) { + return simcall->args[3].d; +} +static inline void simcall_process_execute__set__bound(smx_simcall_t simcall, double arg) { + simcall->args[3].d = arg; +} +static inline unsigned long simcall_process_execute__get__affinity_mask(smx_simcall_t simcall) { + return simcall->args[4].ul; +} +static inline void simcall_process_execute__set__affinity_mask(smx_simcall_t simcall, unsigned long arg) { + simcall->args[4].ul = arg; +} +static inline smx_synchro_t simcall_process_execute__get__result(smx_simcall_t simcall){ + return (smx_synchro_t) simcall->result.dp; +} +static inline void simcall_process_execute__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline const char* simcall_process_parallel_execute__get__name(smx_simcall_t simcall) { + return simcall->args[0].cc; +} +static inline void simcall_process_parallel_execute__set__name(smx_simcall_t simcall, const char* arg) { + simcall->args[0].cc = arg; +} +static inline int simcall_process_parallel_execute__get__host_nb(smx_simcall_t simcall) { + return simcall->args[1].i; +} +static inline void simcall_process_parallel_execute__set__host_nb(smx_simcall_t simcall, int arg) { + simcall->args[1].i = arg; +} +static inline sg_host_t* simcall_process_parallel_execute__get__host_list(smx_simcall_t simcall) { + return (sg_host_t*) simcall->args[2].dp; +} +static inline void simcall_process_parallel_execute__set__host_list(smx_simcall_t simcall, void* arg) { + simcall->args[2].dp = arg; +} +static inline double* simcall_process_parallel_execute__get__flops_amount(smx_simcall_t simcall) { + return (double*) simcall->args[3].dp; +} +static inline void simcall_process_parallel_execute__set__flops_amount(smx_simcall_t simcall, void* arg) { + simcall->args[3].dp = arg; +} +static inline double* simcall_process_parallel_execute__get__bytes_amount(smx_simcall_t simcall) { + return (double*) simcall->args[4].dp; +} +static inline void simcall_process_parallel_execute__set__bytes_amount(smx_simcall_t simcall, void* arg) { + simcall->args[4].dp = arg; +} +static inline double simcall_process_parallel_execute__get__amount(smx_simcall_t simcall) { + return simcall->args[5].d; +} +static inline void simcall_process_parallel_execute__set__amount(smx_simcall_t simcall, double arg) { + simcall->args[5].d = arg; +} +static inline double simcall_process_parallel_execute__get__rate(smx_simcall_t simcall) { + return simcall->args[6].d; +} +static inline void simcall_process_parallel_execute__set__rate(smx_simcall_t simcall, double arg) { + simcall->args[6].d = arg; +} +static inline smx_synchro_t simcall_process_parallel_execute__get__result(smx_simcall_t simcall){ + return (smx_synchro_t) simcall->result.dp; +} +static inline void simcall_process_parallel_execute__set__result(smx_simcall_t simcall, void* result){ + simcall->result.dp = result; +} + +static inline smx_synchro_t simcall_process_execution_destroy__get__execution(smx_simcall_t simcall) { + return (smx_synchro_t) simcall->args[0].dp; +} +static inline void simcall_process_execution_destroy__set__execution(smx_simcall_t simcall, void* arg) { + simcall->args[0].dp = arg; +} + +static inline smx_synchro_t simcall_process_execution_cancel__get__execution(smx_simcall_t simcall) { + return (smx_synchro_t) simcall->args[0].dp; +} +static inline void simcall_process_execution_cancel__set__execution(smx_simcall_t simcall, void* arg) { + simcall->args[0].dp = arg; +} + +static inline smx_synchro_t simcall_process_execution_get_remains__get__execution(smx_simcall_t simcall) { + return (smx_synchro_t) simcall->args[0].dp; +} +static inline void simcall_process_execution_get_remains__set__execution(smx_simcall_t simcall, void* arg) { + simcall->args[0].dp = arg; +} +static inline double simcall_process_execution_get_remains__get__result(smx_simcall_t simcall){ + return simcall->result.d; +} +static inline void simcall_process_execution_get_remains__set__result(smx_simcall_t simcall, double result){ + simcall->result.d = result; +} + +static inline smx_synchro_t simcall_process_execution_get_state__get__execution(smx_simcall_t simcall) { + return (smx_synchro_t) simcall->args[0].dp; +} +static inline void simcall_process_execution_get_state__set__execution(smx_simcall_t simcall, void* arg) { + simcall->args[0].dp = arg; +} +static inline e_smx_state_t simcall_process_execution_get_state__get__result(smx_simcall_t simcall){ + return (e_smx_state_t) simcall->result.i; +} +static inline void simcall_process_execution_get_state__set__result(smx_simcall_t simcall, int result){ + simcall->result.i = result; +} + +static inline smx_synchro_t simcall_process_execution_set_priority__get__execution(smx_simcall_t simcall) { + return (smx_synchro_t) simcall->args[0].dp; +} +static inline void simcall_process_execution_set_priority__set__execution(smx_simcall_t simcall, void* arg) { + simcall->args[0].dp = arg; +} +static inline double simcall_process_execution_set_priority__get__priority(smx_simcall_t simcall) { + return simcall->args[1].d; +} +static inline void simcall_process_execution_set_priority__set__priority(smx_simcall_t simcall, double arg) { + simcall->args[1].d = arg; +} + +static inline smx_synchro_t simcall_process_execution_set_bound__get__execution(smx_simcall_t simcall) { + return (smx_synchro_t) simcall->args[0].dp; +} +static inline void simcall_process_execution_set_bound__set__execution(smx_simcall_t simcall, void* arg) { + simcall->args[0].dp = arg; +} +static inline double simcall_process_execution_set_bound__get__bound(smx_simcall_t simcall) { + return simcall->args[1].d; +} +static inline void simcall_process_execution_set_bound__set__bound(smx_simcall_t simcall, double arg) { + simcall->args[1].d = arg; +} + +static inline smx_synchro_t simcall_process_execution_set_affinity__get__execution(smx_simcall_t simcall) { + return (smx_synchro_t) simcall->args[0].dp; +} +static inline void simcall_process_execution_set_affinity__set__execution(smx_simcall_t simcall, void* arg) { + simcall->args[0].dp = arg; +} +static inline sg_host_t simcall_process_execution_set_affinity__get__ws(smx_simcall_t simcall) { + return (sg_host_t) simcall->args[1].dp; +} +static inline void simcall_process_execution_set_affinity__set__ws(smx_simcall_t simcall, void* arg) { + simcall->args[1].dp = arg; +} +static inline unsigned long simcall_process_execution_set_affinity__get__mask(smx_simcall_t simcall) { + return simcall->args[2].ul; +} +static inline void simcall_process_execution_set_affinity__set__mask(smx_simcall_t simcall, unsigned long arg) { + simcall->args[2].ul = arg; +} + +static inline smx_synchro_t simcall_process_execution_wait__get__execution(smx_simcall_t simcall) { + return (smx_synchro_t) simcall->args[0].dp; +} +static inline void simcall_process_execution_wait__set__execution(smx_simcall_t simcall, void* arg) { + simcall->args[0].dp = arg; +} +static inline int simcall_process_execution_wait__get__result(smx_simcall_t simcall){ + return simcall->result.i; +} +static inline void simcall_process_execution_wait__set__result(smx_simcall_t simcall, int result){ + simcall->result.i = result; +} + static inline smx_process_t simcall_process_on_exit__get__process(smx_simcall_t simcall) { return (smx_process_t) simcall->args[0].dp; } @@ -1937,7 +1931,6 @@ static inline void simcall_mc_compare_snapshots__set__result(smx_simcall_t simca /* The prototype of all simcall handlers, automatically generated for you */ void simcall_HANDLER_host_off(smx_simcall_t simcall, sg_host_t host); -void simcall_HANDLER_process_execution_wait(smx_simcall_t simcall, smx_synchro_t execution); void simcall_HANDLER_vm_suspend(smx_simcall_t simcall, sg_host_t ind_vm); void simcall_HANDLER_vm_resume(smx_simcall_t simcall, sg_host_t ind_vm); void simcall_HANDLER_vm_shutdown(smx_simcall_t simcall, sg_host_t ind_vm); @@ -1951,6 +1944,8 @@ void simcall_HANDLER_process_suspend(smx_simcall_t simcall, smx_process_t proces void simcall_HANDLER_process_resume(smx_simcall_t simcall, smx_process_t process); void simcall_HANDLER_process_join(smx_simcall_t simcall, smx_process_t process, double timeout); void simcall_HANDLER_process_sleep(smx_simcall_t simcall, double duration); +smx_synchro_t simcall_HANDLER_process_execute(smx_simcall_t simcall, const char* name, double flops_amount, double priority, double bound, unsigned long affinity_mask); +void simcall_HANDLER_process_execution_wait(smx_simcall_t simcall, smx_synchro_t execution); smx_process_t simcall_HANDLER_process_restart(smx_simcall_t simcall, smx_process_t process); smx_synchro_t simcall_HANDLER_comm_iprobe(smx_simcall_t simcall, smx_rdv_t rdv, int type, int src, int tag, simix_match_func_t match_fun, void* data); void simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_process_t src, smx_rdv_t rdv, double task_size, double rate, void* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout); diff --git a/src/simix/popping_bodies.c b/src/simix/popping_bodies.c index 4efc5176a4..b808841645 100644 --- a/src/simix/popping_bodies.c +++ b/src/simix/popping_bodies.c @@ -378,231 +378,6 @@ inline static double simcall_BODY_host_get_consumed_energy(sg_host_t host) { return self->simcall.result.d; } -inline static smx_synchro_t simcall_BODY_process_execute(const char* name, sg_host_t host, double flops_amount, double priority, double bound, unsigned long affinity_mask) { - smx_process_t self = SIMIX_process_self(); - - /* Go to that function to follow the code flow through the simcall barrier */ - if (0) SIMIX_process_execute(name, host, flops_amount, priority, bound, affinity_mask); - /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ - - self->simcall.call = SIMCALL_PROCESS_EXECUTE; - memset(&self->simcall.result, 0, sizeof(self->simcall.result)); - memset(self->simcall.args, 0, sizeof(self->simcall.args)); - self->simcall.args[0].cc = (const char*) name; - self->simcall.args[1].dp = (void*) host; - self->simcall.args[2].d = (double) flops_amount; - self->simcall.args[3].d = (double) priority; - self->simcall.args[4].d = (double) bound; - self->simcall.args[5].ul = (unsigned long) affinity_mask; - if (self != simix_global->maestro_process) { - XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, - SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); - SIMIX_process_yield(self); - } else { - SIMIX_simcall_handle(&self->simcall, 0); - } - return self->simcall.result.dp; - } - -inline static smx_synchro_t simcall_BODY_process_parallel_execute(const char* name, int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount, double amount, double rate) { - smx_process_t self = SIMIX_process_self(); - - /* Go to that function to follow the code flow through the simcall barrier */ - if (0) SIMIX_process_parallel_execute(name, host_nb, host_list, flops_amount, bytes_amount, amount, rate); - /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ - - self->simcall.call = SIMCALL_PROCESS_PARALLEL_EXECUTE; - memset(&self->simcall.result, 0, sizeof(self->simcall.result)); - memset(self->simcall.args, 0, sizeof(self->simcall.args)); - self->simcall.args[0].cc = (const char*) name; - self->simcall.args[1].i = (int) host_nb; - self->simcall.args[2].dp = (void*) host_list; - self->simcall.args[3].dp = (void*) flops_amount; - self->simcall.args[4].dp = (void*) bytes_amount; - self->simcall.args[5].d = (double) amount; - self->simcall.args[6].d = (double) rate; - if (self != simix_global->maestro_process) { - XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, - SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); - SIMIX_process_yield(self); - } else { - SIMIX_simcall_handle(&self->simcall, 0); - } - return self->simcall.result.dp; - } - -inline static void simcall_BODY_process_execution_destroy(smx_synchro_t execution) { - smx_process_t self = SIMIX_process_self(); - - /* Go to that function to follow the code flow through the simcall barrier */ - if (0) SIMIX_process_execution_destroy(execution); - /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ - - self->simcall.call = SIMCALL_PROCESS_EXECUTION_DESTROY; - memset(&self->simcall.result, 0, sizeof(self->simcall.result)); - memset(self->simcall.args, 0, sizeof(self->simcall.args)); - self->simcall.args[0].dp = (void*) execution; - if (self != simix_global->maestro_process) { - XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, - SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); - SIMIX_process_yield(self); - } else { - SIMIX_simcall_handle(&self->simcall, 0); - } - - } - -inline static void simcall_BODY_process_execution_cancel(smx_synchro_t execution) { - smx_process_t self = SIMIX_process_self(); - - /* Go to that function to follow the code flow through the simcall barrier */ - if (0) SIMIX_process_execution_cancel(execution); - /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ - - self->simcall.call = SIMCALL_PROCESS_EXECUTION_CANCEL; - memset(&self->simcall.result, 0, sizeof(self->simcall.result)); - memset(self->simcall.args, 0, sizeof(self->simcall.args)); - self->simcall.args[0].dp = (void*) execution; - if (self != simix_global->maestro_process) { - XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, - SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); - SIMIX_process_yield(self); - } else { - SIMIX_simcall_handle(&self->simcall, 0); - } - - } - -inline static double simcall_BODY_process_execution_get_remains(smx_synchro_t execution) { - smx_process_t self = SIMIX_process_self(); - - /* Go to that function to follow the code flow through the simcall barrier */ - if (0) SIMIX_process_execution_get_remains(execution); - /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ - - self->simcall.call = SIMCALL_PROCESS_EXECUTION_GET_REMAINS; - memset(&self->simcall.result, 0, sizeof(self->simcall.result)); - memset(self->simcall.args, 0, sizeof(self->simcall.args)); - self->simcall.args[0].dp = (void*) execution; - if (self != simix_global->maestro_process) { - XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, - SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); - SIMIX_process_yield(self); - } else { - SIMIX_simcall_handle(&self->simcall, 0); - } - return self->simcall.result.d; - } - -inline static e_smx_state_t simcall_BODY_process_execution_get_state(smx_synchro_t execution) { - smx_process_t self = SIMIX_process_self(); - - /* Go to that function to follow the code flow through the simcall barrier */ - if (0) SIMIX_process_execution_get_state(execution); - /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ - - self->simcall.call = SIMCALL_PROCESS_EXECUTION_GET_STATE; - memset(&self->simcall.result, 0, sizeof(self->simcall.result)); - memset(self->simcall.args, 0, sizeof(self->simcall.args)); - self->simcall.args[0].dp = (void*) execution; - if (self != simix_global->maestro_process) { - XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, - SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); - SIMIX_process_yield(self); - } else { - SIMIX_simcall_handle(&self->simcall, 0); - } - return self->simcall.result.i; - } - -inline static void simcall_BODY_process_execution_set_priority(smx_synchro_t execution, double priority) { - smx_process_t self = SIMIX_process_self(); - - /* Go to that function to follow the code flow through the simcall barrier */ - if (0) SIMIX_process_execution_set_priority(execution, priority); - /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ - - self->simcall.call = SIMCALL_PROCESS_EXECUTION_SET_PRIORITY; - memset(&self->simcall.result, 0, sizeof(self->simcall.result)); - memset(self->simcall.args, 0, sizeof(self->simcall.args)); - self->simcall.args[0].dp = (void*) execution; - self->simcall.args[1].d = (double) priority; - if (self != simix_global->maestro_process) { - XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, - SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); - SIMIX_process_yield(self); - } else { - SIMIX_simcall_handle(&self->simcall, 0); - } - - } - -inline static void simcall_BODY_process_execution_set_bound(smx_synchro_t execution, double bound) { - smx_process_t self = SIMIX_process_self(); - - /* Go to that function to follow the code flow through the simcall barrier */ - if (0) SIMIX_process_execution_set_bound(execution, bound); - /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ - - self->simcall.call = SIMCALL_PROCESS_EXECUTION_SET_BOUND; - memset(&self->simcall.result, 0, sizeof(self->simcall.result)); - memset(self->simcall.args, 0, sizeof(self->simcall.args)); - self->simcall.args[0].dp = (void*) execution; - self->simcall.args[1].d = (double) bound; - if (self != simix_global->maestro_process) { - XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, - SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); - SIMIX_process_yield(self); - } else { - SIMIX_simcall_handle(&self->simcall, 0); - } - - } - -inline static void simcall_BODY_process_execution_set_affinity(smx_synchro_t execution, sg_host_t ws, unsigned long mask) { - smx_process_t self = SIMIX_process_self(); - - /* Go to that function to follow the code flow through the simcall barrier */ - if (0) SIMIX_process_execution_set_affinity(execution, ws, mask); - /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ - - self->simcall.call = SIMCALL_PROCESS_EXECUTION_SET_AFFINITY; - memset(&self->simcall.result, 0, sizeof(self->simcall.result)); - memset(self->simcall.args, 0, sizeof(self->simcall.args)); - self->simcall.args[0].dp = (void*) execution; - self->simcall.args[1].dp = (void*) ws; - self->simcall.args[2].ul = (unsigned long) mask; - if (self != simix_global->maestro_process) { - XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, - SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); - SIMIX_process_yield(self); - } else { - SIMIX_simcall_handle(&self->simcall, 0); - } - - } - -inline static int simcall_BODY_process_execution_wait(smx_synchro_t execution) { - smx_process_t self = SIMIX_process_self(); - - /* Go to that function to follow the code flow through the simcall barrier */ - if (0) simcall_HANDLER_process_execution_wait(&self->simcall, execution); - /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ - - self->simcall.call = SIMCALL_PROCESS_EXECUTION_WAIT; - memset(&self->simcall.result, 0, sizeof(self->simcall.result)); - memset(self->simcall.args, 0, sizeof(self->simcall.args)); - self->simcall.args[0].dp = (void*) execution; - if (self != simix_global->maestro_process) { - XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, - SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); - SIMIX_process_yield(self); - } else { - SIMIX_simcall_handle(&self->simcall, 0); - } - return self->simcall.result.i; - } - inline static xbt_dict_t simcall_BODY_host_get_mounted_storage_list(sg_host_t host) { smx_process_t self = SIMIX_process_self(); @@ -1379,6 +1154,230 @@ inline static int simcall_BODY_process_sleep(double duration) { return self->simcall.result.i; } +inline static smx_synchro_t simcall_BODY_process_execute(const char* name, double flops_amount, double priority, double bound, unsigned long affinity_mask) { + smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_process_execute(&self->simcall, name, flops_amount, priority, bound, affinity_mask); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + + self->simcall.call = SIMCALL_PROCESS_EXECUTE; + memset(&self->simcall.result, 0, sizeof(self->simcall.result)); + memset(self->simcall.args, 0, sizeof(self->simcall.args)); + self->simcall.args[0].cc = (const char*) name; + self->simcall.args[1].d = (double) flops_amount; + self->simcall.args[2].d = (double) priority; + self->simcall.args[3].d = (double) bound; + self->simcall.args[4].ul = (unsigned long) affinity_mask; + if (self != simix_global->maestro_process) { + XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, + SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); + SIMIX_process_yield(self); + } else { + SIMIX_simcall_handle(&self->simcall, 0); + } + return self->simcall.result.dp; + } + +inline static smx_synchro_t simcall_BODY_process_parallel_execute(const char* name, int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount, double amount, double rate) { + smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_process_parallel_execute(name, host_nb, host_list, flops_amount, bytes_amount, amount, rate); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + + self->simcall.call = SIMCALL_PROCESS_PARALLEL_EXECUTE; + memset(&self->simcall.result, 0, sizeof(self->simcall.result)); + memset(self->simcall.args, 0, sizeof(self->simcall.args)); + self->simcall.args[0].cc = (const char*) name; + self->simcall.args[1].i = (int) host_nb; + self->simcall.args[2].dp = (void*) host_list; + self->simcall.args[3].dp = (void*) flops_amount; + self->simcall.args[4].dp = (void*) bytes_amount; + self->simcall.args[5].d = (double) amount; + self->simcall.args[6].d = (double) rate; + if (self != simix_global->maestro_process) { + XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, + SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); + SIMIX_process_yield(self); + } else { + SIMIX_simcall_handle(&self->simcall, 0); + } + return self->simcall.result.dp; + } + +inline static void simcall_BODY_process_execution_destroy(smx_synchro_t execution) { + smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_process_execution_destroy(execution); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + + self->simcall.call = SIMCALL_PROCESS_EXECUTION_DESTROY; + memset(&self->simcall.result, 0, sizeof(self->simcall.result)); + memset(self->simcall.args, 0, sizeof(self->simcall.args)); + self->simcall.args[0].dp = (void*) execution; + if (self != simix_global->maestro_process) { + XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, + SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); + SIMIX_process_yield(self); + } else { + SIMIX_simcall_handle(&self->simcall, 0); + } + + } + +inline static void simcall_BODY_process_execution_cancel(smx_synchro_t execution) { + smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_process_execution_cancel(execution); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + + self->simcall.call = SIMCALL_PROCESS_EXECUTION_CANCEL; + memset(&self->simcall.result, 0, sizeof(self->simcall.result)); + memset(self->simcall.args, 0, sizeof(self->simcall.args)); + self->simcall.args[0].dp = (void*) execution; + if (self != simix_global->maestro_process) { + XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, + SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); + SIMIX_process_yield(self); + } else { + SIMIX_simcall_handle(&self->simcall, 0); + } + + } + +inline static double simcall_BODY_process_execution_get_remains(smx_synchro_t execution) { + smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_process_execution_get_remains(execution); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + + self->simcall.call = SIMCALL_PROCESS_EXECUTION_GET_REMAINS; + memset(&self->simcall.result, 0, sizeof(self->simcall.result)); + memset(self->simcall.args, 0, sizeof(self->simcall.args)); + self->simcall.args[0].dp = (void*) execution; + if (self != simix_global->maestro_process) { + XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, + SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); + SIMIX_process_yield(self); + } else { + SIMIX_simcall_handle(&self->simcall, 0); + } + return self->simcall.result.d; + } + +inline static e_smx_state_t simcall_BODY_process_execution_get_state(smx_synchro_t execution) { + smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_process_execution_get_state(execution); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + + self->simcall.call = SIMCALL_PROCESS_EXECUTION_GET_STATE; + memset(&self->simcall.result, 0, sizeof(self->simcall.result)); + memset(self->simcall.args, 0, sizeof(self->simcall.args)); + self->simcall.args[0].dp = (void*) execution; + if (self != simix_global->maestro_process) { + XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, + SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); + SIMIX_process_yield(self); + } else { + SIMIX_simcall_handle(&self->simcall, 0); + } + return self->simcall.result.i; + } + +inline static void simcall_BODY_process_execution_set_priority(smx_synchro_t execution, double priority) { + smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_process_execution_set_priority(execution, priority); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + + self->simcall.call = SIMCALL_PROCESS_EXECUTION_SET_PRIORITY; + memset(&self->simcall.result, 0, sizeof(self->simcall.result)); + memset(self->simcall.args, 0, sizeof(self->simcall.args)); + self->simcall.args[0].dp = (void*) execution; + self->simcall.args[1].d = (double) priority; + if (self != simix_global->maestro_process) { + XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, + SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); + SIMIX_process_yield(self); + } else { + SIMIX_simcall_handle(&self->simcall, 0); + } + + } + +inline static void simcall_BODY_process_execution_set_bound(smx_synchro_t execution, double bound) { + smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_process_execution_set_bound(execution, bound); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + + self->simcall.call = SIMCALL_PROCESS_EXECUTION_SET_BOUND; + memset(&self->simcall.result, 0, sizeof(self->simcall.result)); + memset(self->simcall.args, 0, sizeof(self->simcall.args)); + self->simcall.args[0].dp = (void*) execution; + self->simcall.args[1].d = (double) bound; + if (self != simix_global->maestro_process) { + XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, + SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); + SIMIX_process_yield(self); + } else { + SIMIX_simcall_handle(&self->simcall, 0); + } + + } + +inline static void simcall_BODY_process_execution_set_affinity(smx_synchro_t execution, sg_host_t ws, unsigned long mask) { + smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) SIMIX_process_execution_set_affinity(execution, ws, mask); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + + self->simcall.call = SIMCALL_PROCESS_EXECUTION_SET_AFFINITY; + memset(&self->simcall.result, 0, sizeof(self->simcall.result)); + memset(self->simcall.args, 0, sizeof(self->simcall.args)); + self->simcall.args[0].dp = (void*) execution; + self->simcall.args[1].dp = (void*) ws; + self->simcall.args[2].ul = (unsigned long) mask; + if (self != simix_global->maestro_process) { + XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, + SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); + SIMIX_process_yield(self); + } else { + SIMIX_simcall_handle(&self->simcall, 0); + } + + } + +inline static int simcall_BODY_process_execution_wait(smx_synchro_t execution) { + smx_process_t self = SIMIX_process_self(); + + /* Go to that function to follow the code flow through the simcall barrier */ + if (0) simcall_HANDLER_process_execution_wait(&self->simcall, execution); + /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ + + self->simcall.call = SIMCALL_PROCESS_EXECUTION_WAIT; + memset(&self->simcall.result, 0, sizeof(self->simcall.result)); + memset(self->simcall.args, 0, sizeof(self->simcall.args)); + self->simcall.args[0].dp = (void*) execution; + if (self != simix_global->maestro_process) { + XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, + SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); + SIMIX_process_yield(self); + } else { + SIMIX_simcall_handle(&self->simcall, 0); + } + return self->simcall.result.i; + } + inline static void simcall_BODY_process_on_exit(smx_process_t process, int_f_pvoid_pvoid_t fun, void* data) { smx_process_t self = SIMIX_process_self(); diff --git a/src/simix/popping_enum.h b/src/simix/popping_enum.h index e49f0a75be..739618414c 100644 --- a/src/simix/popping_enum.h +++ b/src/simix/popping_enum.h @@ -35,16 +35,6 @@ typedef enum { SIMCALL_HOST_SET_PSTATE, SIMCALL_HOST_GET_PSTATE, SIMCALL_HOST_GET_CONSUMED_ENERGY, - SIMCALL_PROCESS_EXECUTE, - SIMCALL_PROCESS_PARALLEL_EXECUTE, - SIMCALL_PROCESS_EXECUTION_DESTROY, - SIMCALL_PROCESS_EXECUTION_CANCEL, - SIMCALL_PROCESS_EXECUTION_GET_REMAINS, - SIMCALL_PROCESS_EXECUTION_GET_STATE, - SIMCALL_PROCESS_EXECUTION_SET_PRIORITY, - SIMCALL_PROCESS_EXECUTION_SET_BOUND, - SIMCALL_PROCESS_EXECUTION_SET_AFFINITY, - SIMCALL_PROCESS_EXECUTION_WAIT, SIMCALL_HOST_GET_MOUNTED_STORAGE_LIST, SIMCALL_HOST_GET_ATTACHED_STORAGE_LIST, SIMCALL_HOST_GET_PARAMS, @@ -81,6 +71,16 @@ typedef enum { SIMCALL_PROCESS_GET_PROPERTIES, SIMCALL_PROCESS_JOIN, SIMCALL_PROCESS_SLEEP, + SIMCALL_PROCESS_EXECUTE, + SIMCALL_PROCESS_PARALLEL_EXECUTE, + SIMCALL_PROCESS_EXECUTION_DESTROY, + SIMCALL_PROCESS_EXECUTION_CANCEL, + SIMCALL_PROCESS_EXECUTION_GET_REMAINS, + SIMCALL_PROCESS_EXECUTION_GET_STATE, + SIMCALL_PROCESS_EXECUTION_SET_PRIORITY, + SIMCALL_PROCESS_EXECUTION_SET_BOUND, + SIMCALL_PROCESS_EXECUTION_SET_AFFINITY, + SIMCALL_PROCESS_EXECUTION_WAIT, SIMCALL_PROCESS_ON_EXIT, SIMCALL_PROCESS_AUTO_RESTART_SET, SIMCALL_PROCESS_RESTART, diff --git a/src/simix/popping_generated.c b/src/simix/popping_generated.c index df9d5421c5..a2d70ab609 100644 --- a/src/simix/popping_generated.c +++ b/src/simix/popping_generated.c @@ -39,16 +39,6 @@ const char* simcall_names[] = { [SIMCALL_HOST_SET_PSTATE] = "SIMCALL_HOST_SET_PSTATE", [SIMCALL_HOST_GET_PSTATE] = "SIMCALL_HOST_GET_PSTATE", [SIMCALL_HOST_GET_CONSUMED_ENERGY] = "SIMCALL_HOST_GET_CONSUMED_ENERGY", - [SIMCALL_PROCESS_EXECUTE] = "SIMCALL_PROCESS_EXECUTE", - [SIMCALL_PROCESS_PARALLEL_EXECUTE] = "SIMCALL_PROCESS_PARALLEL_EXECUTE", - [SIMCALL_PROCESS_EXECUTION_DESTROY] = "SIMCALL_PROCESS_EXECUTION_DESTROY", - [SIMCALL_PROCESS_EXECUTION_CANCEL] = "SIMCALL_PROCESS_EXECUTION_CANCEL", - [SIMCALL_PROCESS_EXECUTION_GET_REMAINS] = "SIMCALL_PROCESS_EXECUTION_GET_REMAINS", - [SIMCALL_PROCESS_EXECUTION_GET_STATE] = "SIMCALL_PROCESS_EXECUTION_GET_STATE", - [SIMCALL_PROCESS_EXECUTION_SET_PRIORITY] = "SIMCALL_PROCESS_EXECUTION_SET_PRIORITY", - [SIMCALL_PROCESS_EXECUTION_SET_BOUND] = "SIMCALL_PROCESS_EXECUTION_SET_BOUND", - [SIMCALL_PROCESS_EXECUTION_SET_AFFINITY] = "SIMCALL_PROCESS_EXECUTION_SET_AFFINITY", - [SIMCALL_PROCESS_EXECUTION_WAIT] = "SIMCALL_PROCESS_EXECUTION_WAIT", [SIMCALL_HOST_GET_MOUNTED_STORAGE_LIST] = "SIMCALL_HOST_GET_MOUNTED_STORAGE_LIST", [SIMCALL_HOST_GET_ATTACHED_STORAGE_LIST] = "SIMCALL_HOST_GET_ATTACHED_STORAGE_LIST", [SIMCALL_HOST_GET_PARAMS] = "SIMCALL_HOST_GET_PARAMS", @@ -85,6 +75,16 @@ const char* simcall_names[] = { [SIMCALL_PROCESS_GET_PROPERTIES] = "SIMCALL_PROCESS_GET_PROPERTIES", [SIMCALL_PROCESS_JOIN] = "SIMCALL_PROCESS_JOIN", [SIMCALL_PROCESS_SLEEP] = "SIMCALL_PROCESS_SLEEP", + [SIMCALL_PROCESS_EXECUTE] = "SIMCALL_PROCESS_EXECUTE", + [SIMCALL_PROCESS_PARALLEL_EXECUTE] = "SIMCALL_PROCESS_PARALLEL_EXECUTE", + [SIMCALL_PROCESS_EXECUTION_DESTROY] = "SIMCALL_PROCESS_EXECUTION_DESTROY", + [SIMCALL_PROCESS_EXECUTION_CANCEL] = "SIMCALL_PROCESS_EXECUTION_CANCEL", + [SIMCALL_PROCESS_EXECUTION_GET_REMAINS] = "SIMCALL_PROCESS_EXECUTION_GET_REMAINS", + [SIMCALL_PROCESS_EXECUTION_GET_STATE] = "SIMCALL_PROCESS_EXECUTION_GET_STATE", + [SIMCALL_PROCESS_EXECUTION_SET_PRIORITY] = "SIMCALL_PROCESS_EXECUTION_SET_PRIORITY", + [SIMCALL_PROCESS_EXECUTION_SET_BOUND] = "SIMCALL_PROCESS_EXECUTION_SET_BOUND", + [SIMCALL_PROCESS_EXECUTION_SET_AFFINITY] = "SIMCALL_PROCESS_EXECUTION_SET_AFFINITY", + [SIMCALL_PROCESS_EXECUTION_WAIT] = "SIMCALL_PROCESS_EXECUTION_WAIT", [SIMCALL_PROCESS_ON_EXIT] = "SIMCALL_PROCESS_ON_EXIT", [SIMCALL_PROCESS_AUTO_RESTART_SET] = "SIMCALL_PROCESS_AUTO_RESTART_SET", [SIMCALL_PROCESS_RESTART] = "SIMCALL_PROCESS_RESTART", @@ -252,55 +252,6 @@ case SIMCALL_HOST_GET_CONSUMED_ENERGY: SIMIX_simcall_answer(simcall); break; -case SIMCALL_PROCESS_EXECUTE: - simcall->result.dp = SIMIX_process_execute( simcall->args[0].cc,(sg_host_t) simcall->args[1].dp, simcall->args[2].d, simcall->args[3].d, simcall->args[4].d, simcall->args[5].ul); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_PROCESS_PARALLEL_EXECUTE: - simcall->result.dp = SIMIX_process_parallel_execute( simcall->args[0].cc, simcall->args[1].i,(sg_host_t*) simcall->args[2].dp,(double*) simcall->args[3].dp,(double*) simcall->args[4].dp, simcall->args[5].d, simcall->args[6].d); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_PROCESS_EXECUTION_DESTROY: - SIMIX_process_execution_destroy((smx_synchro_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_PROCESS_EXECUTION_CANCEL: - SIMIX_process_execution_cancel((smx_synchro_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_PROCESS_EXECUTION_GET_REMAINS: - simcall->result.d = SIMIX_process_execution_get_remains((smx_synchro_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_PROCESS_EXECUTION_GET_STATE: - simcall->result.i = SIMIX_process_execution_get_state((smx_synchro_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_PROCESS_EXECUTION_SET_PRIORITY: - SIMIX_process_execution_set_priority((smx_synchro_t) simcall->args[0].dp, simcall->args[1].d); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_PROCESS_EXECUTION_SET_BOUND: - SIMIX_process_execution_set_bound((smx_synchro_t) simcall->args[0].dp, simcall->args[1].d); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_PROCESS_EXECUTION_SET_AFFINITY: - SIMIX_process_execution_set_affinity((smx_synchro_t) simcall->args[0].dp,(sg_host_t) simcall->args[1].dp, simcall->args[2].ul); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_PROCESS_EXECUTION_WAIT: - simcall_HANDLER_process_execution_wait(simcall , (smx_synchro_t) simcall->args[0].dp); - break; - case SIMCALL_HOST_GET_MOUNTED_STORAGE_LIST: simcall->result.dp = SIMIX_host_get_mounted_storage_list((sg_host_t) simcall->args[0].dp); SIMIX_simcall_answer(simcall); @@ -478,6 +429,55 @@ case SIMCALL_PROCESS_SLEEP: simcall_HANDLER_process_sleep(simcall , simcall->args[0].d); break; +case SIMCALL_PROCESS_EXECUTE: + simcall->result.dp = simcall_HANDLER_process_execute(simcall , simcall->args[0].cc, simcall->args[1].d, simcall->args[2].d, simcall->args[3].d, simcall->args[4].ul); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_PROCESS_PARALLEL_EXECUTE: + simcall->result.dp = SIMIX_process_parallel_execute( simcall->args[0].cc, simcall->args[1].i,(sg_host_t*) simcall->args[2].dp,(double*) simcall->args[3].dp,(double*) simcall->args[4].dp, simcall->args[5].d, simcall->args[6].d); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_PROCESS_EXECUTION_DESTROY: + SIMIX_process_execution_destroy((smx_synchro_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_PROCESS_EXECUTION_CANCEL: + SIMIX_process_execution_cancel((smx_synchro_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_PROCESS_EXECUTION_GET_REMAINS: + simcall->result.d = SIMIX_process_execution_get_remains((smx_synchro_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_PROCESS_EXECUTION_GET_STATE: + simcall->result.i = SIMIX_process_execution_get_state((smx_synchro_t) simcall->args[0].dp); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_PROCESS_EXECUTION_SET_PRIORITY: + SIMIX_process_execution_set_priority((smx_synchro_t) simcall->args[0].dp, simcall->args[1].d); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_PROCESS_EXECUTION_SET_BOUND: + SIMIX_process_execution_set_bound((smx_synchro_t) simcall->args[0].dp, simcall->args[1].d); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_PROCESS_EXECUTION_SET_AFFINITY: + SIMIX_process_execution_set_affinity((smx_synchro_t) simcall->args[0].dp,(sg_host_t) simcall->args[1].dp, simcall->args[2].ul); + SIMIX_simcall_answer(simcall); + break; + +case SIMCALL_PROCESS_EXECUTION_WAIT: + simcall_HANDLER_process_execution_wait(simcall , (smx_synchro_t) simcall->args[0].dp); + break; + case SIMCALL_PROCESS_ON_EXIT: SIMIX_process_on_exit((smx_process_t) simcall->args[0].dp,(int_f_pvoid_pvoid_t) simcall->args[1].fp, simcall->args[2].dp); SIMIX_simcall_answer(simcall); diff --git a/src/simix/simcalls.in b/src/simix/simcalls.in index efeaf0fc7f..6d442278ff 100644 --- a/src/simix/simcalls.in +++ b/src/simix/simcalls.in @@ -64,16 +64,6 @@ Proc - host_set_pstate (void) (host, void*, sg_host_t) (pstate_index, int) Func - host_get_pstate (int) (host, void*, sg_host_t) Func - host_get_consumed_energy (double) (host, void*, sg_host_t) -Func - process_execute (void*, smx_synchro_t) (name, const char*) (host, void*, sg_host_t) (flops_amount, double) (priority, double) (bound, double) (affinity_mask, unsigned long) -Func - process_parallel_execute (void*, smx_synchro_t) (name, const char*) (host_nb, int) (host_list, void*, sg_host_t*) (flops_amount, void*, double*) (bytes_amount, void*, double*) (amount, double) (rate, double) -Proc - process_execution_destroy (void) (execution, void*, smx_synchro_t) -Proc - process_execution_cancel (void) (execution, void*, smx_synchro_t) -Func - process_execution_get_remains (double) (execution, void*, smx_synchro_t) -Func - process_execution_get_state (int, e_smx_state_t) (execution, void*, smx_synchro_t) -Proc - process_execution_set_priority (void) (execution, void*, smx_synchro_t) (priority, double) -Proc - process_execution_set_bound (void) (execution, void*, smx_synchro_t) (bound, double) -Proc - process_execution_set_affinity (void) (execution, void*, smx_synchro_t) (ws, void*, sg_host_t) (mask, unsigned long) -Blck H process_execution_wait (int) (execution, void*, smx_synchro_t) Func - host_get_mounted_storage_list (void*, xbt_dict_t) (host, void*, sg_host_t) Func - host_get_attached_storage_list (void*, xbt_dynar_t) (host, void*, sg_host_t) Proc - host_get_params (void) (ind_vm, void*, sg_host_t) (params, void*, vm_params_t) @@ -110,6 +100,18 @@ Func - process_is_suspended (int) (process, void*, smx_process_t) Func - process_get_properties (void*, xbt_dict_t) (process, void*, smx_process_t) Blck H process_join (int) (process, void*, smx_process_t) (timeout, double) Blck H process_sleep (int) (duration, double) + +Func H process_execute (void*, smx_synchro_t) (name, const char*) (flops_amount, double) (priority, double) (bound, double) (affinity_mask, unsigned long) +Func - process_parallel_execute (void*, smx_synchro_t) (name, const char*) (host_nb, int) (host_list, void*, sg_host_t*) (flops_amount, void*, double*) (bytes_amount, void*, double*) (amount, double) (rate, double) +Proc - process_execution_destroy (void) (execution, void*, smx_synchro_t) +Proc - process_execution_cancel (void) (execution, void*, smx_synchro_t) +Func - process_execution_get_remains (double) (execution, void*, smx_synchro_t) +Func - process_execution_get_state (int, e_smx_state_t) (execution, void*, smx_synchro_t) +Proc - process_execution_set_priority (void) (execution, void*, smx_synchro_t) (priority, double) +Proc - process_execution_set_bound (void) (execution, void*, smx_synchro_t) (bound, double) +Proc - process_execution_set_affinity (void) (execution, void*, smx_synchro_t) (ws, void*, sg_host_t) (mask, unsigned long) +Blck H process_execution_wait (int) (execution, void*, smx_synchro_t) + Proc - process_on_exit (void) (process, void*, smx_process_t) (fun, FPtr, int_f_pvoid_pvoid_t) (data, void*) Proc - process_auto_restart_set (void) (process, void*, smx_process_t) (auto_restart, int) Func H process_restart (void*, smx_process_t) (process, void*, smx_process_t) diff --git a/src/simix/smx_host.c b/src/simix/smx_host.c index ebf80692d1..67539216a8 100644 --- a/src/simix/smx_host.c +++ b/src/simix/smx_host.c @@ -328,22 +328,25 @@ void SIMIX_host_autorestart(sg_host_t host) else xbt_die("No function for simix_global->autorestart"); } - -smx_synchro_t SIMIX_process_execute(const char *name, - sg_host_t host, double flops_amount, double priority, double bound, unsigned long affinity_mask){ +smx_synchro_t simcall_HANDLER_process_execute(smx_simcall_t simcall, + const char* name, double flops_amount, double priority, double bound, unsigned long affinity_mask) { + return SIMIX_process_execute(simcall->issuer, name,flops_amount,priority,bound,affinity_mask); +} +smx_synchro_t SIMIX_process_execute(smx_process_t issuer, const char *name, + double flops_amount, double priority, double bound, unsigned long affinity_mask){ /* alloc structures and initialize */ smx_synchro_t synchro = xbt_mallocator_get(simix_global->synchro_mallocator); synchro->type = SIMIX_SYNC_EXECUTE; synchro->name = xbt_strdup(name); synchro->state = SIMIX_RUNNING; - synchro->execution.host = host; + synchro->execution.host = issuer->host; synchro->category = NULL; /* set surf's action */ if (!MC_is_active() && !MC_record_replay_is_active()) { - synchro->execution.surf_exec = surf_host_execute(host, flops_amount); + synchro->execution.surf_exec = surf_host_execute(issuer->host, flops_amount); surf_action_set_data(synchro->execution.surf_exec, synchro); surf_action_set_priority(synchro->execution.surf_exec, priority); @@ -351,14 +354,14 @@ smx_synchro_t SIMIX_process_execute(const char *name, * surf layer should not be zero (i.e., unlimited). It should be the * capacity of a CPU core. */ if (bound == 0) - surf_cpu_action_set_bound(synchro->execution.surf_exec, SIMIX_host_get_speed(host)); + surf_cpu_action_set_bound(synchro->execution.surf_exec, SIMIX_host_get_speed(issuer->host)); else surf_cpu_action_set_bound(synchro->execution.surf_exec, bound); if (affinity_mask != 0) { /* just a double check to confirm that this host is the host where this task is running. */ - xbt_assert(synchro->execution.host == host); - surf_cpu_action_set_affinity(synchro->execution.surf_exec, host, affinity_mask); + xbt_assert(synchro->execution.host == issuer->host); + surf_cpu_action_set_affinity(synchro->execution.surf_exec, issuer->host, affinity_mask); } } diff --git a/src/simix/smx_host_private.h b/src/simix/smx_host_private.h index d4e8a91503..d204997153 100644 --- a/src/simix/smx_host_private.h +++ b/src/simix/smx_host_private.h @@ -51,8 +51,8 @@ double SIMIX_host_get_wattmin_at(sg_host_t host,int pstate); double SIMIX_host_get_wattmax_at(sg_host_t host,int pstate); void SIMIX_host_set_pstate(sg_host_t host, int pstate_index); int SIMIX_host_get_pstate(sg_host_t host); -smx_synchro_t SIMIX_process_execute(const char *name, - sg_host_t host, double flops_amount, double priority, double bound, unsigned long affinity_mask); +smx_synchro_t SIMIX_process_execute(smx_process_t issuer, const char *name, + double flops_amount, double priority, double bound, unsigned long affinity_mask); smx_synchro_t SIMIX_process_parallel_execute(const char *name, int host_nb, sg_host_t *host_list, double *flops_amount, double *bytes_amount, diff --git a/src/simix/smx_process.c b/src/simix/smx_process.c index 46370dbcef..b09039c17b 100644 --- a/src/simix/smx_process.c +++ b/src/simix/smx_process.c @@ -538,7 +538,7 @@ smx_synchro_t SIMIX_process_suspend(smx_process_t process, smx_process_t issuer) } } else { /* FIXME: computation size is zero. Is it okay that bound is zero ? */ - return SIMIX_process_execute("suspend", process->host, 0.0, 1.0, 0.0, 0); + return SIMIX_process_execute(process, "suspend", 0.0, 1.0, 0.0, 0); } } diff --git a/src/smpi/smpi_bench.c b/src/smpi/smpi_bench.c index fe88c48aa1..2e70327518 100644 --- a/src/smpi/smpi_bench.c +++ b/src/smpi/smpi_bench.c @@ -153,10 +153,8 @@ void smpi_execute_(double *duration) void smpi_execute_flops(double flops) { smx_synchro_t action; - sg_host_t host; - host = SIMIX_host_self(); XBT_DEBUG("Handle real computation time: %f flops", flops); - action = simcall_process_execute("computation", host, flops, 1, 0, 0); + action = simcall_process_execute("computation", flops, 1, 0, 0); simcall_set_category (action, TRACE_internal_smpi_get_category()); simcall_process_execution_wait(action); smpi_switch_data_segment(smpi_process_index()); -- 2.20.1