X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9e3b2f1d55a07271c05db2ed5b3fec27561097f9..018dbe8afafe687069d74c58fea3a2f9a15a8085:/include/simgrid/smpi/replay.hpp diff --git a/include/simgrid/smpi/replay.hpp b/include/simgrid/smpi/replay.hpp index 7203e8a8d6..c0d6206869 100644 --- a/include/simgrid/smpi/replay.hpp +++ b/include/simgrid/smpi/replay.hpp @@ -16,14 +16,14 @@ #define CHECK_ACTION_PARAMS(action, mandatory, optional) \ { \ - if (action.size() < static_cast(mandatory + 2)) { \ + if ((action).size() < static_cast((mandatory) + 2)) { \ std::stringstream ss; \ ss << __func__ << " replay failed.\n" \ - << action.size() << " items were given on the line. First two should be process_id and action. " \ - << "This action needs after them " << mandatory << " mandatory arguments, and accepts " << optional \ + << (action).size() << " items were given on the line. First two should be process_id and action. " \ + << "This action needs after them " << (mandatory) << " mandatory arguments, and accepts " << (optional) \ << " optional ones. \n" \ << "The full line that was given is:\n "; \ - for (const auto& elem : action) { \ + for (const auto& elem : (action)) { \ ss << elem << " "; \ } \ ss << "\nPlease contact the Simgrid team if support is needed"; \ @@ -31,10 +31,8 @@ } \ } -XBT_PRIVATE void* smpi_get_tmp_sendbuffer(int size); -XBT_PRIVATE void* smpi_get_tmp_recvbuffer(int size); -XBT_PRIVATE void smpi_free_tmp_buffer(void* buf); -XBT_PRIVATE void smpi_free_replay_tmp_buffers(); +XBT_PRIVATE unsigned char* smpi_get_tmp_sendbuffer(size_t size); +XBT_PRIVATE unsigned char* smpi_get_tmp_recvbuffer(size_t size); XBT_PRIVATE void log_timed_action(simgrid::xbt::ReplayAction& action, double clock); @@ -76,12 +74,19 @@ public: 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; @@ -175,7 +180,7 @@ protected: T args; public: - explicit ReplayAction(std::string name) : name(std::move(name)), my_proc_id(simgrid::s4u::this_actor::get_pid()) {} + explicit ReplayAction(const std::string& name) : name(name), my_proc_id(simgrid::s4u::this_actor::get_pid()) {} virtual ~ReplayAction() = default; void execute(simgrid::xbt::ReplayAction& action) @@ -189,8 +194,8 @@ public: } virtual void kernel(simgrid::xbt::ReplayAction& action) = 0; - void* send_buffer(int size) { return smpi_get_tmp_sendbuffer(size); } - void* recv_buffer(int size) { return smpi_get_tmp_recvbuffer(size); } + unsigned char* send_buffer(int size) { return smpi_get_tmp_sendbuffer(size); } + unsigned char* recv_buffer(int size) { return smpi_get_tmp_recvbuffer(size); } }; class WaitAction : public ReplayAction { @@ -207,9 +212,7 @@ private: RequestStorage& req_storage; public: - explicit SendAction(std::string name, RequestStorage& storage) : ReplayAction(std::move(name)), req_storage(storage) - { - } + explicit SendAction(const std::string& name, RequestStorage& storage) : ReplayAction(name), req_storage(storage) {} void kernel(simgrid::xbt::ReplayAction& action) override; }; @@ -218,9 +221,7 @@ private: RequestStorage& req_storage; public: - explicit RecvAction(std::string name, RequestStorage& storage) : ReplayAction(std::move(name)), req_storage(storage) - { - } + explicit RecvAction(const std::string& name, RequestStorage& storage) : ReplayAction(name), req_storage(storage) {} void kernel(simgrid::xbt::ReplayAction& action) override; }; @@ -230,6 +231,12 @@ public: void kernel(simgrid::xbt::ReplayAction& action) override; }; +class LocationAction : public ReplayAction { +public: + explicit LocationAction() : ReplayAction("location") {} + void kernel(simgrid::xbt::ReplayAction& action) override; +}; + class TestAction : public ReplayAction { private: RequestStorage& req_storage; @@ -292,13 +299,13 @@ public: class GatherAction : public ReplayAction { public: - explicit GatherAction(std::string name) : ReplayAction(std::move(name)) {} + explicit GatherAction(const std::string& name) : ReplayAction(name) {} void kernel(simgrid::xbt::ReplayAction& action) override; }; class GatherVAction : public ReplayAction { public: - explicit GatherVAction(std::string name) : ReplayAction(std::move(name)) {} + explicit GatherVAction(const std::string& name) : ReplayAction(name) {} void kernel(simgrid::xbt::ReplayAction& action) override; };