Started merge of sdag into charm++. The sdag.h file is now included in
authorMilind Bhandarkar <milind@cs.uiuc.edu>
Fri, 23 Mar 2001 08:50:20 +0000 (08:50 +0000)
committerMilind Bhandarkar <milind@cs.uiuc.edu>
Fri, 23 Mar 2001 08:50:20 +0000 (08:50 +0000)
charm++.h, thus users dont know its existence. Also, merged the entire
sdag support class definitions into sdag.h.

src/ck-core/charm++.h
src/ck-core/sdag.h [moved from src/langs/sdag/runtime/CDep.h with 55% similarity]
src/langs/sdag/runtime/CCounter.h [deleted file]
src/langs/sdag/runtime/CMsgBuffer.h [deleted file]
src/langs/sdag/runtime/CWhenTrigger.h [deleted file]
src/langs/sdag/runtime/TList.h [deleted file]
src/langs/sdag/runtime/TStrideArray.h [deleted file]
src/langs/sdag/runtime/sdag.h [deleted file]
src/langs/sdag/xlator/CParseNodeProcess.C
src/scripts/Makefile
src/scripts/Makefile.win32

index cbdc2ef7bb99073fa3bae7214af3ec6b95f24631..1d108549c7b97082ec2e46906c4e52abbebbf02f 100644 (file)
@@ -150,5 +150,6 @@ static inline void _CHECK_CID(CkChareID, int){}
 #include "CkFutures.decl.h"
 #include "tempo.h"
 #include "waitqd.h"
+#include "sdag.h"
 
 #endif
similarity index 55%
rename from src/langs/sdag/runtime/CDep.h
rename to src/ck-core/sdag.h
index 6bc538821de1519cbf23a9a573ef4442f3c28d70..0060048da652bfba2ea0fca5efa592531569e15f 100644 (file)
@@ -5,8 +5,175 @@
  * $Revision$
  *****************************************************************************/
 
-#ifndef _CDep_H_
-#define _CDep_H_
+#ifndef _sdag_H_
+#define _sdag_H_
+
+#include "charm++.h"
+
+class CMsgBuffer {
+  public:
+    int entry;
+    void *msg;
+    int refnum;
+    CMsgBuffer *next;
+    CMsgBuffer(int e, void *m, int r) : entry(e), msg(m), refnum(r) {}
+};
+
+#define MAXARG 8
+#define MAXANY 8
+#define MAXREF 8
+
+class CWhenTrigger {
+  public:
+    int whenID, nArgs;
+    size_t args[MAXARG];
+    int nAnyEntries;
+    int anyEntries[MAXANY];
+    int nEntries;
+    int entries[MAXREF];
+    int refnums[MAXREF];
+    CWhenTrigger *next;
+    CWhenTrigger(int id, int na, int ne, int nae) :
+       whenID(id), nArgs(na), nEntries(ne), nAnyEntries(nae){}
+};
+
+// Quick and dirty List for small numbers of items.
+// It should ideally be a template, but in order to have portability,
+// we would make it two lists
+
+class TListCWhenTrigger
+{
+  private:
+
+    CWhenTrigger *first, *last;
+    CWhenTrigger *current;
+
+  public:
+
+    TListCWhenTrigger(void) : first(0), last(0) {;}
+
+    int empty(void) { return ! first; }
+    
+    CWhenTrigger *begin(void) {
+      return (current = first);
+    }
+
+    int end(void) {
+      return (current == 0);
+    }
+
+    CWhenTrigger *next (void) {
+      return (current = current->next);
+    }
+
+    CWhenTrigger *front(void)
+    {
+      return first;
+    }
+
+    void remove(CWhenTrigger *data)
+    {
+      // case 1: empty list
+      if (first == 0)
+        return;
+      // case 2: first element to be removed
+      if(first == data) {
+        first = first->next;
+       if(first==0) last=0;
+        return;
+      }
+      // case 3: middle or last element to be removed
+      CWhenTrigger *nn;
+      CWhenTrigger *prev = first;
+      for(nn=first->next; nn; nn = nn->next) {
+        if (nn == data) {
+          prev->next = nn->next;
+         if(nn==last)
+           last=prev;
+          return;
+        }
+        prev = nn;
+      }
+    }
+
+    void append(CWhenTrigger *data)
+    {
+      data->next = 0;
+      if(first == 0) {
+        last = first = data;
+      } else {
+        last->next = data;
+       last = last->next;
+      }
+    }
+};
+
+class TListCMsgBuffer
+{
+  private:
+
+    CMsgBuffer *first, *last;
+    CMsgBuffer *current;
+
+  public:
+
+    TListCMsgBuffer(void) : first(0), last(0) {;}
+
+    int empty(void) { return ! first; }
+    
+    CMsgBuffer *begin(void) {
+      return (current = first);
+    }
+
+    int end(void) {
+      return (current == 0);
+    }
+
+    CMsgBuffer *next (void) {
+      return (current = current->next);
+    }
+
+    CMsgBuffer *front(void)
+    {
+      return first;
+    }
+
+    void remove(CMsgBuffer *data)
+    {
+      // case 1: empty list
+      if (first == 0)
+        return;
+      // case 2: first element to be removed
+      if(first == data) {
+        first = first->next;
+       if(first==0) last=0;
+        return;
+      }
+      // case 3: middle or last element to be removed
+      CMsgBuffer *nn;
+      CMsgBuffer *prev = first;
+      for(nn=first->next; nn; nn = nn->next) {
+        if (nn == data) {
+          prev->next = nn->next;
+         if(nn==last)
+           last=prev;
+          return;
+        }
+        prev = nn;
+      }
+    }
+
+    void append(CMsgBuffer *data)
+    {
+      data->next = 0;
+      if(first == 0) {
+        last = first = data;
+      } else {
+        last->next = data;
+       last = last->next;
+      }
+    }
+};
 
 /**
  This class hides all the details of dependencies between
  and when triggers.
 */
 
