files for tracing ampi have been moved into the same directory as
authorSayantan Chakravorty <sayantan_chak@yahoo.com>
Wed, 9 Jul 2003 04:28:41 +0000 (04:28 +0000)
committerSayantan Chakravorty <sayantan_chak@yahoo.com>
Wed, 9 Jul 2003 04:28:41 +0000 (04:28 +0000)
ampi

src/conv-perf/allEvents.h
src/conv-perf/ampiProjections.C [deleted file]
src/conv-perf/traceCore.C
src/conv-perf/traceCoreCommon.C
src/libs/ck-libs/ampi/Makefile
src/libs/ck-libs/ampi/ampi.C
src/libs/ck-libs/ampi/ampi.ci
src/libs/ck-libs/ampi/ampi.h
src/libs/ck-libs/ampi/ampiEvents.h [moved from src/conv-perf/ampiEvents.h with 53% similarity]
src/libs/ck-libs/ampi/ampiProjections.C [new file with mode: 0644]
src/libs/ck-libs/ampi/ampiProjections.h [moved from src/conv-perf/ampiProjections.h with 62% similarity]

index a7fe68d62dc485b3498a67688f14c9e2f46704e2..20240e206fb8849e62d6a831ff4652fb4523bf47 100644 (file)
@@ -7,11 +7,11 @@
 #include "charmEvents.h"
 #include "converseEvents.h"
 #include "machineEvents.h"
-#include "ampiEvents.h"
+//#include "ampiEvents.h"
 #include "charmProjections.h"
 #include "converseProjections.h"
 #include "machineProjections.h"
-#include "ampiProjections.h"
+//#include "ampiProjections.h"
 #include "traceCoreAPI.h"     
 #include "traceCore.h"
 #include "charmEvents.h"
diff --git a/src/conv-perf/ampiProjections.C b/src/conv-perf/ampiProjections.C
deleted file mode 100644 (file)
index fe75d96..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include "converse.h"
-#include "ampiProjections.h"
-#include "traceCoreCommon.h"
-#include "ampiEvents.h"
-#include "ck.h"
-
-static int current_tag  = -1;
-static int current_src = -1;
-static int current_count = -1;
-
-extern "C" void initAmpiProjections(){
-       ampi_beginProcessing(current_tag,current_src,current_count);
-}
-
-extern "C" void closeAmpiProjections(){        
-       ampi_endProcessing();
-}
-
-extern "C" void ampi_beginProcessing(int tag,int src,int count){
-       int iData[3];
-       iData[0] = tag;
-       iData[1] = src;
-       iData[2] = count;
-       current_tag = tag;
-       current_src = src;
-       current_count = count;
-       LogEvent1(_AMPI_LANG_ID,_E_BEGIN_AMPI_PROCESSING,3,iData);
-}
-
-extern "C" void ampi_endProcessing(){
-       int iData[3];
-       iData[0] = current_tag;
-       iData[1] = current_src;
-       iData[2] = current_count;
-       LogEvent1(_AMPI_LANG_ID,_E_END_AMPI_PROCESSING,3,iData);
-}
-
-extern "C" void ampi_msgSend(int tag,int dest,int count,int size){
-       int iData[4];
-       iData[0] = tag;
-       iData[1] = dest;
-       iData[2] = count;
-       iData[3] = size;
-       //CmiPrintf("Size = %d\n",size);
-       LogEvent1(_AMPI_LANG_ID,_E_AMPI_MSG_SEND,4,iData);
-}
index 734147379ee4becf637cb5f0d4e82b77364b2a0d..6de2ec36c9725c577a4e05755971c758a1c5ec31 100644 (file)
@@ -12,7 +12,7 @@
 #include "converseEvents.h"    //TODO: remove this hack for REGISTER_CONVESE
 #include "charmEvents.h"       //TODO: remove this hack for REGISTER_CHARM
 #include "machineEvents.h"     // for machine events
