void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override;
};
+class SleepParser : public ActionArgParser {
+public:
+ double time;
+
+ void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override;
+};
+
class LocationParser : public ActionArgParser {
public:
std::string filename;
void kernel(simgrid::xbt::ReplayAction& action) override;
};
+class SleepAction : public ReplayAction<SleepParser> {
+public:
+ explicit SleepAction() : ReplayAction("sleep") {}
+ void kernel(simgrid::xbt::ReplayAction& action) override;
+};
+
class LocationAction : public ReplayAction<LocationParser> {
public:
explicit LocationAction() : ReplayAction("location") {}
#endif
#include <smpi/smpi_helpers_internal.h>
-
+#ifndef TRACE_CALL_LOCATION /* Defined by smpicc on the command line */
#define sleep(x) smpi_sleep(x)
#define usleep(x) smpi_usleep(x)
+#else
+#define sleep(x) ({ smpi_trace_set_call_location(__FILE__,__LINE__); smpi_sleep(x); })
+#define usleep(x) ({ smpi_trace_set_call_location(__FILE__,__LINE__); smpi_usleep(x); })
+#endif
+
#define gettimeofday(x, y) smpi_gettimeofday((x), 0)
#if _POSIX_TIMERS > 0
+#ifndef TRACE_CALL_LOCATION /* Defined by smpicc on the command line */
#define nanosleep(x, y) smpi_nanosleep((x), (y))
+#else
+#define nanosleep(x) ({ smpi_trace_set_call_location(__FILE__,__LINE__); smpi_nanosleep(x); })
+#endif
#define clock_gettime(x, y) smpi_clock_gettime((x), (y))
#endif
flops = parse_double(action[2]);
}
+void SleepParser::parse(simgrid::xbt::ReplayAction& action, const std::string&)
+{
+ CHECK_ACTION_PARAMS(action, 1, 0)
+ time = parse_double(action[2]);
+}
+
void LocationParser::parse(simgrid::xbt::ReplayAction& action, const std::string&)
{
CHECK_ACTION_PARAMS(action, 2, 0)
void ComputeAction::kernel(simgrid::xbt::ReplayAction&)
{
smpi_execute_flops(args.flops/smpi_adjust_comp_speed());
+
+void SleepAction::kernel(simgrid::xbt::ReplayAction&)
+{
+ XBT_DEBUG("Sleep for: %lf secs", args.time);
+ int rank = simgrid::s4u::this_actor::get_pid();
+ TRACE_smpi_sleeping_in(rank, args.time);
+ simgrid::s4u::this_actor::sleep_for(args.time/smpi_adjust_comp_speed());
+ TRACE_smpi_sleeping_out(rank);
}
void LocationAction::kernel(simgrid::xbt::ReplayAction&)
xbt_replay_action_register("allgatherv", [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::GatherVAction("allgatherv").execute(action); });
xbt_replay_action_register("reducescatter", [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::ReduceScatterAction().execute(action); });
xbt_replay_action_register("compute", [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::ComputeAction().execute(action); });
+ xbt_replay_action_register("sleep", [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::SleepAction().execute(action); });
xbt_replay_action_register("location", [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::LocationAction().execute(action); });
//if we have a delayed start, sleep here.