class ComputeParser : public ActionArgParser {
public:
- /* communication partner; if we send, this is the receiver and vice versa */
double flops;
void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override;
};
+class LocationParser : public ActionArgParser {
+public:
+ std::string filename;
+ int line;
+
+ void parse(simgrid::xbt::ReplayAction& action, const std::string& name) override;
+};
+
class CollCommParser : public ActionArgParser {
public:
double size;
void kernel(simgrid::xbt::ReplayAction& action) override;
};
+class LocationAction : public ReplayAction<LocationParser> {
+public:
+ explicit LocationAction() : ReplayAction("location") {}
+ void kernel(simgrid::xbt::ReplayAction& action) override;
+};
+
class TestAction : public ReplayAction<WaitTestParser> {
private:
RequestStorage& req_storage;
return;
/* Unimplemented calls are: WAITANY, SENDRECV, SCAN, EXSCAN, SSEND, and ISSEND. */
-
+ std::string container_name(get_container()->get_name());
// FIXME: dirty extract "rank-" from the name, as we want the bare process id here
- if (get_container()->get_name().find("rank-") != 0) {
- stream_ << get_container()->get_name() << " " << extra_->print();
- } else {
+ if (get_container()->get_name().find("rank-") == 0) {
/* Subtract -1 because this is the process id and we transform it to the rank id */
- std::string container_name(get_container()->get_name());
- stream_ << stoi(container_name.erase(0, 5)) - 1 << " " << extra_->print();
+ container_name=std::to_string(stoi(container_name.erase(0, 5)) - 1);
+ }
+ #if HAVE_SMPI
+ if (simgrid::config::get_value<bool>("smpi/trace-call-location")) {
+ stream_ << container_name << " location " << filename << " " << linenumber << std::endl ;
}
+ #endif
+ stream_ << container_name << " " << extra_->print();
*tracing_files.at(get_container()) << stream_.str() << std::endl;
} else {
THROW_IMPOSSIBLE;
XBT_PRIVATE void smpi_bench_begin();
XBT_PRIVATE void smpi_bench_end();
XBT_PRIVATE void smpi_shared_destroy();
+XBT_PRIVATE double smpi_adjust_comp_speed();
XBT_PRIVATE unsigned char* smpi_get_tmp_sendbuffer(size_t size);
XBT_PRIVATE unsigned char* smpi_get_tmp_recvbuffer(size_t size);
xbt_os_threadtimer_start(smpi_process()->timer());
}
+double smpi_adjust_comp_speed(){
+ double speedup=1;
+ if (simgrid::config::get_value<std::string>("smpi/comp-adjustment-file")[0] != '\0') {
+
+ smpi_trace_call_location_t* loc = smpi_process()->call_location();
+ std::string key = loc->get_composed_key();
+ std::unordered_map<std::string, double>::const_iterator it = location2speedup.find(key);
+ if (it != location2speedup.end()) {
+ speedup = it->second;
+ }
+ }
+ return speedup;
+}
+
void smpi_bench_end()
{
if (MC_is_active() || MC_record_replay_is_active())
return;
- double speedup = 1;
xbt_os_timer_t timer = smpi_process()->timer();
xbt_os_threadtimer_stop(timer);
}
// Maybe we need to artificially speed up or slow down our computation based on our statistical analysis.
- if (simgrid::config::get_value<std::string>("smpi/comp-adjustment-file")[0] != '\0') {
-
- smpi_trace_call_location_t* loc = smpi_process()->call_location();
- std::string key = loc->get_composed_key();
- std::unordered_map<std::string, double>::const_iterator it = location2speedup.find(key);
- if (it != location2speedup.end()) {
- speedup = it->second;
- }
- }
-
// Simulate the benchmarked computation unless disabled via command-line argument
if (simgrid::config::get_value<bool>("smpi/simulate-computation")) {
- smpi_execute(xbt_os_timer_elapsed(timer)/speedup);
+ smpi_execute(xbt_os_timer_elapsed(timer)/smpi_adjust_comp_speed());
}
#if HAVE_PAPI
flops = parse_double(action[2]);
}
+void LocationParser::parse(simgrid::xbt::ReplayAction& action, const std::string&)
+{
+ CHECK_ACTION_PARAMS(action, 2, 0)
+ filename = std::string(action[2]);
+ line = std::stoi(action[3]);
+}
+
void BcastArgParser::parse(simgrid::xbt::ReplayAction& action, const std::string&)
{
CHECK_ACTION_PARAMS(action, 1, 2)
void ComputeAction::kernel(simgrid::xbt::ReplayAction&)
{
- smpi_execute_flops(args.flops);
+ smpi_execute_flops(args.flops/smpi_adjust_comp_speed());
+}
+
+void LocationAction::kernel(simgrid::xbt::ReplayAction&)
+{
+ smpi_trace_set_call_location(args.filename.c_str(), args.line);
}
void TestAction::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("location", [](simgrid::xbt::ReplayAction& action) { simgrid::smpi::replay::LocationAction().execute(action); });
//if we have a delayed start, sleep here.
if (start_delay_flops > 0) {