Merge branch 'charm' of charmgit:charm into charm
authorYanhua Sun <sun51@hopper07.(none)>
Thu, 8 Mar 2012 23:03:52 +0000 (15:03 -0800)
committerYanhua Sun <sun51@hopper07.(none)>
Thu, 8 Mar 2012 23:03:52 +0000 (15:03 -0800)
Conflicts:
src/arch/gemini_gni/machine.c

src/arch/gemini_gni/machine.c
src/ck-perf/trace-common.C
src/ck-perf/trace-converse.c
src/ck-perf/trace-projections.C
src/ck-perf/trace-projections.h
src/ck-perf/trace.h
src/conv-core/conv-trace.h

index c143290541650da2658a6dbfda5122607a9f58ec..6a83c15fdc541a6e1a1c6f839a42210c78862e26 100644 (file)
@@ -1200,18 +1200,34 @@ static gni_return_t send_smsg_message(SMSG_QUEUE *queue, int destNode, void *msg
         }
 #endif
         CMI_GNI_LOCK
+<<<<<<< HEAD
+#if CMK_SMP_TRACE_COMMTHREAD
+        int oldpe = -1;
+        int oldeventid = -1;
+        if(tag == SMALL_DATA_TAG || tag == LMSG_INIT_TAG)
+        { 
+            START_EVENT();
+            if ( tag == SMALL_DATA_TAG)
+                real_data = (char*)msg; 
+            else 
+                real_data = (char*)(((CONTROL_MSG*)msg)->source_addr);
+            TRACE_COMM_GET_MSGID(real_data, &oldpe, &oldeventid);
+            TRACE_COMM_SET_COMM_MSGID(real_data);
+        }
+#endif
+        status = GNI_SmsgSendWTag(ep_hndl_array[destNode], 0, 0, msg, size, 0, tag);
+#if CMK_SMP_TRACE_COMMTHREAD
+        if (oldpe != -1)  TRACE_COMM_SET_MSGID(real_data, oldpe, oldeventid);
+#endif
+=======
         status = GNI_SmsgSendWTag(ep_hndl_array[destNode], buf, bufsize, msg, size, 0, tag);
