#include <unordered_map>
#include <vector>
-#define KEY_SIZE (sizeof(int) * 2 + 1)
-
using simgrid::s4u::Actor;
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_replay,smpi,"Trace Replay with SMPI");
-int communicator_size = 0;
-static int active_processes = 0;
-std::unordered_map<int,std::vector<MPI_Request>*> reqq;
+static int communicator_size = 0;
+static int active_processes = 0;
+static std::unordered_map<int, std::vector<MPI_Request>*> reqq;
-MPI_Datatype MPI_DEFAULT_TYPE;
-MPI_Datatype MPI_CURRENT_TYPE;
+static MPI_Datatype MPI_DEFAULT_TYPE;
+static MPI_Datatype MPI_CURRENT_TYPE;
-static int sendbuffer_size=0;
-char* sendbuffer=nullptr;
-static int recvbuffer_size=0;
-char* recvbuffer=nullptr;
+static int sendbuffer_size = 0;
+static char* sendbuffer = nullptr;
+static int recvbuffer_size = 0;
+static char* recvbuffer = nullptr;
static void log_timed_action (const char *const *action, double clock){
if (XBT_LOG_ISENABLED(smpi_replay, xbt_log_priority_verbose)){
{
switch(atoi(action)) {
case 0:
- MPI_CURRENT_TYPE=MPI_DOUBLE;
+ return MPI_DOUBLE;
break;
case 1:
- MPI_CURRENT_TYPE=MPI_INT;
+ return MPI_INT;
break;
case 2:
- MPI_CURRENT_TYPE=MPI_CHAR;
+ return MPI_CHAR;
break;
case 3:
- MPI_CURRENT_TYPE=MPI_SHORT;
+ return MPI_SHORT;
break;
case 4:
- MPI_CURRENT_TYPE=MPI_LONG;
+ return MPI_LONG;
break;
case 5:
- MPI_CURRENT_TYPE=MPI_FLOAT;
+ return MPI_FLOAT;
break;
case 6:
- MPI_CURRENT_TYPE=MPI_BYTE;
+ return MPI_BYTE;
break;
default:
- MPI_CURRENT_TYPE=MPI_DEFAULT_TYPE;
+ return MPI_DEFAULT_TYPE;
break;
}
- return MPI_CURRENT_TYPE;
}
const char* encode_datatype(MPI_Datatype datatype)
double clock = smpi_process()->simulated_elapsed();
int root = (action[3]) ? atoi(action[3]) : 0;
/* Initialize MPI_CURRENT_TYPE in order to decrease the number of the checks */
- MPI_CURRENT_TYPE= MPI_DEFAULT_TYPE;
-
MPI_CURRENT_TYPE = (action[3] && action[4]) ? decode_datatype(action[4]) : MPI_DEFAULT_TYPE;
int my_proc_id = Actor::self()->getPid();
if(rank==root)
recv = smpi_get_tmp_recvbuffer(recv_sum* MPI_CURRENT_TYPE2->size());
- std::vector<int>* trace_recvcounts = new std::vector<int>;
- for (int i = 0; i < comm_size; i++) // copy data to avoid bad free
- trace_recvcounts->push_back(recvcounts[i]);
+ std::vector<int>* trace_recvcounts = new std::vector<int>(recvcounts, recvcounts + comm_size);
TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::VarCollTIData(
"gatherV", root, send_size, nullptr, -1, trace_recvcounts,
if (rank == root)
send = smpi_get_tmp_sendbuffer(send_sum * MPI_CURRENT_TYPE2->size());
- std::vector<int>* trace_sendcounts = new std::vector<int>;
- for (int i = 0; i < comm_size; i++) // copy data to avoid bad free
- trace_sendcounts->push_back(sendcounts[i]);
+ std::vector<int>* trace_sendcounts = new std::vector<int>(sendcounts, sendcounts + comm_size);
TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::VarCollTIData(
"gatherV", root, -1, trace_sendcounts, recv_size, nullptr,
int my_proc_id = Actor::self()->getPid();
- std::vector<int>* trace_recvcounts = new std::vector<int>;
- for (int i = 0; i < comm_size; i++) // copy data to avoid bad free
- trace_recvcounts->push_back(recvcounts[i]);
+ std::vector<int>* trace_recvcounts = new std::vector<int>(recvcounts, recvcounts + comm_size);
TRACE_smpi_comm_in(my_proc_id, __FUNCTION__,
new simgrid::instr::VarCollTIData("allGatherV", -1, sendcount, nullptr, -1, trace_recvcounts,