-#include "ampiEvents.h"        /* for ampi events */
+//#include "ampiEvents.h"      /* for ampi events */
 
 CpvExtern(double, _traceCoreInitTime);
 CpvExtern(char*, _traceCoreRoot);
@@ -42,7 +42,7 @@ TraceCore::TraceCore(char** argv)
        REGISTER_CONVERSE
        REGISTER_CHARM
        REGISTER_MACHINE
-       REGISTER_AMPI
+       //REGISTER_AMPI
        closePtc();
 }
 
index f48f2ff7d067b0b10be06e5deb579e6926a90240..93b18ae56004db62b2278f5b092ad0415ffbcd4b 100644 (file)
@@ -2,7 +2,7 @@
 #include "traceCore.h"
 #include "traceCoreCommon.h"
 #include "charmProjections.h"
-#include "ampiProjections.h"
+//#include "ampiProjections.h"
 #include "converse.h"
 
 
@@ -46,13 +46,13 @@ extern "C" void initTraceCore(char** argv)
   CpvInitialize(TraceCore*, _traceCore);
        CpvAccess(_traceCore) = new TraceCore(argv);
   initCharmProjections();
-  initAmpiProjections();
// initAmpiProjections();
 }
 
 /* End Core Trace Module */
 //TODO - trace-common.C
 extern "C" void closeTraceCore() {
-       closeAmpiProjections();
+       //closeAmpiProjections();
        delete CpvAccess(_traceCore);
 }
 
index 5b4d9faa92e5454bf6665aff580141c54ff03e65..fdb5bf5816d758a9f046f65b8661ee10ca48ee31 100644 (file)
@@ -1,11 +1,11 @@
 CDIR=../../../..
 CHARMC=$(CDIR)/bin/charmc $(OPTS)
 
-HEADERS=ampi.h ampif.h
-HEADDEP=$(HEADERS) ampiimpl.h ampi.decl.h
+HEADERS=ampi.h ampif.h ampiimpl.h ampiProjections.h
+HEADDEP=$(HEADERS) ampiimpl.h ampi.decl.h ampiEvents.h 
 COMPAT=compat_ampius.o compat_ampifus.o \
        compat_ampim.o compat_ampifm.o compat_ampicm.o
-OBJS=ampi.o ampif.o
+OBJS=ampi.o ampif.o ampiProjections.o
 
 LIB=libmoduleampi
 LIBDIR=$(CDIR)/lib
@@ -57,5 +57,8 @@ ampif.o: ampif.C $(HEADDEP)
 ampi.decl.h ampi.def.h: ampi.ci
        $(CHARMC) ampi.ci
 
+ampiProjections.o: ampiProjections.C ampiEvents.h ampiProjections.h
+       $(CHARMC) -c ampiProjections.C
+
 clean: 
        -rm -fr *.o *~ *.decl.h *.def.h gmon.out $(DEST) $(DESTF) $(COMPATLIB) conv-host charmrun headers *.mod
index 4ae4115e6ff55240357cd50e298c08a1514ecf91..facddb1d1041c9ebf32c445d5151f53b7bb13336 100644 (file)
@@ -9,7 +9,8 @@
 #include <iostream.h>
 #include "ampiimpl.h"
 #include "tcharm.h"
-#include "../../../ampiEvents.h" /*** for trace generation for projector *****/
+#include "ampiEvents.h" /*** for trace generation for projector *****/
+#include "ampiProjections.h"
 
 /* change this define to "x" to trace all send/recv's */
 #define MSG_ORDER_DEBUG(x) /* empty */
@@ -314,6 +315,11 @@ static void ampiNodeInit(void)
   nodeinit_has_been_called=1;
 }
 
