a new example of how to change bgtrace logs/
authorGengbin Zheng <gzheng@illinois.edu>
Fri, 19 Jun 2009 17:38:18 +0000 (17:38 +0000)
committerGengbin Zheng <gzheng@illinois.edu>
Fri, 19 Jun 2009 17:38:18 +0000 (17:38 +0000)
examples/bigsim/tools/changelog/Makefile [new file with mode: 0644]
examples/bigsim/tools/changelog/bgTrace [new file with mode: 0644]
examples/bigsim/tools/changelog/bgTrace0 [new file with mode: 0644]
examples/bigsim/tools/changelog/bgTrace1 [new file with mode: 0644]
examples/bigsim/tools/changelog/bgTrace2 [new file with mode: 0644]
examples/bigsim/tools/changelog/bgTrace3 [new file with mode: 0644]
examples/bigsim/tools/changelog/changelog.C [new file with mode: 0644]

diff --git a/examples/bigsim/tools/changelog/Makefile b/examples/bigsim/tools/changelog/Makefile
new file mode 100644 (file)
index 0000000..ec5ae73
--- /dev/null
@@ -0,0 +1,16 @@
+CHARMC=../../../../bin/charmc $(OPTS)
+
+all: changelog
+
+changelog: changelog.o
+       $(CHARMC) -seq -o changelog changelog.o -lconv-bigsim-logs -lconv-util -lblue-standalone -language c++
+
+changelog.o: changelog.C 
+       $(CHARMC) -seq -c changelog.C
+
+clean:
+       rm -f *.o loadlog *~ moduleinit.C charmrun conv-host
+       rm -rf *.decl.h *.def.h core *.log
+
+test: loadlog
+       ./loadlog
diff --git a/examples/bigsim/tools/changelog/bgTrace b/examples/bigsim/tools/changelog/bgTrace
new file mode 100644 (file)
index 0000000..f2b77a8
Binary files /dev/null and b/examples/bigsim/tools/changelog/bgTrace differ
diff --git a/examples/bigsim/tools/changelog/bgTrace0 b/examples/bigsim/tools/changelog/bgTrace0
new file mode 100644 (file)
index 0000000..a386f78
Binary files /dev/null and b/examples/bigsim/tools/changelog/bgTrace0 differ
diff --git a/examples/bigsim/tools/changelog/bgTrace1 b/examples/bigsim/tools/changelog/bgTrace1
new file mode 100644 (file)
index 0000000..407571d
Binary files /dev/null and b/examples/bigsim/tools/changelog/bgTrace1 differ
diff --git a/examples/bigsim/tools/changelog/bgTrace2 b/examples/bigsim/tools/changelog/bgTrace2
new file mode 100644 (file)
index 0000000..53628a3
Binary files /dev/null and b/examples/bigsim/tools/changelog/bgTrace2 differ
diff --git a/examples/bigsim/tools/changelog/bgTrace3 b/examples/bigsim/tools/changelog/bgTrace3
new file mode 100644 (file)
index 0000000..7b9df78
Binary files /dev/null and b/examples/bigsim/tools/changelog/bgTrace3 differ
diff --git a/examples/bigsim/tools/changelog/changelog.C b/examples/bigsim/tools/changelog/changelog.C
new file mode 100644 (file)
index 0000000..9e99114
--- /dev/null
@@ -0,0 +1,64 @@
+
+#include <math.h>
+#include "blue.h"
+#include "blue_impl.h"
+
+#define OUTPUTDIR "newtraces/"
+
+extern BgTimeLineRec* currTline;
+extern int currTlineIdx;
+
+int main()
+{
+  int totalProcs, numX, numY, numZ, numCth, numWth, numPes;
+
+  // load bg trace summary file
+  printf("Loading bgTrace ... \n");
+  int status = BgLoadTraceSummary("bgTrace", totalProcs, numX, numY, numZ, numCth, numWth, numPes);
+  if (status == -1) exit(1);
+  printf("========= BgLog Version: %d ========= \n", bglog_version);
+  printf("Found %d (%dx%dx%d:%dw-%dc) simulated procs on %d real procs.\n", totalProcs, numX, numY, numZ, numWth, numCth, numPes);
+                                                                                
+  int* allNodeOffsets = BgLoadOffsets(totalProcs,numPes);
+
+  // load timelines from each emulating processor
+  for (int i=0; i<numPes; i++) 
+  {
+    BgTimeLineRec *tlinerecs = new BgTimeLineRec[totalProcs/numPes+1];
+    int rec_count = 0;
+
+      // procNum is the target PE on this emulating processor
+    for(int procNum=i;procNum<totalProcs;procNum+=numPes){
+
+      BgTimeLineRec &tlinerec = tlinerecs[rec_count];
+      rec_count++;
+
+      currTline = &tlinerec;
+      currTlineIdx = procNum;
+      int fileNum = BgReadProc(procNum,numWth,numPes,totalProcs,allNodeOffsets,tlinerec);
+      CmiAssert(fileNum != -1 && fileNum==i);
+      printf("Loading bglog of proc %d from bgTrace%d succeed. \n", procNum, fileNum);
+                                                                                
+      BgTimeLine &timeLine = tlinerec.timeline;
+
+      // some senity checking
+      printf("Proc %d has %d events. \n", procNum, timeLine.length());
+      for (int idx = 0; idx < timeLine.length(); idx ++)
+      {
+        BgTimeLog *bglog = timeLine[idx];
+        for(int midx=0; midx < bglog->msgs.length(); midx++){
+          BgMsgEntry *msg = bglog->msgs[midx];
+          if (msg->sendTime < bglog->startTime || msg->sendTime > bglog->endTime)
+            printf("[%d] Invalid MsgEntry [%d]: sendTime: %f in log startT: %f endT: %f execT: %f\n", i, idx, msg->sendTime, bglog->startTime, bglog->endTime, bglog->execTime);
+        }  
+      }
+
+    }
+    BgWriteTimelines(i,tlinerecs,rec_count,OUTPUTDIR);
+    delete[] tlinerecs;
+  }
+
+  delete [] allNodeOffsets;
+  printf("End of program\n");
+}
+