-#include <stddef.h> // for size_t
-#include "CMsgBuffer.h"
-#include "CWhenTrigger.h"
-#include "TList.h"
-
 class CDep {
    int numEntries, numWhens;
    TListCWhenTrigger **whens;
@@ -151,4 +313,17 @@ class CDep {
      return 1;
    }
 };
+
+class CCounter {
+  private:
+    unsigned int count;
+  public:
+    CCounter(int c) : count(c) {}
+    CCounter(int first, int last, int stride) {
+      count = ((last-first)/stride)+1;
+    }
+    void decrement(void) {count--;}
+    int isDone(void) {return (count==0);}
+};
+
 #endif
diff --git a/src/langs/sdag/runtime/CCounter.h b/src/langs/sdag/runtime/CCounter.h
deleted file mode 100644 (file)
index 5e2fa33..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*****************************************************************************
- * $Source$
- * $Author$
- * $Date$
- * $Revision$
- *****************************************************************************/
-
-#ifndef _CCounter_H_
-#define _CCounter_H_
-
-class CCounter {
-  private:
-    unsigned int count;
-  public:
-    CCounter(int c) : count(c) {}
-    CCounter(int first, int last, int stride) {
-      count = ((last-first)/stride)+1;
-    }
-    void decrement(void) {count--;}
-    int isDone(void) {return (count==0);}
-};
-
-#endif
diff --git a/src/langs/sdag/runtime/CMsgBuffer.h b/src/langs/sdag/runtime/CMsgBuffer.h
deleted file mode 100644 (file)
index 9b337e9..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*****************************************************************************
- * $Source$
- * $Author$
- * $Date$
- * $Revision$
- *****************************************************************************/
-
-#ifndef _CMsgBufer_H_
-#define _CMsgBufer_H_
-
-class CMsgBuffer {
-  public:
-    int entry;
-    void *msg;
-    int refnum;
-    CMsgBuffer *next;
-    CMsgBuffer(int e, void *m, int r) : entry(e), msg(m), refnum(r) {}
-};
-
-#endif
diff --git a/src/langs/sdag/runtime/CWhenTrigger.h b/src/langs/sdag/runtime/CWhenTrigger.h
deleted file mode 100644 (file)
index a3271de..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*****************************************************************************
- * $Source$
- * $Author$
- * $Date$
- * $Revision$
- *****************************************************************************/
-
-#ifndef _CWhenTrigger_H_
-#define _CWhenTrigger_H_
-
-#include <stddef.h> // for size_t
-
-#define MAXARG 8
-#define MAXANY 8
-#define MAXREF 8
-
-class CWhenTrigger {
-  public:
-    int whenID, nArgs;
-    size_t args[MAXARG];
-    int nAnyEntries;
-    int anyEntries[MAXANY];
-    int nEntries;
-    int entries[MAXREF];
-    int refnums[MAXREF];
-    CWhenTrigger *next;
-    CWhenTrigger(int id, int na, int ne, int nae) :
-       whenID(id), nArgs(na), nEntries(ne), nAnyEntries(nae){}
-};
-#endif
diff --git a/src/langs/sdag/runtime/TList.h b/src/langs/sdag/runtime/TList.h
deleted file mode 100644 (file)
index 52c8d93..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/*****************************************************************************
- * $Source$
- * $Author$
- * $Date$
- * $Revision$
- *****************************************************************************/
-
-#ifndef _TList_H_
-#define _TList_H_
-
-#include <stdio.h>
-#include "CWhenTrigger.h"
-#include "CMsgBuffer.h"
-
-// Quick and dirty List for small numbers of items.
-// It should ideally be a template, but in order to have portability,
-// we would make it two lists
-
-class TListCWhenTrigger
-{
-  private:
-
-    CWhenTrigger *first, *last;
-    CWhenTrigger *current;
-
-  public:
-
-    TListCWhenTrigger(void) : first(0), last(0) {;}
-
-    int empty(void) { return ! first; }
-    
-    CWhenTrigger *begin(void) {
-      return (current = first);
-    }
-
-    int end(void) {
-      return (current == 0);
-    }
-
-    CWhenTrigger *next (void) {
-      return (current = current->next);
-    }
-
-    CWhenTrigger *front(void)
-    {
-      return first;
-    }
-
-    void remove(CWhenTrigger *data)
-    {
-      // case 1: empty list
-      if (first == 0)
-        return;
-      // case 2: first element to be removed
-      if(first == data) {
-        first = first->next;
-       if(first==0) last=0;
-        return;
-      }
-      // case 3: middle or last element to be removed
-      CWhenTrigger *nn;
-      CWhenTrigger *prev = first;
-      for(nn=first->next; nn; nn = nn->next) {
-        if (nn == data) {
-          prev->next = nn->next;
-         if(nn==last)
-           last=prev;
-          return;
-        }
-        prev = nn;
-      }
-    }
-
-    void append(CWhenTrigger *data)
-    {
-      data->next = 0;
-      if(first == 0) {
-        last = first = data;
-      } else {
-        last->next = data;
-       last = last->next;
-      }
-    }
-};
-
-class TListCMsgBuffer
-{
-  private:
-
-    CMsgBuffer *first, *last;
-    CMsgBuffer *current;
-
-  public:
-
-    TListCMsgBuffer(void) : first(0), last(0) {;}
-
-    int empty(void) { return ! first; }
-    
-    CMsgBuffer *begin(void) {
-      return (current = first);
-    }
-
-    int end(void) {
-      return (current == 0);
-    }
-
-    CMsgBuffer *next (void) {
-      return (current = current->next);
-    }
-
-    CMsgBuffer *front(void)
-    {
-      return first;
-    }
-
-    void remove(CMsgBuffer *data)
-    {
-      // case 1: empty list
-      if (first == 0)
-        return;
-      // case 2: first element to be removed
-      if(first == data) {
-        first = first->next;
-       if(first==0) last=0;
-        return;
-      }
-      // case 3: middle or last element to be removed
-      CMsgBuffer *nn;
-      CMsgBuffer *prev = first;
-      for(nn=first->next; nn; nn = nn->next) {
-        if (nn == data) {
-          prev->next = nn->next;
-         if(nn==last)
-           last=prev;
-          return;
-        }
-        prev = nn;
-      }
-    }
-
-    void append(CMsgBuffer *data)
-    {
-      data->next = 0;
-      if(first == 0) {
-        last = first = data;
-      } else {
-        last->next = data;
-       last = last->next;
-      }
-    }
-};
-
-#endif
-
diff --git a/src/langs/sdag/runtime/TStrideArray.h b/src/langs/sdag/runtime/TStrideArray.h
deleted file mode 100644 (file)
index c6374b9..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*****************************************************************************
- * $Source$
- * $Author$
- * $Date$
- * $Revision$
- *****************************************************************************/
-
-#ifndef _TStrideArray_H_
-#define _TStrideArray_H_
-
-template <class T> 
-class TStrideArray {
-  private:
-    T *array;
-    int start, end, stride;
-  public:
-    TStrideArray<T>(int s, int e, int st=1) {
-      int size = (e-s+1)/st;
-      array = new T[size];
-      start = s; end = e; stride = st;
-    }
-    T& operator[](int idx) {
-      return array[(idx-start)/stride];
-    }
-    ~TStrideArray<T>(void) {
-      delete[] array;
-    }
-};
-
-#endif
diff --git a/src/langs/sdag/runtime/sdag.h b/src/langs/sdag/runtime/sdag.h
deleted file mode 100644 (file)
index d0978bf..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*****************************************************************************
- * $Source$
- * $Author$
- * $Date$
- * $Revision$
- *****************************************************************************/
-
-#ifndef _sdag_H_
-#define _sdag_H_
-
-#include "charm++.h"
-
-#include "CDep.h"
-#include "CCounter.h"
-
-// returns count of values from starting and ending value
-// considering stride.
-
-static int __getCount(int start, int end, int stride)
-{
-  return (((end-start)/stride)+1);
-}
-
-static void __swap(int *x, int *y)
-{
-  int tmp = *x;
-  *x = *y;
-  *y = tmp;
-}
-
-#endif
index 7b07274d5574234406e14f8287be1bf17806e560..14a1878d4a5d114133471cb6f3e351147d941b58 100644 (file)
@@ -577,7 +577,7 @@ void CParseNode::generateForall(void)
               con2->text->charstar(), con3->text->charstar(),
               con4->text->charstar());
   pH(2, "if (__first > __last) {\n");
