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);
XBT_PUBLIC(void) SIMIX_mutex_unref(smx_mutex_t mutex);
XBT_PUBLIC(void) simcall_mutex_lock(smx_mutex_t mutex);
XBT_PUBLIC(int) simcall_mutex_trylock(smx_mutex_t mutex);
-XBT_PUBLIC(void) simcall_mutex_unlock(smx_mutex_t mutex);
XBT_PUBLIC(smx_cond_t) simcall_cond_init();
XBT_PUBLIC(void) SIMIX_cond_unref(smx_cond_t cond);
simdata->compute =
boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(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<simgrid::kernel::activity::ExecImpl>(
*/
void Mutex::unlock()
{
- simcall_mutex_unlock(mutex_);
+ smx_actor_t self = SIMIX_process_self();
+ simgrid::simix::kernelImmediate([this, self] { return mutex_->unlock(self); });
}
/** @brief Acquire the mutex if it's free, and return false (without blocking) if not */
* \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) {
}
}
- 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);
}
/**
return simcall_BODY_mutex_trylock(mutex);
}
-/**
- * \ingroup simix_synchro_management
- *
- */
-void simcall_mutex_unlock(smx_mutex_t mutex)
-{
- simcall_BODY_mutex_unlock(mutex);
-}
-
/**
* \ingroup simix_synchro_management
*
{
simgrid::simix::marshal<double*>(simcall->args[4], arg);
}
-static inline double simcall_execution_parallel_start__get__amount(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<double>(simcall->args[5]);
-}
-static inline double simcall_execution_parallel_start__getraw__amount(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<double>(simcall->args[5]);
-}
-static inline void simcall_execution_parallel_start__set__amount(smx_simcall_t simcall, double arg)
-{
- simgrid::simix::marshal<double>(simcall->args[5], arg);
-}
static inline double simcall_execution_parallel_start__get__rate(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal<double>(simcall->args[6]);
+ return simgrid::simix::unmarshal<double>(simcall->args[5]);
}
static inline double simcall_execution_parallel_start__getraw__rate(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal_raw<double>(simcall->args[6]);
+ return simgrid::simix::unmarshal_raw<double>(simcall->args[5]);
}
static inline void simcall_execution_parallel_start__set__rate(smx_simcall_t simcall, double arg)
{
- simgrid::simix::marshal<double>(simcall->args[6], arg);
+ simgrid::simix::marshal<double>(simcall->args[5], arg);
}
static inline double simcall_execution_parallel_start__get__timeout(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal<double>(simcall->args[7]);
+ return simgrid::simix::unmarshal<double>(simcall->args[6]);
}
static inline double simcall_execution_parallel_start__getraw__timeout(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal_raw<double>(simcall->args[7]);
+ return simgrid::simix::unmarshal_raw<double>(simcall->args[6]);
}
static inline void simcall_execution_parallel_start__set__timeout(smx_simcall_t simcall, double arg)
{
- simgrid::simix::marshal<double>(simcall->args[7], arg);
+ simgrid::simix::marshal<double>(simcall->args[6], arg);
}
static inline boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>
simcall_execution_parallel_start__get__result(smx_simcall_t simcall)
simgrid::simix::marshal<int>(simcall->result, result);
}
-static inline smx_mutex_t simcall_mutex_unlock__get__mutex(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[0]);
-}
-static inline smx_mutex_t simcall_mutex_unlock__getraw__mutex(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<smx_mutex_t>(simcall->args[0]);
-}
-static inline void simcall_mutex_unlock__set__mutex(smx_simcall_t simcall, smx_mutex_t arg)
-{
- simgrid::simix::marshal<smx_mutex_t>(simcall->args[0], arg);
-}
-
static inline smx_cond_t simcall_cond_init__get__result(smx_simcall_t simcall)
{
return simgrid::simix::unmarshal<smx_cond_t>(simcall->result);
XBT_PRIVATE smx_mutex_t simcall_HANDLER_mutex_init(smx_simcall_t simcall);
XBT_PRIVATE void simcall_HANDLER_mutex_lock(smx_simcall_t simcall, smx_mutex_t mutex);
XBT_PRIVATE int simcall_HANDLER_mutex_trylock(smx_simcall_t simcall, smx_mutex_t mutex);
-XBT_PRIVATE void simcall_HANDLER_mutex_unlock(smx_simcall_t simcall, smx_mutex_t mutex);
XBT_PRIVATE void simcall_HANDLER_cond_wait(smx_simcall_t simcall, smx_cond_t cond, smx_mutex_t mutex);
XBT_PRIVATE void simcall_HANDLER_cond_wait_timeout(smx_simcall_t simcall, smx_cond_t cond, smx_mutex_t mutex, double timeout);
XBT_PRIVATE void simcall_HANDLER_sem_release(smx_simcall_t simcall, smx_sem_t sem);
inline static boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>
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<boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>, 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
return simcall<int, smx_mutex_t>(SIMCALL_MUTEX_TRYLOCK, mutex);
}
-inline static void simcall_BODY_mutex_unlock(smx_mutex_t mutex) {
- /* Go to that function to follow the code flow through the simcall barrier */
- if (0) simcall_HANDLER_mutex_unlock(&SIMIX_process_self()->simcall, mutex);
- return simcall<void, smx_mutex_t>(SIMCALL_MUTEX_UNLOCK, mutex);
- }
-
inline static smx_cond_t simcall_BODY_cond_init() {
/* Go to that function to follow the code flow through the simcall barrier */
if (0) SIMIX_cond_init();
SIMCALL_MUTEX_INIT,
SIMCALL_MUTEX_LOCK,
SIMCALL_MUTEX_TRYLOCK,
- SIMCALL_MUTEX_UNLOCK,
SIMCALL_COND_INIT,
SIMCALL_COND_SIGNAL,
SIMCALL_COND_WAIT,
"SIMCALL_MUTEX_INIT",
"SIMCALL_MUTEX_LOCK",
"SIMCALL_MUTEX_TRYLOCK",
- "SIMCALL_MUTEX_UNLOCK",
"SIMCALL_COND_INIT",
"SIMCALL_COND_SIGNAL",
"SIMCALL_COND_WAIT",
simgrid::simix::unmarshal<const char*>(simcall->args[0]), simgrid::simix::unmarshal<int>(simcall->args[1]),
simgrid::simix::unmarshal<sg_host_t*>(simcall->args[2]), simgrid::simix::unmarshal<double*>(simcall->args[3]),
simgrid::simix::unmarshal<double*>(simcall->args[4]), simgrid::simix::unmarshal<double>(simcall->args[5]),
- simgrid::simix::unmarshal<double>(simcall->args[6]), simgrid::simix::unmarshal<double>(simcall->args[7])));
+ simgrid::simix::unmarshal<double>(simcall->args[6])));
SIMIX_simcall_answer(simcall);
break;
SIMIX_simcall_answer(simcall);
break;
-case SIMCALL_MUTEX_UNLOCK:
- simcall_HANDLER_mutex_unlock(simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[0]));
- SIMIX_simcall_answer(simcall);
- break;
-
case SIMCALL_COND_INIT:
simgrid::simix::marshal<smx_cond_t>(simcall->result, SIMIX_cond_init());
SIMIX_simcall_answer(simcall);
int process_sleep(double duration) [[block]];
boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl> execution_start(const char* name, double flops_amount, double priority, double bound);
-boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl> 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<simgrid::kernel::activity::ExecImpl> 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<simgrid::kernel::activity::ActivityImpl> execution) [[nohandler]];
void execution_set_priority(boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> execution, double priority) [[nohandler]];
void execution_set_bound(boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> execution, double bound) [[nohandler]];
smx_mutex_t mutex_init();
void mutex_lock(smx_mutex_t mutex) [[block]];
int mutex_trylock(smx_mutex_t mutex);
-void mutex_unlock(smx_mutex_t mutex);
smx_cond_t cond_init() [[nohandler]];
void cond_signal(smx_cond_t cond) [[nohandler]];
{
/* 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;
+ 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;
boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>
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 */
SIMIX_execution_start(smx_actor_t issuer, const char* name, double flops_amount, double priority, double bound);
XBT_PRIVATE boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>
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
return mutex->try_lock(simcall->issuer);
}
-void simcall_HANDLER_mutex_unlock(smx_simcall_t simcall, smx_mutex_t mutex)
-{
- mutex->unlock(simcall->issuer);
-}
-
/********************************* Condition **********************************/
/**
#include "xbt/synchro.h"
#include "simgrid/simix.h" /* used implementation */
+#include "src/simix/smx_synchro_private.hpp"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_sync, xbt, "Synchronization mechanism");
void xbt_mutex_release(xbt_mutex_t mutex)
{
- simcall_mutex_unlock((smx_mutex_t)mutex);
+ ((smx_mutex_t)mutex)->unlock(SIMIX_process_self());
}
void xbt_mutex_destroy(xbt_mutex_t mutex)