+static void ampiProcInit(void){
+  REGISTER_AMPI
+  initAmpiProjections();
+}
+
 PUPbytes(MPI_MainFn);
 
 class MPI_threadstart_t {
@@ -802,6 +808,7 @@ MSG_ORDER_DEBUG(
   CkPrintf("AMPI Rank %d arrival: tag=%d, src=%d, comm=%d  (from %d, seq %d)\n",
        getRank(),msg->tag,msg->srcRank,msg->comm, msg->srcIdx, msg->seq);
 )
+       AmpiMsg *msgcopy = msg;
   if(msg->seq != -1) {
     int srcIdx = msg->srcIdx;
     oorder[srcIdx].put(msg->seq, msg);
@@ -811,8 +818,12 @@ MSG_ORDER_DEBUG(
   } else { //Cross-world or system messages are unordered
     inorder(msg);
   }
-  if(waitingForGeneric)
+  if(waitingForGeneric){
     thread->resume();
+/*#ifndef CMK_OPTIMIZE
+       _LOG_E_BEGIN_AMPI_PROCESSING(getRank(),msgcopy->srcRank,msgcopy->srcIdx);
+#endif*/
+       }       
 }
 
 void
@@ -887,6 +898,9 @@ MSG_ORDER_DEBUG(
     tags[0] = t; tags[1] = s; tags[2] = comm;
     msg = (AmpiMsg *) CmmGet(msgs, 3, tags, sts);
     if (msg) break;
+/*#ifndef CMK_OPTIMIZE
+       _LOG_E_END_AMPI_PROCESSING(getRank());
+#endif*/
     thread->suspend();
   }
   waitingForGeneric=0;
@@ -973,7 +987,7 @@ static ampiParent *getAmpiParent(void) {
   return p;
 }
 
-static ampi *getAmpiInstance(MPI_Comm comm) {
+ampi *getAmpiInstance(MPI_Comm comm) {
   ampi *ptr=getAmpiParent()->comm2ampi(comm);
 #ifndef CMK_OPTIMIZE
   if (ptr==NULL) CkAbort("AMPI's getAmpiInstance> null pointer\n");
@@ -1089,14 +1103,14 @@ int MPI_Recv(void *msg, int count, MPI_Datatype type, int src, int tag,
 {
   AMPIAPI("MPI_Recv");
   ampi *ptr = getAmpiInstance(comm);
-#ifndef CMK_OPTIMIZE
-  _LOG_E_END_AMPI_PROCESSING()
-#endif
-  ptr->recv(tag,src,msg,count,type, comm, (int*) status);
-#ifndef CMK_OPTIMIZE
-  _LOG_E_BEGIN_AMPI_PROCESSING(tag,src,count)
-#endif
-  return 0;
+  
+       //CkPrintf("dedede%d[[",CpvAccess(_traceCoreOn));if(CpvAccess(_traceCoreOn) !=0) ampi_endProcessing(ptr->thisIndex); else CkPrintf("]]]] %ddededededededede\n",CpvAccess(_traceCoreOn)); 
+       
+       _LOG_E_END_AMPI_PROCESSING(ptr->thisIndex)
+       ptr->recv(tag,src,msg,count,type, comm, (int*) status);
+       _LOG_E_BEGIN_AMPI_PROCESSING(ptr->thisIndex,src,count)
+  
+       return 0;
 }
 
 CDECL
@@ -1342,10 +1356,14 @@ int MPI_Reduce(void *inbuf, void *outbuf, int count, int type, MPI_Op op,
   msg->setCallback(reduceCB);
   ptr->contribute(msg);
 
-  if (ptr->thisIndex == rootIdx)
+  if (ptr->thisIndex == rootIdx){
   /*HACK: Use recv() to block until reduction data comes back*/
-    ptr->recv(MPI_REDUCE_TAG, MPI_REDUCE_SOURCE, outbuf, count, type, MPI_REDUCE_COMM);
-  return 0;
+
+       _LOG_E_END_AMPI_PROCESSING(ptr->thisIndex)
+       ptr->recv(MPI_REDUCE_TAG, MPI_REDUCE_SOURCE, outbuf, count, type, MPI_REDUCE_COMM);
+  _LOG_E_BEGIN_AMPI_PROCESSING(ptr->thisIndex,-1,count)
+  }
+ return 0;
 }
 
 CDECL
@@ -1364,7 +1382,9 @@ int MPI_Allreduce(void *inbuf, void *outbuf, int count, int type,
   ptr->contribute(msg);
 
   /*HACK: Use recv() to block until the reduction data comes back*/
+  _LOG_E_END_AMPI_PROCESSING(ptr->thisIndex)
   ptr->recv(MPI_REDUCE_TAG, MPI_REDUCE_SOURCE, outbuf, count, type, MPI_REDUCE_COMM);
+  _LOG_E_BEGIN_AMPI_PROCESSING(ptr->thisIndex,-1,count)
   return 0;
 }
 
@@ -1440,21 +1460,28 @@ int MPI_Start(MPI_Request *request)
 
 int PersReq::wait(MPI_Status *sts){
        if(sndrcv == 2) {
+  _LOG_E_END_AMPI_PROCESSING(getAmpiInstance(comm)->thisIndex)
                getAmpiInstance(comm)->recv(tag, src, buf, count,
                                type, comm, (int*)sts);
+  _LOG_E_BEGIN_AMPI_PROCESSING(getAmpiInstance(comm)->thisIndex,src,count)
        }
        return 0;
 }
 int IReq::wait(MPI_Status *sts){
+  _LOG_E_END_AMPI_PROCESSING(getAmpiInstance(comm)->thisIndex)
        getAmpiInstance(comm)->recv(tag, src, buf, count,
                        type, comm, (int*)sts);
+  _LOG_E_BEGIN_AMPI_PROCESSING(getAmpiInstance(comm)->thisIndex,src,count)
+       
        return 0;
 }
 int ATAReq::wait(MPI_Status *sts){
        int i;
        for(i=0;i<count;i++){
+  _LOG_E_END_AMPI_PROCESSING(getAmpiInstance(myreqs[i].comm)->thisIndex)
                getAmpiInstance(myreqs[i].comm)->recv(myreqs[i].tag, myreqs[i].src, myreqs[i].buf,
                                myreqs[i].count, myreqs[i].type, myreqs[i].comm, (int *)sts);
+  _LOG_E_BEGIN_AMPI_PROCESSING(getAmpiInstance(myreqs[i].comm)->thisIndex,myreqs[i].src,myreqs[i].count)
        }
        return 0;
 }
@@ -1505,14 +1532,18 @@ CmiBool PersReq::test(MPI_Status *sts){
 
 }
 void PersReq::complete(MPI_Status *sts){
+  _LOG_E_END_AMPI_PROCESSING(getAmpiInstance(comm)->thisIndex)
        getAmpiInstance(comm)->recv(tag, src, buf, count, type, comm, (int*)sts);
+  _LOG_E_BEGIN_AMPI_PROCESSING(getAmpiInstance(comm)->thisIndex,src,count)
 }
 
 CmiBool IReq::test(MPI_Status *sts){
        return getAmpiInstance(comm)->iprobe(tag, src, comm, (int*)sts);
 }
 void IReq::complete(MPI_Status *sts){
+  _LOG_E_END_AMPI_PROCESSING(getAmpiInstance(comm)->thisIndex)
        getAmpiInstance(comm)->recv(tag, src, buf, count, type, comm, (int*)sts);
+  _LOG_E_BEGIN_AMPI_PROCESSING(getAmpiInstance(comm)->thisIndex,src,count)
 }
 
 CmiBool ATAReq::test(MPI_Status *sts){
@@ -1526,8 +1557,10 @@ CmiBool ATAReq::test(MPI_Status *sts){
 void ATAReq::complete(MPI_Status *sts){
        int i;
        for(i=0;i<count;i++){
+  _LOG_E_END_AMPI_PROCESSING(getAmpiInstance(myreqs[i].comm)->thisIndex)
                getAmpiInstance(myreqs[i].comm)->recv(myreqs[i].tag, myreqs[i].src, myreqs[i].buf,
                                myreqs[i].count, myreqs[i].type, myreqs[i].comm, (int*)sts);
+  _LOG_E_BEGIN_AMPI_PROCESSING(getAmpiInstance(myreqs[i].comm)->thisIndex,myreqs[i].src,myreqs[i].count)
        }
 }
 
@@ -1934,14 +1967,10 @@ int MPI_Alltoallv(void *sendbuf, int *sendcounts, int *sdispls,
   itemsize = dttype->getSize() ;
 
   for(i=0;i<size;i++) {
-#ifndef CMK_OPTIMIZE
-    _LOG_E_END_AMPI_PROCESSING()
-#endif
+    _LOG_E_END_AMPI_PROCESSING(ptr->thisIndex)
     ptr->recv(MPI_GATHER_TAG,i,((char*)recvbuf)+(itemsize*rdispls[i]),
               recvcounts[i], recvtype, comm, (int*)&status);
-#ifndef CMK_OPTIMIZE
-    _LOG_E_BEGIN_AMPI_PROCESSING(MPI_GATHER_TAG,i,recvcounts[i])
-#endif
+    _LOG_E_BEGIN_AMPI_PROCESSING(ptr->thisIndex,i,recvcounts[i])
   }
   return 0;
 }
@@ -1979,14 +2008,10 @@ int MPI_Alltoall(void *sendbuf, int sendcount, MPI_Datatype sendtype,
   itemsize = dttype->getSize(recvcount) ;
 
   for(i=0;i<size;i++) {
-#ifndef CMK_OPTIMIZE
-    _LOG_E_END_AMPI_PROCESSING()
-#endif
+    _LOG_E_END_AMPI_PROCESSING(ptr->thisIndex)
     ptr->recv(MPI_GATHER_TAG,i,((char*)recvbuf)+(itemsize*i),
               recvcount,recvtype, comm, (int*)&status);
-#ifndef CMK_OPTIMIZE
-    _LOG_E_BEGIN_AMPI_PROCESSING(MPI_GATHER_TAG,i,recvcount)
-#endif
+    _LOG_E_BEGIN_AMPI_PROCESSING(ptr->thisIndex,i,recvcount)
   }
   return 0;
 }
index 3c3f077c50ff6a663213e22c1a6f5cae8195a75b..fb04ba39688e23793fc760495a6b042726568607 100644 (file)
@@ -3,6 +3,7 @@ module ampi {
   message AmpiMsg;
  
   initnode void ampiNodeInit(void);
+  initproc void ampiProcInit(void);
 
   array[1D] ampiParent {
     entry ampiParent(int universeNo,CProxy_TCharm threads_,CProxy_ComlibManager comlib_);
index 323aa0bc0c3c9f74f8890b7771ade0fba8a24b6a..b8545d9cf98d42c38f0df5b543a1a3d164860126 100644 (file)
@@ -372,6 +372,7 @@ void MPI_Attach(const char *name);
 
 int MPI_Ireduce(void *sendbuf, void *recvbuf, int count, int type, MPI_Op op, int root, MPI_Comm comm, MPI_Request *request);
 
+#include "ampiProjections.h"
 #ifdef __cplusplus
 }
 #endif
similarity index 53%
rename from src/conv-perf/ampiEvents.h
rename to src/libs/ck-libs/ampi/ampiEvents.h
index 9c40914175b2049c38f56979c322344aa6d729ed..5fe76dfe11c1fc6677e762fb044b4ba138c7e800 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef __AMPI_EVENTS_H__
 #define __AMPI_EVENTS_H__
 
-#include "traceCoreAPI.h"
+#include "../../../traceCoreAPI.h"
 #include "ampiProjections.h"
 
 #define _AMPI_LANG_ID  4 /*language id for ampi*/
@@ -10,6 +10,8 @@
 #define _E_BEGIN_AMPI_PROCESSING 25
 #define _E_END_AMPI_PROCESSING  26
 #define _E_AMPI_MSG_SEND        27
+#define _E_AMPI_BEGIN_FUNC 28
+#define _E_AMPI_END_FUNC 29
 
 /* Registering Macro */
 #define REGISTER_AMPI \
          RegisterEvent(_AMPI_LANG_ID,_E_AMPI_MSG_SEND); \
          \
        }
-#define _LOG_E_BEGIN_AMPI_PROCESSING(tag,src,count) { LOGCONDITIONAL(ampi_beginProcessing(tag,src,count));}
-#define _LOG_E_END_AMPI_PROCESSING()               { LOGCONDITIONAL(ampi_endProcessing());}
+#define _LOG_E_BEGIN_AMPI_PROCESSING(rank,src,count) { LOGCONDITIONAL(ampi_beginProcessing(rank,src,count));}
+#define _LOG_E_END_AMPI_PROCESSING(rank)                   { LOGCONDITIONAL(ampi_endProcessing(rank));}
 #define _LOG_E_AMPI_MSG_SEND(tag,dest,count,size)   { LOGCONDITIONAL(ampi_msgSend(tag,dest,count,size));}
+
+#define _AMPI_REGISTER_FUNC(name) { LOGCONDITIONAL(ampi_registerFunc(name))}
+#define _LOG_E_AMPI_BEGIN_FUNC(funcName,comm) {LOGCONDITIONAL(ampi_beginFunc(funcName,comm))}
+#define _LOG_E_AMPI_END_FUNC(funcName,comm) {LOGCONDITIONAL(ampi_endFunc(funcName,comm))}
+
 #endif
diff --git a/src/libs/ck-libs/ampi/ampiProjections.C b/src/libs/ck-libs/ampi/ampiProjections.C
new file mode 100644 (file)
index 0000000..d0325ed
--- /dev/null
@@ -0,0 +1,138 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "converse.h"
+#include "../../../ck.h"
+#include "ampiProjections.h"
+#include "../../../traceCoreCommon.h"
+#include "ampiEvents.h"
+#include "cklists.h"
+#include "ampi.h"
+#include "ampiimpl.h"
+static int current_rank  = -1;
+static int current_src = -1;
+static int current_count = -1;
+extern  ampi *getAmpiInstance(MPI_Comm );
+
+
+/* this dataType stores the information for each function
+        function. 
+*/
+typedef struct {
+       int funcNo;
+       char *funcName;
+} funcData;
+
+
+typedef struct {
+       int index;
+       CkVec<int> funcList;
+} vprocData;
+
+CkVec<funcData *> funcTable; /*stores the name and index for the different functions (might add somethings later on)*/
+CkVec<vprocData *> vprocTable; /*stores the activation stack (only those functions that are being traced) for each virtual processor*/
+
+extern "C" void initAmpiProjections(){
+       ampi_beginProcessing(current_rank,current_src,current_count);
+}
+
+extern "C" void closeAmpiProjections(){        
+       ampi_endProcessing(-1);
+}
+
+extern "C" void ampi_beginProcessing(int rank,int src,int count){
+       int iData[3];
+       iData[0] = rank; //rank of the chunk that begins executing
+       iData[1] = src;
+       if(vprocTable.size() <= rank || rank < 0){
+               iData[2] = -1;  
+       }else{
+               if(vprocTable[rank]->funcList.size() <= 0){
+                       iData[2] = -1;
+               }else{
+                       iData[2] = vprocTable[rank]->funcList[vprocTable[rank]->funcList.size()-1];
+               }
+       }       
+       current_rank = rank;
+       current_src = src;
+       current_count = count;
+       LogEvent1(_AMPI_LANG_ID,_E_BEGIN_AMPI_PROCESSING,3,iData);
+}
+
+extern "C" void ampi_endProcessing(int rank){
+       int iData[3];
+       iData[0] = current_rank;
+       iData[1] = current_src;
+       if(vprocTable.size() <= rank || rank < 0){
+               iData[2] = -1;  
+       }else{
+               if(vprocTable[rank]->funcList.size() <= 0){
+                       iData[2] = -1;
+               }else{
+                       iData[2] = vprocTable[rank]->funcList[vprocTable[rank]->funcList.size()-1];
+               }
+       }       
+
+       LogEvent1(_AMPI_LANG_ID,_E_END_AMPI_PROCESSING,3,iData);
+}
+
+extern "C" void ampi_msgSend(int tag,int dest,int count,int size){
+       int iData[4];
+       iData[0] = tag;
+       iData[1] = dest;
+       iData[2] = count;
+       iData[3] = size;
+       //CmiPrintf("Size = %d\n",size);
+       LogEvent1(_AMPI_LANG_ID,_E_AMPI_MSG_SEND,4,iData);
+}
+
+
+extern "C" int ampi_registerFunc(char *funcName){
+       for(int i=0;i<funcTable.size();i++){
+               if(strcmp(funcTable[i]->funcName,funcName)==0){
+                       return funcTable[i]->funcNo;
+               }
+       }
+       funcData *funcElem = new funcData;
+       funcElem->funcNo = funcTable.size();
+       funcElem->funcName = funcName;
+       funcTable.push_back(funcElem);
+       return funcElem->funcNo;
+}
+
+extern "C" void ampi_beginFunc(int funcNo,MPI_Comm comm){
+       ampi *ptr = getAmpiInstance(comm);
+       int myindex = ptr->thisIndex;
+       int foundFlag=0;
+       vprocData *procElem;
+       if(vprocTable.size() <= myindex){
+               procElem = new vprocData;
+               procElem->index = myindex;
+               procElem->funcList.push_back(funcNo);
+               vprocTable.insert(myindex,procElem);
+       }else{
+               vprocTable[myindex]->funcList.push_back(funcNo);
+       }
+       int iData[2];
+       iData[0] = myindex;
+       iData[1] = funcNo;
+       LogEvent3(_AMPI_LANG_ID,_E_AMPI_BEGIN_FUNC,2,iData,strlen(funcTable[funcNo]->funcName+1),funcTable[funcNo]->funcName);
+}
+
+
+extern "C" void ampi_endFunc(int funcNo,MPI_Comm comm){
+       ampi *ptr = getAmpiInstance(comm);
+       int myindex = ptr->thisIndex;
+       if(vprocTable.size() <= myindex){
+       }else{
+               int size = vprocTable[myindex]->funcList.size();
+               if(size > 0){
+                       vprocTable[myindex]->funcList.remove(size-1);
+               }
+               int iData[2];
+               iData[0] = myindex;
+               iData[1] = funcNo;
+               LogEvent1(_AMPI_LANG_ID,_E_AMPI_END_FUNC,2,iData);
+       }
+}
+
+
similarity index 62%
rename from src/conv-perf/ampiProjections.h
rename to src/libs/ck-libs/ampi/ampiProjections.h
index a9e8480fbbf74c86413be35e6987fbf9e58032cd..db782b72c682277b0d1e24fd8e768055e6b81c22 100644 (file)
@@ -1,14 +1,17 @@
 #ifndef __AMPI_PROJECTIONS_H__
 #define __AMPI_PROJECTIONS_H__
-
+#include "ampi.h"
 #ifdef __cplusplus
 extern "C" {
 #endif
 void initAmpiProjections();
 void closeAmpiProjections();
 void ampi_beginProcessing(int tag,int src,int count);
-void ampi_endProcessing();
+void ampi_endProcessing(int tag);
 void ampi_msgSend(int tag,int dest,int count,int size);
+int ampi_registerFunc(char *funcName);
+void ampi_beginFunc(int funcNo,MPI_Comm comm);
+void ampi_endFunc(int funcNo,MPI_Comm comm);
 #ifdef __cplusplus
 }
 #endif