#include <memory>
#include <numeric>
#include <unordered_map>
+#include <sstream>
#include <vector>
using simgrid::s4u::Actor;
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_replay,smpi,"Trace Replay with SMPI");
-static int active_processes = 0;
static std::unordered_map<int, std::vector<MPI_Request>*> reqq;
static MPI_Datatype MPI_DEFAULT_TYPE;
#define CHECK_ACTION_PARAMS(action, mandatory, optional) \
{ \
- if (action.size() < static_cast<unsigned long>(mandatory + 2)) \
+ if (action.size() < static_cast<unsigned long>(mandatory + 2)) { \
+ std::stringstream ss; \
+ for (const auto& elem : action) { \
+ ss << elem << " "; \
+ } \
THROWF(arg_error, 0, "%s replay failed.\n" \
"%zu items were given on the line. First two should be process_id and action. " \
"This action needs after them %lu mandatory arguments, and accepts %lu optional ones. \n" \
+ "The full line that was given is:\n %s\n" \
"Please contact the Simgrid team if support is needed", \
- __func__, action.size(), static_cast<unsigned long>(mandatory), static_cast<unsigned long>(optional)); \
+ __func__, action.size(), static_cast<unsigned long>(mandatory), static_cast<unsigned long>(optional), ss.str().c_str()); \
+ }\
}
static void log_timed_action(simgrid::xbt::ReplayAction& action, double clock)
explicit SendAction(std::string name) : ReplayAction(name) {}
void kernel(simgrid::xbt::ReplayAction& action) override
{
- int dst_traced = MPI_COMM_WORLD->group()->actor(args.partner)->getPid();
+ int dst_traced = MPI_COMM_WORLD->group()->actor(args.partner)->get_pid();
TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::Pt2PtTIData(name, args.partner, args.size,
Datatype::encode(args.datatype1)));
explicit RecvAction(std::string name) : ReplayAction(name) {}
void kernel(simgrid::xbt::ReplayAction& action) override
{
- int src_traced = MPI_COMM_WORLD->group()->actor(args.partner)->getPid();
+ int src_traced = MPI_COMM_WORLD->group()->actor(args.partner)->get_pid();
TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::Pt2PtTIData(name, args.partner, args.size,
Datatype::encode(args.datatype1)));
/* start a simulated timer */
smpi_process()->simulated_start();
- /*initialize the number of active processes */
- active_processes = smpi_process_count();
-
set_reqq_self(new std::vector<MPI_Request>);
}
};
void kernel(simgrid::xbt::ReplayAction& action) override
{
TRACE_smpi_comm_in(my_proc_id, "action_bcast",
- new simgrid::instr::CollTIData("bcast", MPI_COMM_WORLD->group()->actor(args.root)->getPid(),
+ new simgrid::instr::CollTIData("bcast", MPI_COMM_WORLD->group()->actor(args.root)->get_pid(),
-1.0, args.size, -1, Datatype::encode(args.datatype1), ""));
Colls::bcast(send_buffer(args.size * args.datatype1->size()), args.size, args.datatype1, args.root, MPI_COMM_WORLD);
void kernel(simgrid::xbt::ReplayAction& action) override
{
TRACE_smpi_comm_in(my_proc_id, "action_reduce",
- new simgrid::instr::CollTIData("reduce", MPI_COMM_WORLD->group()->actor(args.root)->getPid(), args.comp_size,
- args.comm_size, -1, Datatype::encode(args.datatype1), ""));
+ new simgrid::instr::CollTIData("reduce", MPI_COMM_WORLD->group()->actor(args.root)->get_pid(),
+ args.comp_size, args.comm_size, -1,
+ Datatype::encode(args.datatype1), ""));
Colls::reduce(send_buffer(args.comm_size * args.datatype1->size()),
recv_buffer(args.comm_size * args.datatype1->size()), args.comm_size, args.datatype1, MPI_OP_NULL, args.root, MPI_COMM_WORLD);
/** @brief actually run the replay after initialization */
void smpi_replay_main(int* argc, char*** argv)
{
+ static int active_processes = 0;
+ active_processes++;
simgrid::xbt::replay_runner(*argc, *argv);
/* and now, finalize everything */