+>>>>>>> 6bc5ef7da3aa42d00053cc7680a14257efe4ee42
         CMI_GNI_UNLOCK
         if(status == GNI_RC_SUCCESS)
         {
 #if CMK_SMP_TRACE_COMMTHREAD
             if(tag == SMALL_DATA_TAG || tag == LMSG_INIT_TAG || tag == SMALL_DATA_ACK_TAG)
             { 
-                START_EVENT();
-                if ( tag == SMALL_DATA_TAG)
-                    real_data = (char*)msg; 
-                else 
-                    real_data = (char*)(((CONTROL_MSG*)msg)->source_addr);
                 TRACE_COMM_CREATION(CpvAccess(projTraceStart), real_data);
             }
 #endif
@@ -1725,7 +1741,7 @@ static void PumpNetworkSmsg()
                 msg_data    = CmiAlloc(msg_nbytes);
                 memcpy(msg_data, (char*)header, msg_nbytes);
 #if CMK_SMP_TRACE_COMMTHREAD
-                TRACE_COMM_RECV(CpvAccess(projTraceStart), msg_data);
+                TRACE_COMM_CREATION(CpvAccess(projTraceStart), msg_data);
 #endif
                 handleOneRecvedMsg(msg_nbytes, msg_data);
                 break;
@@ -2126,9 +2142,7 @@ static void PumpLocalRdmaTransactions()
 #if PRINT_SYH
                     printf("Normal msg transaction PE:%d==>%d\n", myrank, inst_id);
 #endif
-#if CMK_SMP_TRACE_COMMTHREAD
                     START_EVENT();
-#endif
                     CmiAssert(SIZEFIELD((void*)(tmp_pd->local_addr)) <= tmp_pd->length);
                     DecreaseMsgInRecv((void*)tmp_pd->local_addr);
 #if MACHINE_DEBUG_LOG
@@ -2137,21 +2151,19 @@ static void PumpLocalRdmaTransactions()
                     MACHSTATE5(8, "GO Recv done ack send from %d (%d,%d, %d) tag=%d\n", inst_id, buffered_send_msg, buffered_recv_msg, register_memory_size, msg_tag); 
 #endif
 #if CMK_SMP_TRACE_COMMTHREAD
-                    TRACE_COMM_RECV(CpvAccess(projTraceStart), (void*)tmp_pd->local_addr);
+                    TRACE_COMM_CREATION(CpvAccess(projTraceStart), (void*)tmp_pd->local_addr);
 #endif
                     handleOneRecvedMsg(tmp_pd->length, (void*)tmp_pd->local_addr); 
                 }else if(msg_tag == BIG_MSG_TAG){
                     void *msg = (char*)tmp_pd->local_addr-(tmp_pd->cqwrite_value-1)*ONE_SEG;
                     CmiSetMsgSeq(msg, CmiGetMsgSeq(msg)+1);
                     if (tmp_pd->first_operand <= ONE_SEG*CmiGetMsgSeq(msg)) {
-#if CMK_SMP_TRACE_COMMTHREAD
                         START_EVENT();
-#endif
 #if PRINT_SYH
                         printf("Pipeline msg done [%d]\n", myrank);
 #endif
 #if CMK_SMP_TRACE_COMMTHREAD
-                        TRACE_COMM_RECV(CpvAccess(projTraceStart), msg);
+                        TRACE_COMM_CREATION(CpvAccess(projTraceStart), msg);
 #endif
                         handleOneRecvedMsg(tmp_pd->first_operand, msg); 
                     }
index 1653b31dcde0af7190e2a1fa998cc0f7d3e3837f..978ab56b290b271c2bc66fbf8295a30fd4d8d940 100644 (file)
@@ -695,7 +695,35 @@ void traceSendMsgComm(char *msg){
     CkpvAccess(_traces)->creation(msg);
 #endif
 }
+
+extern "C"
+void traceCommSetMsgID(char *msg){
+#if CMK_TRACE_ENABLED
+  if (CpvAccess(traceOn) && CkpvAccess(_traces) && CkIsCharmMessage(msg))
+    CkpvAccess(_traces)->traceCommSetMsgID(msg);
+#endif
+}
+
+#endif
+
+extern "C"
+void traceGetMsgID(char *msg, int *pe, int *event)
+{
+#if CMK_TRACE_ENABLED
+  if (CpvAccess(traceOn) && CkpvAccess(_traces) && CkIsCharmMessage(msg))
+    CkpvAccess(_traces)->traceGetMsgID(msg, pe, event);
 #endif
+}
+
+extern "C"
+void traceSetMsgID(char *msg, int pe, int event)
+{
+#if CMK_TRACE_ENABLED
+  if (CpvAccess(traceOn) && CkpvAccess(_traces) && CkIsCharmMessage(msg))
+    CkpvAccess(_traces)->traceSetMsgID(msg, pe, event);
+#endif
+}
+
 
 extern "C"
 void traceChangeLastTimestamp(double ts){
index 0f349b245039801f937969d6a95058a83397bc08..98940fa3e19c7cda8242b53cf98fbb172e6f4c93 100644 (file)
@@ -56,8 +56,12 @@ void traceEndCommOp(char *msg) {}
 void traceSendMsgComm(char *msg) {}
 void traceChangeLastTimestamp(double ts) {}
 void registerMachineUserEventsFunction(void (*eventRegistrationFunc)()) {}
+void traceCommSetMsgID(char *msg) {}
 #endif
 
+void traceGetMsgID(char *msg, int *pe, int *event) {}
+void traceSetMsgID(char *msg, int pe, int event) {}
+
 /* This routine, included in Charm++ programs from init.C, needs to be present in converse as well.
    Here is a place where it gets included only in converse, and not in Charm++ (thus not generating conflicts). */
 void EmergencyExit(void) {}
index 6f21fd3f86041ff445fb6af5c84cb76c4f2376d3..5b9f0005f865aaec64158f875adf0003f54926b3 100644 (file)
@@ -1259,16 +1259,60 @@ void TraceProjections::creation(char *msg)
         // msg must be a charm message
        envelope *e = (envelope *)msg;
        int ep = e->getEpIdx();
-        if(ep==0) return;
-        int num = _entryTable.size();
-        CmiAssert(ep < num);
+    if(ep==0) return;
+    int num = _entryTable.size();
+    CmiAssert(ep < num);
        if(_entryTable[ep]->traceEnabled) {
                creation(e, ep, 1);
-                e->setSrcPe(CkMyPe());              // pretend I am the sender
-        }
+        e->setSrcPe(CkMyPe());              // pretend I am the sender
+    }
+#endif
+}
+
+void TraceProjections::traceCommSetMsgID(char *msg)
+{
+#if CMK_SMP_TRACE_COMMTHREAD
+        // msg must be a charm message
+       envelope *e = (envelope *)msg;
+       int ep = e->getEpIdx();
+    if(ep==0) return;
+    int num = _entryTable.size();
+    CmiAssert(ep < num);
+       if(_entryTable[ep]->traceEnabled) {
+        e->setSrcPe(CkMyPe());              // pretend I am the sender
+        e->setEvent(curevent);
+    }
 #endif
 }
 
