A script that generates parts of the control point framework's API and implementation.
authorIsaac Dooley <idooley2@illinois.edu>
Mon, 26 Oct 2009 16:42:16 +0000 (16:42 +0000)
committerIsaac Dooley <idooley2@illinois.edu>
Mon, 26 Oct 2009 16:42:16 +0000 (16:42 +0000)
src/ck-cp/API-generator/Makefile [new file with mode: 0644]
src/ck-cp/API-generator/cp_effects.pl [new file with mode: 0755]
src/ck-cp/API-generator/cp_effects.txt [new file with mode: 0644]

diff --git a/src/ck-cp/API-generator/Makefile b/src/ck-cp/API-generator/Makefile
new file mode 100644 (file)
index 0000000..e7e6cd2
--- /dev/null
@@ -0,0 +1,11 @@
+
+
+
+cp_effects : cp_effects.cpp cp_effects.h
+        ../../../bin/charmc  cp_effects.cpp -o cp_effects
+
+cp_effects.h cp_effects.cpp : cp_effects.pl cp_effects.txt
+       ./cp_effects.pl
+
+clean : 
+       rm -rf cp_effects *~
\ No newline at end of file
diff --git a/src/ck-cp/API-generator/cp_effects.pl b/src/ck-cp/API-generator/cp_effects.pl
new file mode 100755 (executable)
index 0000000..1e8bf17
--- /dev/null
@@ -0,0 +1,95 @@
+#!/usr/bin/perl
+
+# Generate forward declarations for all types of control point effects.
+# each one takes a name and an association (arrayProxy and/or entryID).
+# use C++ to overload the function names.
+
+
+open(OUT_H, ">cp_effects.h");
+open(OUT_CPP, ">cp_effects.cpp");
+
+
+
+open(FILE, "cp_effects.txt");
+while($line = <FILE>){
+  chomp $line;
+  if(length($line) > 0){
+    $cp = $line;
+    $funcdecls .= "\tvoid $cp(std::string name, const ControlPoint::ControlPointAssociation &a = NoControlPointAssociation);\n";
+    $funccalls .= "\tControlPoint::EffectIncrease::$cp(\"name\");\n";
+    $funccalls .= "\tControlPoint::EffectDecrease::$cp(\"name\");\n";
+    $funccalls .= "\tControlPoint::EffectIncrease::$cp(\"name\", NoControlPointAssociation);\n";
+    $funccalls .= "\tControlPoint::EffectDecrease::$cp(\"name\", NoControlPointAssociation);\n";
+
+    $funcdefs .= "\t  void ControlPoint::EffectDecrease::$cp(std::string s, const ControlPoint::ControlPointAssociation &a){ }\n";
+    $funcdefs .= "\t  void ControlPoint::EffectIncrease::$cp(std::string s, const ControlPoint::ControlPointAssociation &a){ }\n";
+
+  }
+}
+
+
+
+
+
+print OUT_H <<EOF;
+#include <string>
+#include <set>
+#include <ckarray.h>
+
+namespace ControlPoint {
+  class ControlPointAssociation{
+  public:
+    std::set<int> EntryID;
+    std::set<int> ArrayGroupIdx;
+      ControlPointAssociation(){
+       // nothing here yet
+      }
+  };
+  
+  class ControlPointAssociatedEntry : public ControlPointAssociation {
+    public :
+       ControlPointAssociatedEntry(int epid) : ControlPointAssociation() {
+         EntryID.insert(epid);
+       }    
+  };
+  
+  class ControlPointAssociatedArray : public ControlPointAssociation {
+  public:
+    ControlPointAssociatedArray(CProxy_ArrayBase &a) : ControlPointAssociation() {
+      CkGroupID aid = arraybase.ckGetArrayID();
+      int groupIdx = aid.idx;
+      ArrayGroupIdx.insert(groupIdx);
+    }    
+  };
+  
+  ControlPointAssociation NoControlPointAssociation;
+
+EOF
+
+print OUT_H "namespace EffectIncrease {\n";
+print OUT_H $funcdecls;
+print OUT_H "}\n\n";
+
+print OUT_H "namespace EffectDecrease {\n";
+print OUT_H $funcdecls;
+print OUT_H "}\n";
+
+print OUT_H "} //namespace ControlPoint \n";
+
+
+print OUT_CPP <<EOF;
+#include "cp_effects.h"
+using namespace ControlPoint;
+int main(){
+
+EOF
+
+print OUT_CPP "$funccalls";
+
+print OUT_CPP <<EOF;
+  return 0;
+}
+
+EOF
+
+print OUT_CPP "$funcdefs";
diff --git a/src/ck-cp/API-generator/cp_effects.txt b/src/ck-cp/API-generator/cp_effects.txt
new file mode 100644 (file)
index 0000000..567d6d6
--- /dev/null
@@ -0,0 +1,15 @@
+Priority
+MemoryConsumption
+Granularity
+ComputeDurations
+FlopRate
+NumComputeObjects
+NumMessages
+MessageSizes
+MessageOverhead
+UnnecessarySyncronization
+Concurrency
+PotentialOverlap
+LoadBalancingPeriod
+GPUOffloadedWork
+