simcall_execution_wait(simgrid::kernel::activity::ActivityImpl* execution, double timeout);
XBT_ATTRIB_DEPRECATED_v330("Please use s4u::Exec::wait_for()") XBT_PUBLIC simgrid::kernel::activity::State
simcall_execution_wait(const simgrid::kernel::activity::ActivityImplPtr& execution, double timeout);
-XBT_PUBLIC unsigned int simcall_execution_waitany_for(simgrid::kernel::activity::ExecImpl* execs[], size_t count,
- double timeout);
+XBT_ATTRIB_DEPRECATED_v331("Please use s4u::Exec::wait_any_for()") XBT_PUBLIC
+ unsigned int simcall_execution_waitany_for(simgrid::kernel::activity::ExecImpl* execs[], size_t count,
+ double timeout);
XBT_ATTRIB_DEPRECATED_v330("Please use s4u::Exec::test()") XBT_PUBLIC
bool simcall_execution_test(simgrid::kernel::activity::ActivityImpl* execution);
XBT_ATTRIB_DEPRECATED_v330("Please use s4u::Exec::test()") XBT_PUBLIC
#include "simgrid/kernel/routing/NetPoint.hpp"
#include "simgrid/modelchecker.h"
#include "simgrid/s4u/Exec.hpp"
+#include "src/mc/checker/SimcallObserver.hpp"
#include "src/mc/mc_replay.hpp"
#include "src/surf/HostImpl.hpp"
#include "src/surf/cpu_interface.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_process);
-void simcall_HANDLER_execution_waitany_for(smx_simcall_t simcall,
- const std::vector<simgrid::kernel::activity::ExecImpl*>* execs,
- double timeout)
-{
- simgrid::kernel::activity::ExecImpl::wait_any_for(simcall->issuer_, execs, timeout);
-}
-
namespace simgrid {
namespace kernel {
namespace activity {
if (simcall->call_ == simix::Simcall::NONE) // FIXME: maybe a better way to handle this case
continue; // if process handling comm is killed
- if (simcall->call_ == simix::Simcall::EXECUTION_WAITANY_FOR) {
- const std::vector<simgrid::kernel::activity::ExecImpl*>* execs =
- simcall_execution_waitany_for__get__execs(simcall);
+ if (const auto* observer = dynamic_cast<mc::ExecutionWaitanySimcall*>(simcall->observer_)) {
+ const auto* execs = observer->get_execs();
for (auto* exec : *execs) {
// Remove the first occurrence of simcall:
if (not MC_is_active() && not MC_record_replay_is_active()) {
auto element = std::find(execs->begin(), execs->end(), this);
int rank = (element != execs->end()) ? std::distance(execs->begin(), element) : -1;
- simcall_execution_waitany_for__set__result(simcall, rank);
+ simix::marshal<int>(simcall->result_, rank);
}
}
switch (state_) {
if (j != exec->simcalls_.end())
exec->simcalls_.erase(j);
}
- simcall_execution_waitany_for__set__result(&issuer->simcall_, -1);
+ simix::marshal<int>(issuer->simcall_.result_, -1);
issuer->simcall_answer();
});
}
}
return true;
}
+
+std::string ExecutionWaitanySimcall::to_string(int time_considered) const
+{
+ std::string res = SimcallObserver::to_string(time_considered) + "Execution WAITANY";
+ res += "(" + (timeout_ == -1.0 ? "" : std::to_string(timeout_)) + ")";
+ return res;
+}
+
+std::string ExecutionWaitanySimcall::dot_label() const
+{
+ return SimcallObserver::dot_label() + "Execution WAITANY";
+}
} // namespace mc
} // namespace simgrid
kernel::activity::SemaphoreImpl* get_sem() const { return sem_; }
double get_timeout() const { return timeout_; }
};
+
+class ExecutionWaitanySimcall : public SimcallObserver {
+ const std::vector<kernel::activity::ExecImpl*>* const execs_;
+ const double timeout_;
+
+public:
+ ExecutionWaitanySimcall(smx_actor_t actor, const std::vector<kernel::activity::ExecImpl*>* execs, double timeout)
+ : SimcallObserver(actor), execs_(execs), timeout_(timeout)
+ {
+ }
+ bool is_visible() const override { return false; }
+ std::string to_string(int times_considered) const override;
+ std::string dot_label() const override;
+ const std::vector<kernel::activity::ExecImpl*>* get_execs() const { return execs_; }
+ double get_timeout() const { return timeout_; }
+};
} // namespace mc
} // namespace simgrid
#include "simgrid/s4u/Exec.hpp"
#include "src/kernel/activity/ExecImpl.hpp"
#include "src/kernel/actor/ActorImpl.hpp"
+#include "src/mc/checker/SimcallObserver.hpp"
#include "xbt/log.h"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(s4u_exec, s4u_activity, "S4U asynchronous executions");
std::transform(begin(*execs), end(*execs), begin(rexecs),
[](const ExecPtr& exec) { return static_cast<kernel::activity::ExecImpl*>(exec->pimpl_.get()); });
- int changed_pos = simcall_execution_waitany_for(rexecs.data(), rexecs.size(), timeout);
+ kernel::actor::ActorImpl* issuer = kernel::actor::ActorImpl::self();
+ mc::ExecutionWaitanySimcall observer{issuer, &rexecs, timeout};
+ kernel::actor::simcall_blocking<void>(
+ [&observer] {
+ kernel::activity::ExecImpl::wait_any_for(observer.get_issuer(), observer.get_execs(), observer.get_timeout());
+ },
+ &observer);
+ int changed_pos = simgrid::simix::unmarshal<int>(issuer->simcall_.result_);
if (changed_pos != -1) {
on_completion(*(execs->at(changed_pos)));
execs->at(changed_pos)->release_dependencies();
return simgrid::kernel::actor::simcall([execution] { return execution->test(); });
}
-unsigned int simcall_execution_waitany_for(simgrid::kernel::activity::ExecImpl* execs[], size_t count, double timeout)
+unsigned int simcall_execution_waitany_for(simgrid::kernel::activity::ExecImpl* execs[], size_t count,
+ double timeout) // XBT_ATTRIB_DEPRECATED_v331
{
std::vector<simgrid::kernel::activity::ExecImpl*> execsv(execs, execs + count);
- return simcall_BODY_execution_waitany_for(&execsv, timeout);
+ simgrid::kernel::actor::ActorImpl* issuer = simgrid::kernel::actor::ActorImpl::self();
+ simgrid::mc::ExecutionWaitanySimcall observer{issuer, &execsv, timeout};
+ simgrid::kernel::actor::simcall_blocking<void>(
+ [&observer] {
+ simgrid::kernel::activity::ExecImpl::wait_any_for(observer.get_issuer(), observer.get_execs(),
+ observer.get_timeout());
+ },
+ &observer);
+ return simgrid::simix::unmarshal<int>(issuer->simcall_.result_);
}
void simcall_process_join(smx_actor_t process, double timeout) // XBT_ATTRIB_DEPRECATED_v328
*/
#include "src/simix/popping_private.hpp"
-static inline const std::vector<simgrid::kernel::activity::ExecImpl*>* simcall_execution_waitany_for__get__execs(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<const std::vector<simgrid::kernel::activity::ExecImpl*>*>(simcall->args_[0]);
-}
-static inline const std::vector<simgrid::kernel::activity::ExecImpl*>* simcall_execution_waitany_for__getraw__execs(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<const std::vector<simgrid::kernel::activity::ExecImpl*>*>(simcall->args_[0]);
-}
-static inline void simcall_execution_waitany_for__set__execs(smx_simcall_t simcall, const std::vector<simgrid::kernel::activity::ExecImpl*>* arg)
-{
- simgrid::simix::marshal<const std::vector<simgrid::kernel::activity::ExecImpl*>*>(simcall->args_[0], arg);
-}
-static inline double simcall_execution_waitany_for__get__timeout(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<double>(simcall->args_[1]);
-}
-static inline double simcall_execution_waitany_for__getraw__timeout(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<double>(simcall->args_[1]);
-}
-static inline void simcall_execution_waitany_for__set__timeout(smx_simcall_t simcall, double arg)
-{
- simgrid::simix::marshal<double>(simcall->args_[1], arg);
-}
-static inline int simcall_execution_waitany_for__get__result(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<int>(simcall->result_);
-}
-static inline int simcall_execution_waitany_for__getraw__result(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<int>(simcall->result_);
-}
-static inline void simcall_execution_waitany_for__set__result(smx_simcall_t simcall, int result)
-{
- simgrid::simix::marshal<int>(simcall->result_, result);
-}
-
static inline smx_actor_t simcall_comm_recv__get__receiver(smx_simcall_t simcall)
{
return simgrid::simix::unmarshal<smx_actor_t>(simcall->args_[0]);
/* The prototype of all simcall handlers, automatically generated for you */
-XBT_PRIVATE void simcall_HANDLER_execution_waitany_for(smx_simcall_t simcall, const std::vector<simgrid::kernel::activity::ExecImpl*>* execs, double timeout);
XBT_PRIVATE void simcall_HANDLER_comm_recv(smx_simcall_t simcall, smx_actor_t receiver, smx_mailbox_t mbox, unsigned char* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout, double rate);
XBT_PRIVATE boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> simcall_HANDLER_comm_irecv(smx_simcall_t simcall, smx_actor_t receiver, smx_mailbox_t mbox, unsigned char* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double rate);
XBT_PRIVATE void simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, unsigned char* 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);
return simgrid::simix::unmarshal<R>(self->simcall_.result_);
}
-inline static int simcall_BODY_execution_waitany_for(const std::vector<simgrid::kernel::activity::ExecImpl*>* execs, double timeout)
-{
- if (false) /* Go to that function to follow the code flow through the simcall barrier */
- simcall_HANDLER_execution_waitany_for(&SIMIX_process_self()->simcall_, execs, timeout);
- return simcall<int, const std::vector<simgrid::kernel::activity::ExecImpl*>*, double>(Simcall::EXECUTION_WAITANY_FOR, execs, timeout);
-}
-
inline static void simcall_BODY_comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, unsigned char* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout, double rate)
{
if (false) /* Go to that function to follow the code flow through the simcall barrier */
*/
enum class Simcall {
NONE,
- EXECUTION_WAITANY_FOR,
COMM_RECV,
COMM_IRECV,
COMM_SEND,
RUN_BLOCKING,
};
-constexpr int NUM_SIMCALLS = 12;
+constexpr int NUM_SIMCALLS = 11;
} // namespace simix
} // namespace simgrid
/** @brief Simcalls' names (generated from src/simix/simcalls.in) */
constexpr std::array<const char*, simgrid::simix::NUM_SIMCALLS> simcall_names{{
"Simcall::NONE",
- "Simcall::EXECUTION_WAITANY_FOR",
"Simcall::COMM_RECV",
"Simcall::COMM_IRECV",
"Simcall::COMM_SEND",
if (context_->wannadie())
return;
switch (simcall_.call_) {
- case Simcall::EXECUTION_WAITANY_FOR:
- simcall_HANDLER_execution_waitany_for(&simcall_, simgrid::simix::unmarshal<const std::vector<simgrid::kernel::activity::ExecImpl*>*>(simcall_.args_[0]), simgrid::simix::unmarshal<double>(simcall_.args_[1]));
- break;
-
case Simcall::COMM_RECV:
simcall_HANDLER_comm_recv(&simcall_, simgrid::simix::unmarshal<smx_actor_t>(simcall_.args_[0]), simgrid::simix::unmarshal<smx_mailbox_t>(simcall_.args_[1]), simgrid::simix::unmarshal<unsigned char*>(simcall_.args_[2]), simgrid::simix::unmarshal<size_t*>(simcall_.args_[3]), simgrid::simix::unmarshal<simix_match_func_t>(simcall_.args_[4]), simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall_.args_[5]), simgrid::simix::unmarshal<void*>(simcall_.args_[6]), simgrid::simix::unmarshal<double>(simcall_.args_[7]), simgrid::simix::unmarshal<double>(simcall_.args_[8]));
break;
# Last but not the least, you should declare the new simix call in
# ./include/simgrid/simix.h (otherwise you will get a warning at compile time)
-int execution_waitany_for(const std::vector<simgrid::kernel::activity::ExecImpl*>* execs, double timeout) [[block]];
-
void comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, unsigned char* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout, double rate) [[block]];
boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> comm_irecv(smx_actor_t receiver, smx_mailbox_t mbox, unsigned char* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double rate);
void comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, unsigned char* 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) [[block]];