+void TraceProjections::traceGetMsgID(char *msg, int *pe, int *event)
+{
+    // msg must be a charm message
+    *pe = *event = -1;
+    envelope *e = (envelope *)msg;
+    int ep = e->getEpIdx();
+    if(ep==0) return;
+    int num = _entryTable.size();
+    CmiAssert(ep < num);
+    if(_entryTable[ep]->traceEnabled) {
+        *pe = e->getSrcPe();
+        *event = e->getEvent();
+    }
+}
+
+void TraceProjections::traceSetMsgID(char *msg, int pe, int event)
+{
+       // msg must be a charm message
+    envelope *e = (envelope *)msg;
+    int ep = e->getEpIdx();
+    if(ep==0) return;
+    int num = _entryTable.size();
+    CmiAssert(ep < num);
+    if(_entryTable[ep]->traceEnabled) {
+        e->setSrcPe(pe);
+        e->setEvent(event);
+    }
+}
 
 /* **CW** Non-disruptive attempt to add destination PE knowledge to
    Communication Library-specific Multicasts via new event 
index 58cb71ac62313d265fb2d8b902ceb40ca2ee1585..f1d5353e85443681d0bbd9f1b5c8525cab8bfbd7 100644 (file)
@@ -501,7 +501,10 @@ class TraceProjections : public Trace {
 #if CMK_SMP_TRACE_COMMTHREAD
     void traceBeginOnCommThread();
     void traceEndOnCommThread();
+    void traceCommSetMsgID(char *msg);
 #endif
+    void traceGetMsgID(char *msg, int *pe, int *event);
+    void traceSetMsgID(char *msg, int pe, int event);
     void traceFlushLog() { _logPool->flushLogBuffer(); }
 
     //functions that perform function tracing
index 2ccd786de631a0b78b106856ca328663c3bb8532..f0cc4ae574dad284a14df034bcd3422684f3433e 100644 (file)
@@ -64,6 +64,9 @@ class Trace {
     // for tracing comm thread only
     virtual void traceBeginOnCommThread() {}   
     virtual void traceEndOnCommThread() {}
+    virtual void traceCommSetMsgID(char *) {}
+    virtual void traceGetMsgID(char *msg, int *pe, int *event) {}
+    virtual void traceSetMsgID(char *msg, int pe, int event) {}
                
     // registers user event trace module returns int identifier 
     virtual int traceRegisterUserEvent(const char* eventName, int e) { 
@@ -266,7 +269,9 @@ public:
     // for tracing comm thread only
     void traceBeginOnCommThread();
     void traceEndOnCommThread();
-       
+    void traceCommSetMsgID(char *msg)  { ALLDO(traceCommSetMsgID(msg)); }
+    void traceGetMsgID(char *msg, int *pe, int *event) { ALLDO(traceGetMsgID(msg, pe, event)); }
+    void traceSetMsgID(char *msg, int pe, int event) { ALLDO(traceSetMsgID(msg, pe, event)); }
     /*Calls for tracing function begins and ends*/
     inline void regFunc(const char *name, int &idx, int idxSpecifiedByUser=0){ ALLDO(regFunc(name, idx, idxSpecifiedByUser)); }
     inline void beginFunc(char *name,char *file,int line){ ALLDO(beginFunc(name,file,line)); };
index da0816845d23b06624403e3c0e34a59b41008029..75da0a381631cb2b8a849998d1237ae805b243ca 100644 (file)
@@ -32,8 +32,11 @@ int  traceRegisterUserEvent(const char*, int e
 int  traceBeginCommOp(char *msg);
 void traceEndCommOp(char *msg);
 void traceSendMsgComm(char *msg);
+void traceCommSetMsgID(char *msg);
 #endif
 void traceChangeLastTimestamp(double ts);
+void traceGetMsgID(char *msg, int *pe, int *event);
+void traceSetMsgID(char *msg, int pe, int event);
 
 /* Support for machine layers to register their user events to projections */
 void registerMachineUserEventsFunction(void (*eventRegistrationFunc)());
@@ -70,14 +73,14 @@ int  traceAvailable();
                       traceSendMsgComm(msg);   \
                       traceEndCommOp(msg);    \
                     }
-#define  TRACE_COMM_RECV(time, msg)   \
-                    if (traceBeginCommOp(msg)) {   \
-                      traceChangeLastTimestamp(time);    \
-                      traceEndCommOp(msg);    \
-                    }
+#define TRACE_COMM_SET_MSGID(msg, pe, event)  traceSetMsgID(msg, pe, event)
+#define TRACE_COMM_GET_MSGID(msg, pe, event)  traceGetMsgID(msg, pe, event)
+#define TRACE_COMM_SET_COMM_MSGID(msg)  traceCommSetMsgID(msg)
 #else
 #define TRACE_COMM_CREATION(time, msg)
-#define TRACE_COMM_RECV(time, msg)
+#define TRACE_COMM_SET_MSGID(msg, pe, event) 
+#define TRACE_COMM_GET_MSGID(msg, pe, event) 
+#define TRACE_COMM_SET_COMM_MSGID(msg)
 #endif
 
 #endif