Commit 2417f106 authored by Shen Yu's avatar Shen Yu
Browse files

modified: Makefile

	modified:   createMPIComm.cpp
	modified:   createMPIComm.h
	modified:   mpi_player.cpp
	modified:   read_run.cpp
	modified:   read_run.h

    1. fix paser input file error
    2. add debug option
parent f46a509d
OPT = -std=c++11 -D_DEBUG
mpi_player: createMPIComm.o read_run.o mpi_player.o
mpicxx -o mpi_player createMPIComm.o read_run.o mpi_player.o
mpicxx -o mpi_player createMPIComm.o read_run.o mpi_player.o $(OPT)
createMPIComm.o: createMPIComm.cpp
mpicxx -c createMPIComm.cpp
mpicxx -c createMPIComm.cpp $(OPT)
read_run.o: read_run.cpp
mpicxx -c read_run.cpp
mpicxx -c read_run.cpp $(OPT)
mpi_player.o: mpi_player.cpp
mpicxx -c mpi_player.cpp
mpicxx -c mpi_player.cpp $(OPT)
clean:
rm mpi_player *.o 2>/dev/null
......@@ -5,13 +5,27 @@
#include <cstring>
#include <mpi.h>
#ifdef _DEBUG
#include <cstdio>
#endif
using namespace std;
int createMPIComm(ifstream& inFile, map<int, MPI_Comm>& COMM_LIST)
int createMPIComm(char* INPUTFILENAME, map<int, MPI_Comm>& COMM_LIST)
{
int myid;
MPI_Comm_rank(MPI_COMM_WORLD, &myid);
int nComm = 0;
string logline;
set<int> my_comm_ids;
ifstream inFile;
inFile.open(INPUTFILENAME);
#ifdef _DEBUG
printf("myid: %d: input filename: %s\n", myid, INPUTFILENAME);
#endif
while (getline(inFile, logline))
{
double LOG_CALLTIME, LOG_ENDTIME;
......@@ -19,6 +33,11 @@ int createMPIComm(ifstream& inFile, map<int, MPI_Comm>& COMM_LIST)
sscanf(logline.c_str(), "%lf, %lf, %d, %d", &LOG_CALLTIME, &LOG_ENDTIME, &FUNC_ID, &COMM_ID);
my_comm_ids.insert(COMM_ID);
}
inFile.close();
#ifdef _DEBUG
printf("myid: %d: total comms: %d\n", myid, my_comm_ids.size());
#endif
// every process collects numbers of comms of all processes
int nprocs;
......@@ -26,6 +45,11 @@ int createMPIComm(ifstream& inFile, map<int, MPI_Comm>& COMM_LIST)
vector<int> ncomm(nprocs);
int my_ncomm = my_comm_ids.size();
MPI_Allgather(&my_ncomm, 1, MPI_INT, &ncomm[0], 1, MPI_INT, MPI_COMM_WORLD);
#ifdef _DEBUG
printf("myid: %d: my_ncomm: %d\n", myid, my_ncomm);
#endif
// every process collects all comms from all processes
// every process transform comms from set to sendbuf and
......@@ -45,6 +69,10 @@ int createMPIComm(ifstream& inFile, map<int, MPI_Comm>& COMM_LIST)
}
displs[nprocs] = recv_comm_size;
#ifdef _DEBUG
printf("myid: %d: recv_comm_size: %d\n", myid, recv_comm_size);
#endif
vector<int> recvbuf(recv_comm_size);
MPI_Allgatherv(&sendbuf[0], my_ncomm, MPI_INT,
&recvbuf[0], &recvcounts[0], &displs[0], MPI_INT,
......@@ -54,8 +82,6 @@ int createMPIComm(ifstream& inFile, map<int, MPI_Comm>& COMM_LIST)
for(const auto& id : recvbuf)
all_comm_ids.insert(id);
int myid;
MPI_Comm_rank(MPI_COMM_WORLD, &myid);
// create each comm in all_comm_ids
for(const auto& id: all_comm_ids)
{
......
int createMPIComm(std::ifstream& inFile, std::map<int, MPI_Comm>& COMM_LIST);
int createMPIComm(char* INPUTFILENAME, std::map<int, MPI_Comm>& COMM_LIST);
#include <fstream>
#include <cstring>
#include <iostream>
#include <map>
#include <mpi.h>
#include "read_run.h"
......@@ -15,22 +16,54 @@ int main(int argc, char* argv[])
int myid;
MPI_Comm_rank(MPI_COMM_WORLD, &myid);
int namelen;
char myhostname[MPI_MAX_PROCESSOR_NAME];
MPI_Get_processor_name(myhostname, &namelen);
char INPUTFILENAME[4096];
sprintf(INPUTFILENAME, "%s/MSGLOG.%s.%d.csv", INPUTFILE_DIR, myhostname, myid);
sprintf(INPUTFILENAME, "%s/MSGLOG.%d.csv", INPUTFILE_DIR, myid);
ifstream inFile;
inFile.open(INPUTFILENAME);
// create all communitors
map<int, MPI_Comm> COMM_LIST;
createMPIComm(inFile, COMM_LIST);
int ncomm = createMPIComm(INPUTFILENAME, COMM_LIST);
if(myid == 0) cout<<ncomm<<" comms are created"<<endl;
#ifdef _DEBUG
// check all comms
char outlog[4096];
sprintf(outlog, "myid %d: comms size list:", myid);
//for(const auto& [i, comm_i] : COMM_LIST)
for(const auto& cm : COMM_LIST)
{
int ss;
MPI_Comm_size(cm.second, &ss);
char ll[128];
sprintf(ll, " %d - %d", cm.first, ss);
strcat(outlog, ll);
}
cout<<outlog<<endl;
sprintf(outlog, "myid %d: comms rank list:", myid);
// for(const auto& [i, comm_i] : COMM_LIST)
for(const auto& cm : COMM_LIST)
{
int ss;
MPI_Comm_rank(cm.second, &ss);
char ll[128];
sprintf(ll, " %d - %d", cm.first, ss);
strcat(outlog, ll);
}
cout<<outlog<<endl;
#endif
// read the log and replay the mpi functions
ifstream inFile;
inFile.open(INPUTFILENAME);
string logline;
int err;
while (getline(inFile, logline))
read_run(logline.c_str(), COMM_LIST);
{
err = read_run(logline, COMM_LIST);
}
if(myid == 0) cout<<"all records are replayed, error code: "<<err<<endl;
inFile.close();
MPI_Finalize();
return 0;
......
#include <stdio.h>
#include <sys/time.h>
#include <cstdio>
#include <cstring>
#include <sstream>
#include <unistd.h>
#include <vector>
#include <map>
#include <mpi.h>
#ifdef _DEBUG
#include <cstdio>
#endif
#define MPI_INT_ID 39
#define MPI_LONG_ID 41
#define MPI_SHORT_ID 37
......@@ -43,8 +47,11 @@ inline void update_last_time(double START_TIME, double LOG_ENDTIME, double& LAST
LAST_MY_ENDTIME = (now_time.tv_sec + now_time.tv_usec/1e6) - START_TIME;
}
int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
int read_run(string LOG, map<int, MPI_Comm>& COMM_LIST)
{
stringstream ssin(LOG);
char ch; // ch is used to jump over comma in the log string
static double START_TIME;
static double LAST_LOG_ENDTIME;
static double LAST_MY_ENDTIME;
......@@ -55,13 +62,27 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
int FUNC_ID;
int COMM_ID;
sscanf(LOG, "%lf, %lf, %d, %d", &LOG_CALLTIME, &LOG_ENDTIME, &FUNC_ID, &COMM_ID);
ssin>>LOG_CALLTIME>>ch>>LOG_ENDTIME>>ch>>FUNC_ID>>ch>>COMM_ID;
#ifdef _DEBUG
static int i_record = 0;
++i_record;
int myid_in_debug;
MPI_Comm_rank(MPI_COMM_WORLD, &myid_in_debug);
// if(myid_in_debug == 0) printf("i_record = %d, COMM_ID = %d\n", i_record, COMM_ID);
#endif
switch(FUNC_ID)
{
// MPI_Init
case 0:
{
#ifdef _DEBUG
printf("myid %d: MPI_Init\n");
#endif
struct timeval now_time;
gettimeofday(&now_time, NULL);
START_TIME=now_time.tv_sec + now_time.tv_usec/1e6;
......@@ -72,9 +93,11 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
// MPI_Allgather
case 1:
{
int tmpval;
int sendcount, sendelemsize, recvcount, recvelemsize;
sscanf(LOG, "%d %d %d %d %d", &tmpval, &sendcount, &sendelemsize, &recvcount, &recvelemsize);
ssin>>ch>>sendcount>>ch>>sendelemsize>>ch>>recvcount>>ch>>recvelemsize;
#ifdef _DEBUG
printf("myid %d: MPI_Allgather: sendcount = %d, sendelemsize = %d, recvcount = %d, recvelemsize = %d\n", myid_in_debug, sendcount, sendelemsize, recvcount, recvelemsize);
#endif
int v_sendcount = sendcount * sendelemsize / sizeof(int);
int v_recvcount = recvcount * recvelemsize / sizeof(int);
......@@ -95,11 +118,15 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
}
// MPI_Allgatherv
case 2:
{
int tmpval;
int size;
int sendcount, sendelemsize;
sscanf(LOG, "%d %d %d %d", &tmpval, &size, &sendcount, &sendelemsize);
int tmpval;
ssin>>ch>>tmpval>>ch>>size>>ch>>sendcount>>ch>>sendelemsize;
#ifdef _DEBUG
printf("myid %d: MPI_Allgatherv: size = %d, sendcount = %d; sendelemsize = %d\n", myid_in_debug, size, sendcount, sendelemsize);
#endif
// setup receive data size list and displacement
vector<int> p(size * 2);
......@@ -110,14 +137,13 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
int v_totalrecvcount = 0;
for(int i = 0; i < size; ++i)
{
sscanf(LOG, "%d", &recvdatasize);
ssin>>ch>>recvdatasize;
v_recvcounts[i] = recvdatasize / sizeof(int);
v_totalrecvcount += v_recvcounts[i];
if(i > 0)
displs[i] = displs[i-1] + v_recvcounts[i-1];
}
// setup send buffer and receiver buffer
int v_sendcount = sendcount * sendelemsize / sizeof(int);
vector<int> buffer(v_sendcount + v_totalrecvcount);
int* sendbuf = &buffer[0];
......@@ -134,9 +160,13 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
// MPI_Allreduce
case 3:
{
int tmpval;
int count, datatype_f, op_f;
sscanf(LOG, "%d %d %d %d %d", &tmpval, &count, &datatype_f, &op_f);
int tmpval;
ssin>>ch>>count>>ch>>datatype_f>>ch>>op_f;
#ifdef _DEBUG
printf("myid %d: MPI_Allreduce: i_record = %d, COMM_ID = %d, count = %d, datatype_f = %d; op_f = %d\n",
myid_in_debug, i_record, COMM_ID, count, datatype_f, op_f);
#endif
MPI_Op op=MPI_Op_f2c(op_f);
switch(datatype_f)
{
......@@ -274,9 +304,13 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
// MPI_Alltoall
case 4:
{
int tmpval;
int sendcount, sendelemsize, recvcount, recvelemsize;
sscanf(LOG, "%d %d %d %d %d", &tmpval, &sendcount, &sendelemsize, &recvcount, &recvelemsize);
int tmpval;
ssin>>ch>>tmpval>>ch>>sendcount>>ch>>sendelemsize>>ch>>recvcount>>ch>>recvelemsize;
#ifdef _DEBUG
printf("myid %d: MPI_Alltoall: i_record = %d, COMM_ID = %d, sendcount = %d, sendelemsize = %d, recvcount = %d, recvelemsize = %d\n",
myid_in_debug, i_record, COMM_ID, sendcount, sendelemsize, recvcount, recvelemsize);
#endif
int v_sendcount = sendcount * sendelemsize / sizeof(int);
int v_recvcount = recvcount * recvelemsize / sizeof(int);
vector<int> buffer(v_sendcount + v_recvcount);
......@@ -295,7 +329,11 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
case 6:
{
int size;
sscanf(LOG, "%d %d", &size, &size);
ssin>>ch>>size>>ch>>size;
#ifdef _DEBUG
printf("myid %d: MPI_Alltoallv: i_record = %d, COMM_ID = %d, size = %d\n",
myid_in_debug, i_record, COMM_ID, size);
#endif
vector<int> p(size * 4);
int* v_sendcounts = &p[0];
int* v_sdispls = &p[size];
......@@ -307,7 +345,7 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
v_sdispls[0] = 0;
for(int i = 0; i < size; ++i)
{
sscanf(LOG, "%d", &tmp);
ssin>>ch>>tmp;
v_sendcounts[i] = tmp/sizeof(int);
totalsendsize += v_sendcounts[i];
if(i > 0)
......@@ -317,7 +355,7 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
v_rdispls[0] = 0;
for(int i = 0; i < size; ++i)
{
sscanf(LOG, "%d", &tmp);
ssin>>ch>>tmp;
v_recvcounts[i] = tmp/sizeof(int);
totalrecvsize += v_recvcounts[i];
if(i > 0)
......@@ -338,10 +376,18 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
// MPI_Bcast
case 7:
{
#ifdef _DEBUG
printf("myid %d: MPI_Bcast: i_record = %d, start reading the log: %s\n",
myid_in_debug, i_record, LOG.c_str());
#endif
int rootrank, count, elemsize;
int tmpval;
int rootrank, datasize;
sscanf(LOG, "%d %d %d", &tmpval, &rootrank, &datasize);
int v_datacount = datasize / sizeof(int);
ssin>>ch>>tmpval>>ch>>rootrank>>ch>>count>>ch>>elemsize;
#ifdef _DEBUG
printf("myid %d: MPI_Bcast: i_record = %d, COMM_ID = %d, rootrank = %d, count = %d, elemsize = %d\n",
myid_in_debug, i_record, COMM_ID, rootrank, count, elemsize);
#endif
int v_datacount = count * elemsize / sizeof(int);
vector<int> buffer(v_datacount);
wait_for_run(START_TIME, LOG_CALLTIME, LAST_LOG_ENDTIME, LAST_MY_ENDTIME);
......@@ -349,6 +395,10 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
MPI_Bcast(&buffer[0], v_datacount, MPI_INT, rootrank, COMM_LIST[COMM_ID]);
update_last_time(START_TIME, LOG_ENDTIME, LAST_LOG_ENDTIME, LAST_MY_ENDTIME);
#ifdef _DEBUG
printf("myid %d: MPI_Bcast: i_record = %d, finish at %lf\n",
myid_in_debug, i_record, LAST_MY_ENDTIME);
#endif
break;
}
// MPI_Gather
......@@ -356,7 +406,11 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
{
int tmpval;
int rootrank, sendcount, recvcount, sendelemsize, recvelemsize;
sscanf(LOG, "%d %d %d %d %d %d", &tmpval, &rootrank, &sendcount, &recvcount, &sendelemsize, &recvelemsize);
ssin>>ch>>tmpval>>ch>>rootrank>>ch>>sendcount>>ch>>recvcount>>ch>>sendelemsize>>ch>>recvelemsize;
#ifdef _DEBUG
printf("myid %d: MPI_Gather: rootrank = %d, sendcount = %d, recvcount = %d, sendelemsize = %d, recvelemsize = %d\n",
myid_in_debug, rootrank, sendcount, recvcount, sendelemsize, recvelemsize);
#endif
int v_sendcount = sendcount * sendelemsize / sizeof(int);
int v_recvcount = recvcount * recvelemsize / sizeof(int);
......@@ -379,9 +433,12 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
case 9:
{
int tmpval;
int rootrank, sendcount, sendelemsize;
int size;
sscanf(LOG, "%d %d %d %d %d", &tmpval, &rootrank, &sendcount, &sendelemsize);
int size, rootrank, sendcount, sendelemsize;
ssin>>ch>>tmpval>>ch>>size>>ch>>rootrank>>ch>>sendcount>>ch>>sendelemsize;
#ifdef _DEBUG
printf("myid %d: MPI_Gatherv: size = %d, rootrank = %d, sendcount = %d, sendelemsize = %d\n",
myid_in_debug, size, rootrank, sendcount, sendelemsize);
#endif
int v_sendcount = sendcount * sendelemsize / sizeof(int);
// setup receive data size list and displacement
int recvdatasize;
......@@ -392,7 +449,8 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
displs[0]=0;
for(int i = 0; i < size; ++i)
{
sscanf(LOG, "%d", &recvdatasize);
// sscanf(LOG, "%d", &recvdatasize);
ssin>>ch>>recvdatasize;
v_recvcounts[i] = recvdatasize / sizeof(int);
v_totalrecvcount += v_recvcounts[i];
if(i > 0)
......@@ -417,7 +475,11 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
{
int tmpval;
int source, count, elemsize, tag;
sscanf(LOG, "%d %d %d %d %d", &tmpval, &source, &count, &elemsize, &tag);
ssin>>ch>>tmpval>>ch>>source>>ch>>count>>ch>>elemsize>>ch>>tag;
#ifdef _DEBUG
printf("myid %d: MPI_Recv: source = %d, count = %d, elemsize = %d, tag = %d\n",
myid_in_debug, source, count, elemsize, tag);
#endif
int v_count = count * elemsize / sizeof(int);
vector<int> buffer(v_count);
......@@ -432,8 +494,13 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
// MPI_Reduce
case 11:
{
int tmpval, rootrank, count, datatype_f, size, op_f;
sscanf(LOG, "%d %d %d %d %d %d", &tmpval, &rootrank, &count, &datatype_f, size, &op_f);
int tmpval;
int rootrank, count, datatype_f, size, op_f;
ssin>>ch>>tmpval>>ch>>rootrank>>ch>>count>>ch>>datatype_f>>ch>>size>>ch>>op_f;
#ifdef _DEBUG
printf("myid %d: MPI_Reduce: rootrank = %d, count = %d, datatype_f = %d, size = %d, op_f = %d\n",
myid_in_debug, rootrank, count, datatype_f, size, op_f);
#endif
MPI_Op op=MPI_Op_f2c(op_f);
switch(datatype_f)
{
......@@ -573,7 +640,11 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
{
int tmpval;
int rootrank, sendcount, sendelemsize, recvcount, recvelemsize, size;
sscanf(LOG, "%d %d %d %d %d %d", &tmpval, &rootrank, &sendcount, &sendelemsize, &recvcount, &recvelemsize, &size);
ssin>>ch>>tmpval>>ch>>rootrank>>ch>>sendcount>>ch>>sendelemsize>>ch>>recvcount>>ch>>recvelemsize>>ch>>size;
#ifdef _DEBUG
printf("myid %d: MPI_Recv: rootrank = %d, sendcount = %d, sendelemsize = %d, recvcount = %d, recvelemsize = %d, size = %d\n",
myid_in_debug, rootrank, sendcount, sendelemsize, recvcount, recvelemsize, size);
#endif
int v_sendcount = sendcount * sendelemsize / sizeof(int);
int v_recvcount = recvcount * recvelemsize / sizeof(int);
......@@ -595,7 +666,11 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
{
int tmpval;
int dest, count, elemsize, tag;
sscanf(LOG, "%d %d %d %d %d", &tmpval, &dest, &count, &elemsize, &tag);
ssin>>ch>>tmpval>>ch>>dest>>ch>>count>>ch>>elemsize>>ch>>tag;
#ifdef _DEBUG
printf("myid %d: MPI_Recv: dest = %d, count = %d, elemsize = %d, tag = %d\n",
myid_in_debug, dest, count, elemsize, tag);
#endif
int v_count = count * elemsize / sizeof(int);
vector<int> buffer(v_count);
......@@ -611,7 +686,11 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
{
int tmpval;
int source, count, elemsize, tag, request_idx;
sscanf(LOG, "%d %d %d %d %d %d", &tmpval, &source, &count, &elemsize, &tag, &request_idx);
ssin>>ch>>tmpval>>ch>>source>>ch>>count>>ch>>elemsize>>ch>>tag>>ch>>request_idx;
#ifdef _DEBUG
printf("myid %d: MPI_Recv: source = %d, count = %d, elemsize = %d, tag = %d, request_idx = %d\n",
myid_in_debug, source, count, elemsize, tag, request_idx);
#endif
int v_count = count * elemsize / sizeof(int);
MPI_Request req;
......@@ -630,7 +709,11 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
{
int tmpval;
int dest, count, elemsize, tag, request_idx;
sscanf(LOG, "%d %d %d %d %d %d", &tmpval, &dest, &count, &elemsize, &tag, &request_idx);
ssin>>ch>>tmpval>>ch>>dest>>ch>>count>>ch>>elemsize>>ch>>tag>>ch>>request_idx;
#ifdef _DEBUG
printf("myid %d: MPI_Recv: dest = %d, count = %d, elemsize = %d, tag = %d, request_idx = %d\n",
myid_in_debug, dest, count, elemsize, tag, request_idx);
#endif
int v_count = count * elemsize / sizeof(int);
vector<int> buffer(v_count);
......@@ -649,7 +732,7 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
{
int tmpval;
int old_request_idx, new_request_idx;
sscanf(LOG, "%d %d %d", &tmpval, &old_request_idx, &new_request_idx);
ssin>>ch>>tmpval>>ch>>old_request_idx>>ch>>new_request_idx;
MPI_Request req = REQUEST_DICT[old_request_idx];
MPI_Status stat;
......@@ -665,13 +748,13 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
case 17:
{
int count2;
sscanf(LOG, "%d", &count2);
ssin>>ch>>count2;
int count = count2 / 2;
int request_idx;
vector<MPI_Request> reqs(count);
for(int i = 0; i < count; ++i)
{
sscanf(LOG, "%d", &request_idx);
ssin>>ch>>request_idx;
reqs[i] = REQUEST_DICT[request_idx];
}
vector<MPI_Status> statuses(count);
......@@ -684,7 +767,7 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
for(int i = 0; i < count; ++i)
{
sscanf(LOG, "%d", &request_idx);
ssin>>ch>>request_idx;
REQUEST_DICT[request_idx] = reqs[i];
}
break;
......@@ -693,16 +776,16 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
case 18:
{
int tmpval, count2;
sscanf(LOG, "%d %d", &count2, &tmpval);
ssin>>ch>>count2>>ch>>tmpval;
int count = count2 / 2;
int request_idx;
vector<MPI_Request> reqs(count);
for(int i = 0; i < count; ++i)
{
sscanf(LOG, "%d", &request_idx);
ssin>>ch>>request_idx;
reqs[i] = REQUEST_DICT[request_idx];
}
sscanf(LOG, "%d", &tmpval);
ssin>>ch>>tmpval;
int indx;
MPI_Status stat;
......@@ -714,7 +797,7 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
for(int i = 0; i < count; ++i)
{
sscanf(LOG, "%d", &request_idx);
ssin>>ch>>request_idx;
REQUEST_DICT[request_idx] = reqs[i];
}
break;
......@@ -723,13 +806,13 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
case 19:
{
int incount2, outcount;
sscanf(LOG, "%d %d", &incount2, &outcount);
ssin>>ch>>incount2>>ch>>outcount;
int incount = incount2 / 2;
int request_idx;
vector<MPI_Request> reqs(incount);
for(int i = 0; i < incount; ++i)
{
sscanf(LOG, "%d", &request_idx);
ssin>>ch>>request_idx;
reqs[i] = REQUEST_DICT[request_idx];
}
vector<int> indices(incount);
......@@ -737,7 +820,7 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
int idx;
for(int i = 0; i < outcount; ++i)
{
sscanf(LOG, "%d", &idx);
ssin>>ch>>idx;
}
wait_for_run(START_TIME, LOG_CALLTIME, LAST_LOG_ENDTIME, LAST_MY_ENDTIME);
......@@ -748,7 +831,7 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
for(int i = 0; i < incount; ++i)
{
sscanf(LOG, "%d", &request_idx);
ssin>>ch>>request_idx;
REQUEST_DICT[request_idx] = reqs[i];
}
break;
......@@ -758,7 +841,7 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
{
int tmpval;
int old_request_idx, new_request_idx, completed;
sscanf(LOG, "%d %d %d %d", &tmpval, &old_request_idx, &new_request_idx, &completed);
ssin>>ch>>tmpval>>ch>>old_request_idx>>ch>>new_request_idx>>ch>>completed;
MPI_Request req = REQUEST_DICT[old_request_idx];
MPI_Status stat;
......@@ -775,12 +858,12 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
case 21:
{
int tmpval, count, count2, flag;
sscanf(LOG, "%d %d %d %d", &tmpval, &count, &flag, &count2);
ssin>>ch>>tmpval>>ch>>count>>ch>>flag>>ch>>count2;
int request_idx;
vector<MPI_Request> reqs(count);
for(int i = 0; i < count; ++i)
{
sscanf(LOG, "%d", &request_idx);
ssin>>ch>>request_idx;
reqs[i] = REQUEST_DICT[request_idx];
}
vector<MPI_Status> statuses(count);
......@@ -793,7 +876,7 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
for(int i = 0; i < count; ++i)
{
sscanf(LOG, "%d", &request_idx);
ssin>>ch>>request_idx;
REQUEST_DICT[request_idx] = reqs[i];
}
break;
......@@ -802,15 +885,15 @@ int read_run(const char LOG[], map<int, MPI_Comm>& COMM_LIST)
case 22:
{
int tmpval, count, indx, completed, count2;
sscanf(LOG, "%d %d %d %d %d", &tmpval, &count2, &count, &indx,