From 431765cb8198579ac316fa0875b5c8988a501675 Mon Sep 17 00:00:00 2001 From: Frederic Suter Date: Fri, 21 Jul 2017 14:16:04 +0200 Subject: [PATCH] simcall_mutex_unlock is back but keep the simplification of another simcall --- include/simgrid/simix.h | 2 +- src/mc/mc_base.cpp | 14 ++++---------- src/msg/msg_gos.cpp | 2 +- src/simix/libsmx.cpp | 7 ++----- src/simix/popping_accessors.h | 24 ++++++------------------ src/simix/popping_bodies.cpp | 9 +++++---- src/simix/popping_generated.cpp | 2 +- src/simix/simcalls.in | 2 +- src/simix/smx_host.cpp | 14 +++++--------- src/simix/smx_host_private.h | 2 +- 10 files changed, 27 insertions(+), 51 deletions(-) diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index 021f9f5811..e5886a3907 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -191,7 +191,7 @@ XBT_PUBLIC(smx_activity_t) simcall_execution_start(const char *name, double priority, double bound); XBT_PUBLIC(smx_activity_t) simcall_execution_parallel_start(const char* name, int host_nb, sg_host_t* host_list, double* flops_amount, - double* bytes_amount, double amount, double rate, double timeout); + double* bytes_amount, double rate, double timeout); XBT_PUBLIC(void) simcall_execution_cancel(smx_activity_t execution); XBT_PUBLIC(void) simcall_execution_set_priority(smx_activity_t execution, double priority); XBT_PUBLIC(void) simcall_execution_set_bound(smx_activity_t execution, double bound); diff --git a/src/mc/mc_base.cpp b/src/mc/mc_base.cpp index 90fedffd0a..f3bc7d96e4 100644 --- a/src/mc/mc_base.cpp +++ b/src/mc/mc_base.cpp @@ -155,16 +155,10 @@ bool request_is_visible(smx_simcall_t req) xbt_assert(mc_model_checker == nullptr, "This should be called from the client side"); #endif - return req->call == SIMCALL_COMM_ISEND - || req->call == SIMCALL_COMM_IRECV - || req->call == SIMCALL_COMM_WAIT - || req->call == SIMCALL_COMM_WAITANY - || req->call == SIMCALL_COMM_TEST - || req->call == SIMCALL_COMM_TESTANY - || req->call == SIMCALL_MC_RANDOM - || req->call == SIMCALL_MUTEX_LOCK - || req->call == SIMCALL_MUTEX_TRYLOCK - ; + return req->call == SIMCALL_COMM_ISEND || req->call == SIMCALL_COMM_IRECV || req->call == SIMCALL_COMM_WAIT || + req->call == SIMCALL_COMM_WAITANY || req->call == SIMCALL_COMM_TEST || req->call == SIMCALL_COMM_TESTANY || + req->call == SIMCALL_MC_RANDOM || req->call == SIMCALL_MUTEX_LOCK || req->call == SIMCALL_MUTEX_TRYLOCK || + req->call == SIMCALL_MUTEX_UNLOCK; } } diff --git a/src/msg/msg_gos.cpp b/src/msg/msg_gos.cpp index 53ea92dd47..feb95778ff 100644 --- a/src/msg/msg_gos.cpp +++ b/src/msg/msg_gos.cpp @@ -70,7 +70,7 @@ msg_error_t MSG_parallel_task_execute_with_timeout(msg_task_t task, double timeo simdata->compute = boost::static_pointer_cast(simcall_execution_parallel_start( task->name, simdata->host_nb, simdata->host_list, simdata->flops_parallel_amount, - simdata->bytes_parallel_amount, 1.0, -1.0, timeout)); + simdata->bytes_parallel_amount, -1.0, timeout)); XBT_DEBUG("Parallel execution action created: %p", simdata->compute.get()); } else { simdata->compute = boost::static_pointer_cast( diff --git a/src/simix/libsmx.cpp b/src/simix/libsmx.cpp index 424d8510f2..15aeec6e93 100644 --- a/src/simix/libsmx.cpp +++ b/src/simix/libsmx.cpp @@ -84,8 +84,7 @@ smx_activity_t simcall_execution_start(const char *name, * \return A new SIMIX execution synchronization */ smx_activity_t simcall_execution_parallel_start(const char* name, int host_nb, sg_host_t* host_list, - double* flops_amount, double* bytes_amount, double amount, double rate, - double timeout) + double* flops_amount, double* bytes_amount, double rate, double timeout) { /* checking for infinite values */ for (int i = 0 ; i < host_nb ; ++i) { @@ -98,11 +97,9 @@ smx_activity_t simcall_execution_parallel_start(const char* name, int host_nb, s } } - xbt_assert(std::isfinite(amount), "amount is not finite!"); xbt_assert(std::isfinite(rate), "rate is not finite!"); - return simcall_BODY_execution_parallel_start(name, host_nb, host_list, flops_amount, bytes_amount, amount, rate, - timeout); + return simcall_BODY_execution_parallel_start(name, host_nb, host_list, flops_amount, bytes_amount, rate, timeout); } /** diff --git a/src/simix/popping_accessors.h b/src/simix/popping_accessors.h index 00ee1499d2..d16dc06c78 100644 --- a/src/simix/popping_accessors.h +++ b/src/simix/popping_accessors.h @@ -251,41 +251,29 @@ static inline void simcall_execution_parallel_start__set__bytes_amount(smx_simca { simgrid::simix::marshal(simcall->args[4], arg); } -static inline double simcall_execution_parallel_start__get__amount(smx_simcall_t simcall) -{ - return simgrid::simix::unmarshal(simcall->args[5]); -} -static inline double simcall_execution_parallel_start__getraw__amount(smx_simcall_t simcall) -{ - return simgrid::simix::unmarshal_raw(simcall->args[5]); -} -static inline void simcall_execution_parallel_start__set__amount(smx_simcall_t simcall, double arg) -{ - simgrid::simix::marshal(simcall->args[5], arg); -} static inline double simcall_execution_parallel_start__get__rate(smx_simcall_t simcall) { - return simgrid::simix::unmarshal(simcall->args[6]); + return simgrid::simix::unmarshal(simcall->args[5]); } static inline double simcall_execution_parallel_start__getraw__rate(smx_simcall_t simcall) { - return simgrid::simix::unmarshal_raw(simcall->args[6]); + return simgrid::simix::unmarshal_raw(simcall->args[5]); } static inline void simcall_execution_parallel_start__set__rate(smx_simcall_t simcall, double arg) { - simgrid::simix::marshal(simcall->args[6], arg); + simgrid::simix::marshal(simcall->args[5], arg); } static inline double simcall_execution_parallel_start__get__timeout(smx_simcall_t simcall) { - return simgrid::simix::unmarshal(simcall->args[7]); + return simgrid::simix::unmarshal(simcall->args[6]); } static inline double simcall_execution_parallel_start__getraw__timeout(smx_simcall_t simcall) { - return simgrid::simix::unmarshal_raw(simcall->args[7]); + return simgrid::simix::unmarshal_raw(simcall->args[6]); } static inline void simcall_execution_parallel_start__set__timeout(smx_simcall_t simcall, double arg) { - simgrid::simix::marshal(simcall->args[7], arg); + simgrid::simix::marshal(simcall->args[6], arg); } static inline boost::intrusive_ptr simcall_execution_parallel_start__get__result(smx_simcall_t simcall) diff --git a/src/simix/popping_bodies.cpp b/src/simix/popping_bodies.cpp index ba18225497..c2c83cc915 100644 --- a/src/simix/popping_bodies.cpp +++ b/src/simix/popping_bodies.cpp @@ -83,13 +83,14 @@ inline static int simcall_BODY_process_sleep(double duration) { inline static boost::intrusive_ptr simcall_BODY_execution_parallel_start(const char* name, int host_nb, sg_host_t* host_list, double* flops_amount, - double* bytes_amount, double amount, double rate, double timeout) + double* bytes_amount, double rate, double timeout) { /* Go to that function to follow the code flow through the simcall barrier */ - if (0) SIMIX_execution_parallel_start(name, host_nb, host_list, flops_amount, bytes_amount, amount, rate, timeout); + if (0) + SIMIX_execution_parallel_start(name, host_nb, host_list, flops_amount, bytes_amount, rate, timeout); return simcall, const char*, int, sg_host_t*, double*, - double*, double, double, double>(SIMCALL_EXECUTION_PARALLEL_START, name, host_nb, host_list, - flops_amount, bytes_amount, amount, rate, timeout); + double*, double, double>(SIMCALL_EXECUTION_PARALLEL_START, name, host_nb, host_list, flops_amount, + bytes_amount, rate, timeout); } inline static void diff --git a/src/simix/popping_generated.cpp b/src/simix/popping_generated.cpp index a240ef3ac7..d388546ea4 100644 --- a/src/simix/popping_generated.cpp +++ b/src/simix/popping_generated.cpp @@ -120,7 +120,7 @@ case SIMCALL_EXECUTION_PARALLEL_START: simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1]), simgrid::simix::unmarshal(simcall->args[2]), simgrid::simix::unmarshal(simcall->args[3]), simgrid::simix::unmarshal(simcall->args[4]), simgrid::simix::unmarshal(simcall->args[5]), - simgrid::simix::unmarshal(simcall->args[6]), simgrid::simix::unmarshal(simcall->args[7]))); + simgrid::simix::unmarshal(simcall->args[6]))); SIMIX_simcall_answer(simcall); break; diff --git a/src/simix/simcalls.in b/src/simix/simcalls.in index a2713965b9..3a6cc0f0af 100644 --- a/src/simix/simcalls.in +++ b/src/simix/simcalls.in @@ -43,7 +43,7 @@ int process_join(smx_actor_t process, double timeout) [[block]]; int process_sleep(double duration) [[block]]; boost::intrusive_ptr execution_start(const char* name, double flops_amount, double priority, double bound); -boost::intrusive_ptr execution_parallel_start(const char* name, int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount, double amount, double rate, double timeout) [[nohandler]]; +boost::intrusive_ptr execution_parallel_start(const char* name, int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount, double rate, double timeout) [[nohandler]]; void execution_cancel(boost::intrusive_ptr execution) [[nohandler]]; void execution_set_priority(boost::intrusive_ptr execution, double priority) [[nohandler]]; void execution_set_bound(boost::intrusive_ptr execution, double bound) [[nohandler]]; diff --git a/src/simix/smx_host.cpp b/src/simix/smx_host.cpp index bc6c5a7877..3fb82a4878 100644 --- a/src/simix/smx_host.cpp +++ b/src/simix/smx_host.cpp @@ -29,17 +29,13 @@ namespace simgrid { { /* Clean Simulator data */ if (xbt_swag_size(process_list) != 0) { - char *msg = xbt_strdup("Shutting down host, but it's not empty:"); - char *tmp; + std::string msg = std::string("Shutting down host, but it's not empty:"); smx_actor_t process = nullptr; - xbt_swag_foreach(process, process_list) { - tmp = bprintf("%s\n\t%s", msg, process->name.c_str()); - free(msg); - msg = tmp; - } + xbt_swag_foreach(process, process_list) msg = msg + "\n\t" + process->name.c_str(); + SIMIX_display_process_status(); - THROWF(arg_error, 0, "%s", msg); + THROWF(arg_error, 0, "%s", msg.c_str()); } for (auto arg : auto_restart_processes) delete arg; @@ -186,7 +182,7 @@ SIMIX_execution_start(smx_actor_t issuer, const char* name, double flops_amount, boost::intrusive_ptr SIMIX_execution_parallel_start(const char* name, int host_nb, sg_host_t* host_list, double* flops_amount, - double* bytes_amount, double amount, double rate, double timeout) + double* bytes_amount, double rate, double timeout) { /* alloc structures and initialize */ diff --git a/src/simix/smx_host_private.h b/src/simix/smx_host_private.h index a642409d10..ffdcd20074 100644 --- a/src/simix/smx_host_private.h +++ b/src/simix/smx_host_private.h @@ -62,7 +62,7 @@ XBT_PRIVATE boost::intrusive_ptr SIMIX_execution_start(smx_actor_t issuer, const char* name, double flops_amount, double priority, double bound); XBT_PRIVATE boost::intrusive_ptr SIMIX_execution_parallel_start(const char* name, int host_nb, sg_host_t* host_list, double* flops_amount, - double* bytes_amount, double amount, double rate, double timeout); + double* bytes_amount, double rate, double timeout); #endif -- 2.20.1