-  pH(3, "__swap(&__first, &__last);\n");
+  pH(3, "int __tmp=__first; __first=__last; __last=__tmp;\n");
   pH(3, "__stride = -__stride;\n");
   pH(2, "}\n");
   pH(2, "CCounter *%s = new CCounter(__first,__last,__stride);\n", 
index 8e4821b9b3afcf93373fa6cfa01203c2e4c41001..559102b62486f02e0da26677bf5567f4fdfe19ee 100644 (file)
@@ -125,7 +125,6 @@ CKHEADERS=ck.h ckstream.h envelope.h init.h qd.h charm.h charm++.h \
 
 ALLHEADERS=$(CKHEADERS) \
     simplemsg.h sm.h pvmc.h pvm3.h sdag.h \
-    CDep.h CCounter.h CMsgBuffer.h CWhenTrigger.h TList.h \
        graph.h bitvecset.h Set.h ampiimpl.h
 
 basics: headers
@@ -165,7 +164,6 @@ dirs+sources:
        ./gatherflat ../../src/Common/langs/ampi       .
        ./gatherflat ../../src/Common/langs/bluegene   .
        ./gatherflat ../../src/Common/langs/sdag/xlator       .
-       ./gatherflat ../../src/Common/langs/sdag/runtime      .
        ./gatherflat ../../src/Common/langs/f90charm      .
        ./gatherflat ../../src/Common/xlat-i           .
        ./gatherflat ../../src/Common/xlatcpm          .
index c03d143433bd289434326b7dc33386abb0676ea5..22980ee47a7d90c37acf07c7a92a26c5096dae12 100644 (file)
@@ -79,7 +79,6 @@ CKHEADERS=ck.h ckstream.h envelope.h init.h qd.h charm.h charm++.h \
 \r
 ALLHEADERS=$(CKHEADERS) \\r
     simplemsg.h sm.h pvmc.h pvm3.h sdag.h \\r
-    CDep.h CCounter.h CMsgBuffer.h CWhenTrigger.h TList.h \\r
        graph.h bitvecset.h Set.h ampiimpl.h\r
 \r
 BASICS : DIRSSOURCES $(ALLHEADERS)\r
@@ -109,7 +108,6 @@ DIRSSOURCES :
        @xcopy /d /q  ..\..\src\Common\langs\bluegene\* .\r
        @xcopy /d /q  ..\..\src\Common\langs\simplemsg\* .\r
        @xcopy /d /q  ..\..\src\Common\langs\sdag\xlator\* .\r
-       @xcopy /d /q  ..\..\src\Common\langs\sdag\runtime\* .\r
        @xcopy /d /q  ..\..\src\Common\langs\pvmc\* .\r
        @xcopy /d /q  ..\..\src\Common\util\* .\r
        @xcopy /d /q  ..\..\src\Common\xlat-i\* .\r