Added the generated file for control points.
authorJonathan Lifflander <jliffl2@illinois.edu>
Tue, 27 Oct 2009 19:50:29 +0000 (19:50 +0000)
committerJonathan Lifflander <jliffl2@illinois.edu>
Tue, 27 Oct 2009 19:50:29 +0000 (19:50 +0000)
src/ck-cp/API-generator/Makefile-cp_effects [deleted file]
src/ck-cp/API-generator/cp_effects.C [new file with mode: 0644]
src/ck-cp/API-generator/cp_effects.h [new file with mode: 0644]
src/ck-cp/API-generator/cp_effects.pl

diff --git a/src/ck-cp/API-generator/Makefile-cp_effects b/src/ck-cp/API-generator/Makefile-cp_effects
deleted file mode 100644 (file)
index 525f821..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-cp_effects : cp_effects.cpp cp_effects.h
-        ../bin/charmc  -c cp_effects.cpp
-
-cp_effects.h cp_effects.cpp : cp_effects.pl cp_effects.txt Makefile-cp_effects
-       ./cp_effects.pl
-
-clean : 
-       rm -rf cp_effects cp_effects.cpp cp_effects.h *~
\ No newline at end of file
diff --git a/src/ck-cp/API-generator/cp_effects.C b/src/ck-cp/API-generator/cp_effects.C
new file mode 100644 (file)
index 0000000..4dcca99
--- /dev/null
@@ -0,0 +1,222 @@
+#include "cp_effects.h"
+
+using namespace ControlPoint;
+using namespace std;
+
+enum EFFECT {EFF_DEC, EFF_INC};
+
+typedef map<std::string, map<std::string, vector<pair<int, ControlPoint::ControlPointAssociation> > > > cp_effect_map;
+typedef map<std::string, vector<pair<int, ControlPoint::ControlPointAssociation> > > cp_name_map;
+
+CkpvDeclare(cp_effect_map, cp_effects);
+CkpvDeclare(cp_name_map, cp_names);
+
+void initControlPointEffects() {
+       CkpvInitialize(cp_effect_map, cp_effects);
+       CkpvInitialize(cp_name_map, cp_names);
+}
+
+void testControlPointEffects() {
+
+       ControlPoint::EffectIncrease::Priority("name");
+       ControlPoint::EffectDecrease::Priority("name");
+       ControlPoint::EffectIncrease::Priority("name", NoControlPointAssociation);
+       ControlPoint::EffectDecrease::Priority("name", NoControlPointAssociation);
+       ControlPoint::EffectIncrease::Priority("name", EntryAssociation);
+       ControlPoint::EffectDecrease::Priority("name", EntryAssociation);
+       ControlPoint::EffectIncrease::Priority("name", ArrayAssociation);
+       ControlPoint::EffectDecrease::Priority("name", ArrayAssociation);
+       ControlPoint::EffectIncrease::MemoryConsumption("name");
+       ControlPoint::EffectDecrease::MemoryConsumption("name");
+       ControlPoint::EffectIncrease::MemoryConsumption("name", NoControlPointAssociation);
+       ControlPoint::EffectDecrease::MemoryConsumption("name", NoControlPointAssociation);
+       ControlPoint::EffectIncrease::MemoryConsumption("name", EntryAssociation);
+       ControlPoint::EffectDecrease::MemoryConsumption("name", EntryAssociation);
+       ControlPoint::EffectIncrease::MemoryConsumption("name", ArrayAssociation);
+       ControlPoint::EffectDecrease::MemoryConsumption("name", ArrayAssociation);
+       ControlPoint::EffectIncrease::Granularity("name");
+       ControlPoint::EffectDecrease::Granularity("name");
+       ControlPoint::EffectIncrease::Granularity("name", NoControlPointAssociation);
+       ControlPoint::EffectDecrease::Granularity("name", NoControlPointAssociation);
+       ControlPoint::EffectIncrease::Granularity("name", EntryAssociation);
+       ControlPoint::EffectDecrease::Granularity("name", EntryAssociation);
+       ControlPoint::EffectIncrease::Granularity("name", ArrayAssociation);
+       ControlPoint::EffectDecrease::Granularity("name", ArrayAssociation);
+       ControlPoint::EffectIncrease::ComputeDurations("name");
+       ControlPoint::EffectDecrease::ComputeDurations("name");
+       ControlPoint::EffectIncrease::ComputeDurations("name", NoControlPointAssociation);
+       ControlPoint::EffectDecrease::ComputeDurations("name", NoControlPointAssociation);
+       ControlPoint::EffectIncrease::ComputeDurations("name", EntryAssociation);
+       ControlPoint::EffectDecrease::ComputeDurations("name", EntryAssociation);
+       ControlPoint::EffectIncrease::ComputeDurations("name", ArrayAssociation);
+       ControlPoint::EffectDecrease::ComputeDurations("name", ArrayAssociation);
+       ControlPoint::EffectIncrease::FlopRate("name");
+       ControlPoint::EffectDecrease::FlopRate("name");
+       ControlPoint::EffectIncrease::FlopRate("name", NoControlPointAssociation);
+       ControlPoint::EffectDecrease::FlopRate("name", NoControlPointAssociation);
+       ControlPoint::EffectIncrease::FlopRate("name", EntryAssociation);
+       ControlPoint::EffectDecrease::FlopRate("name", EntryAssociation);
+       ControlPoint::EffectIncrease::FlopRate("name", ArrayAssociation);
+       ControlPoint::EffectDecrease::FlopRate("name", ArrayAssociation);
+       ControlPoint::EffectIncrease::NumComputeObjects("name");
+       ControlPoint::EffectDecrease::NumComputeObjects("name");
+       ControlPoint::EffectIncrease::NumComputeObjects("name", NoControlPointAssociation);
+       ControlPoint::EffectDecrease::NumComputeObjects("name", NoControlPointAssociation);
+       ControlPoint::EffectIncrease::NumComputeObjects("name", EntryAssociation);
+       ControlPoint::EffectDecrease::NumComputeObjects("name", EntryAssociation);
+       ControlPoint::EffectIncrease::NumComputeObjects("name", ArrayAssociation);
+       ControlPoint::EffectDecrease::NumComputeObjects("name", ArrayAssociation);
+       ControlPoint::EffectIncrease::NumMessages("name");
+       ControlPoint::EffectDecrease::NumMessages("name");
+       ControlPoint::EffectIncrease::NumMessages("name", NoControlPointAssociation);
+       ControlPoint::EffectDecrease::NumMessages("name", NoControlPointAssociation);
+       ControlPoint::EffectIncrease::NumMessages("name", EntryAssociation);
+       ControlPoint::EffectDecrease::NumMessages("name", EntryAssociation);
+       ControlPoint::EffectIncrease::NumMessages("name", ArrayAssociation);
+       ControlPoint::EffectDecrease::NumMessages("name", ArrayAssociation);
+       ControlPoint::EffectIncrease::MessageSizes("name");
+       ControlPoint::EffectDecrease::MessageSizes("name");
+       ControlPoint::EffectIncrease::MessageSizes("name", NoControlPointAssociation);
+       ControlPoint::EffectDecrease::MessageSizes("name", NoControlPointAssociation);
+       ControlPoint::EffectIncrease::MessageSizes("name", EntryAssociation);
+       ControlPoint::EffectDecrease::MessageSizes("name", EntryAssociation);
+       ControlPoint::EffectIncrease::MessageSizes("name", ArrayAssociation);
+       ControlPoint::EffectDecrease::MessageSizes("name", ArrayAssociation);
+       ControlPoint::EffectIncrease::MessageOverhead("name");
+       ControlPoint::EffectDecrease::MessageOverhead("name");
+       ControlPoint::EffectIncrease::MessageOverhead("name", NoControlPointAssociation);
+       ControlPoint::EffectDecrease::MessageOverhead("name", NoControlPointAssociation);
+       ControlPoint::EffectIncrease::MessageOverhead("name", EntryAssociation);
+       ControlPoint::EffectDecrease::MessageOverhead("name", EntryAssociation);
+       ControlPoint::EffectIncrease::MessageOverhead("name", ArrayAssociation);
+       ControlPoint::EffectDecrease::MessageOverhead("name", ArrayAssociation);
+       ControlPoint::EffectIncrease::UnnecessarySyncronization("name");
+       ControlPoint::EffectDecrease::UnnecessarySyncronization("name");
+       ControlPoint::EffectIncrease::UnnecessarySyncronization("name", NoControlPointAssociation);
+       ControlPoint::EffectDecrease::UnnecessarySyncronization("name", NoControlPointAssociation);
+       ControlPoint::EffectIncrease::UnnecessarySyncronization("name", EntryAssociation);
+       ControlPoint::EffectDecrease::UnnecessarySyncronization("name", EntryAssociation);
+       ControlPoint::EffectIncrease::UnnecessarySyncronization("name", ArrayAssociation);
+       ControlPoint::EffectDecrease::UnnecessarySyncronization("name", ArrayAssociation);
+       ControlPoint::EffectIncrease::Concurrency("name");
+       ControlPoint::EffectDecrease::Concurrency("name");
+       ControlPoint::EffectIncrease::Concurrency("name", NoControlPointAssociation);
+       ControlPoint::EffectDecrease::Concurrency("name", NoControlPointAssociation);
+       ControlPoint::EffectIncrease::Concurrency("name", EntryAssociation);
+       ControlPoint::EffectDecrease::Concurrency("name", EntryAssociation);
+       ControlPoint::EffectIncrease::Concurrency("name", ArrayAssociation);
+       ControlPoint::EffectDecrease::Concurrency("name", ArrayAssociation);
+       ControlPoint::EffectIncrease::PotentialOverlap("name");
+       ControlPoint::EffectDecrease::PotentialOverlap("name");
+       ControlPoint::EffectIncrease::PotentialOverlap("name", NoControlPointAssociation);
+       ControlPoint::EffectDecrease::PotentialOverlap("name", NoControlPointAssociation);
+       ControlPoint::EffectIncrease::PotentialOverlap("name", EntryAssociation);
+       ControlPoint::EffectDecrease::PotentialOverlap("name", EntryAssociation);
+       ControlPoint::EffectIncrease::PotentialOverlap("name", ArrayAssociation);
+       ControlPoint::EffectDecrease::PotentialOverlap("name", ArrayAssociation);
+       ControlPoint::EffectIncrease::LoadBalancingPeriod("name");
+       ControlPoint::EffectDecrease::LoadBalancingPeriod("name");
+       ControlPoint::EffectIncrease::LoadBalancingPeriod("name", NoControlPointAssociation);
+       ControlPoint::EffectDecrease::LoadBalancingPeriod("name", NoControlPointAssociation);
+       ControlPoint::EffectIncrease::LoadBalancingPeriod("name", EntryAssociation);
+       ControlPoint::EffectDecrease::LoadBalancingPeriod("name", EntryAssociation);
+       ControlPoint::EffectIncrease::LoadBalancingPeriod("name", ArrayAssociation);
+       ControlPoint::EffectDecrease::LoadBalancingPeriod("name", ArrayAssociation);
+       ControlPoint::EffectIncrease::GPUOffloadedWork("name");
+       ControlPoint::EffectDecrease::GPUOffloadedWork("name");
+       ControlPoint::EffectIncrease::GPUOffloadedWork("name", NoControlPointAssociation);
+       ControlPoint::EffectDecrease::GPUOffloadedWork("name", NoControlPointAssociation);
+       ControlPoint::EffectIncrease::GPUOffloadedWork("name", EntryAssociation);
+       ControlPoint::EffectDecrease::GPUOffloadedWork("name", EntryAssociation);
+       ControlPoint::EffectIncrease::GPUOffloadedWork("name", ArrayAssociation);
+       ControlPoint::EffectDecrease::GPUOffloadedWork("name", ArrayAssociation);
+}
+
+void insert(const std::string control_type, const std::string name, const ControlPoint::ControlPointAssociation &a, const int effect) {
+       CkpvAccess(cp_effects)[control_type][name].push_back(std::make_pair(effect, a));
+       CkpvAccess(cp_names)[name].push_back(std::make_pair(effect, a));
+}
+void ControlPoint::EffectDecrease::Priority(std::string s, const ControlPoint::ControlPointAssociation &a) {
+       insert("Priority", s, a, EFF_DEC);
+}
+void ControlPoint::EffectIncrease::Priority(std::string s, const ControlPoint::ControlPointAssociation &a) {
+       insert("Priority", s, a, EFF_INC);
+}
+void ControlPoint::EffectDecrease::MemoryConsumption(std::string s, const ControlPoint::ControlPointAssociation &a) {
+       insert("MemoryConsumption", s, a, EFF_DEC);
+}
+void ControlPoint::EffectIncrease::MemoryConsumption(std::string s, const ControlPoint::ControlPointAssociation &a) {
+       insert("MemoryConsumption", s, a, EFF_INC);
+}
+void ControlPoint::EffectDecrease::Granularity(std::string s, const ControlPoint::ControlPointAssociation &a) {
+       insert("Granularity", s, a, EFF_DEC);
+}
+void ControlPoint::EffectIncrease::Granularity(std::string s, const ControlPoint::ControlPointAssociation &a) {
+       insert("Granularity", s, a, EFF_INC);
+}
+void ControlPoint::EffectDecrease::ComputeDurations(std::string s, const ControlPoint::ControlPointAssociation &a) {
+       insert("ComputeDurations", s, a, EFF_DEC);
+}
+void ControlPoint::EffectIncrease::ComputeDurations(std::string s, const ControlPoint::ControlPointAssociation &a) {
+       insert("ComputeDurations", s, a, EFF_INC);
+}
+void ControlPoint::EffectDecrease::FlopRate(std::string s, const ControlPoint::ControlPointAssociation &a) {
+       insert("FlopRate", s, a, EFF_DEC);
+}
+void ControlPoint::EffectIncrease::FlopRate(std::string s, const ControlPoint::ControlPointAssociation &a) {
+       insert("FlopRate", s, a, EFF_INC);
+}
+void ControlPoint::EffectDecrease::NumComputeObjects(std::string s, const ControlPoint::ControlPointAssociation &a) {
+       insert("NumComputeObjects", s, a, EFF_DEC);
+}
+void ControlPoint::EffectIncrease::NumComputeObjects(std::string s, const ControlPoint::ControlPointAssociation &a) {
+       insert("NumComputeObjects", s, a, EFF_INC);
+}
+void ControlPoint::EffectDecrease::NumMessages(std::string s, const ControlPoint::ControlPointAssociation &a) {
+       insert("NumMessages", s, a, EFF_DEC);
+}
+void ControlPoint::EffectIncrease::NumMessages(std::string s, const ControlPoint::ControlPointAssociation &a) {
+       insert("NumMessages", s, a, EFF_INC);
+}
+void ControlPoint::EffectDecrease::MessageSizes(std::string s, const ControlPoint::ControlPointAssociation &a) {
+       insert("MessageSizes", s, a, EFF_DEC);
+}
+void ControlPoint::EffectIncrease::MessageSizes(std::string s, const ControlPoint::ControlPointAssociation &a) {
+       insert("MessageSizes", s, a, EFF_INC);
+}
+void ControlPoint::EffectDecrease::MessageOverhead(std::string s, const ControlPoint::ControlPointAssociation &a) {
+       insert("MessageOverhead", s, a, EFF_DEC);
+}
+void ControlPoint::EffectIncrease::MessageOverhead(std::string s, const ControlPoint::ControlPointAssociation &a) {
+       insert("MessageOverhead", s, a, EFF_INC);
+}
+void ControlPoint::EffectDecrease::UnnecessarySyncronization(std::string s, const ControlPoint::ControlPointAssociation &a) {
+       insert("UnnecessarySyncronization", s, a, EFF_DEC);
+}
+void ControlPoint::EffectIncrease::UnnecessarySyncronization(std::string s, const ControlPoint::ControlPointAssociation &a) {
+       insert("UnnecessarySyncronization", s, a, EFF_INC);
+}
+void ControlPoint::EffectDecrease::Concurrency(std::string s, const ControlPoint::ControlPointAssociation &a) {
+       insert("Concurrency", s, a, EFF_DEC);
+}
+void ControlPoint::EffectIncrease::Concurrency(std::string s, const ControlPoint::ControlPointAssociation &a) {
+       insert("Concurrency", s, a, EFF_INC);
+}
+void ControlPoint::EffectDecrease::PotentialOverlap(std::string s, const ControlPoint::ControlPointAssociation &a) {
+       insert("PotentialOverlap", s, a, EFF_DEC);
+}
+void ControlPoint::EffectIncrease::PotentialOverlap(std::string s, const ControlPoint::ControlPointAssociation &a) {
+       insert("PotentialOverlap", s, a, EFF_INC);
+}
+void ControlPoint::EffectDecrease::LoadBalancingPeriod(std::string s, const ControlPoint::ControlPointAssociation &a) {
+       insert("LoadBalancingPeriod", s, a, EFF_DEC);
+}
+void ControlPoint::EffectIncrease::LoadBalancingPeriod(std::string s, const ControlPoint::ControlPointAssociation &a) {
+       insert("LoadBalancingPeriod", s, a, EFF_INC);
+}
+void ControlPoint::EffectDecrease::GPUOffloadedWork(std::string s, const ControlPoint::ControlPointAssociation &a) {
+       insert("GPUOffloadedWork", s, a, EFF_DEC);
+}
+void ControlPoint::EffectIncrease::GPUOffloadedWork(std::string s, const ControlPoint::ControlPointAssociation &a) {
+       insert("GPUOffloadedWork", s, a, EFF_INC);
+}
diff --git a/src/ck-cp/API-generator/cp_effects.h b/src/ck-cp/API-generator/cp_effects.h
new file mode 100644 (file)
index 0000000..40e0776
--- /dev/null
@@ -0,0 +1,78 @@
+#include <string>
+#include <vector>
+#include <set>
+#include <map>
+#include <utility>
+#include "charm++.h"
+#include "ck.h"
+#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() : ControlPointAssociation() {}
+
+       ControlPointAssociatedEntry(int epid) : ControlPointAssociation() {
+         EntryID.insert(epid);
+       }    
+  };
+  
+  class ControlPointAssociatedArray : public ControlPointAssociation {
+  public:
+    ControlPointAssociatedArray() : ControlPointAssociation() {}
+
+    ControlPointAssociatedArray(CProxy_ArrayBase &a) : ControlPointAssociation() {
+      CkGroupID aid = a.ckGetArrayID();
+      int groupIdx = aid.idx;
+      ArrayGroupIdx.insert(groupIdx);
+    }    
+  };
+  
+  ControlPointAssociation NoControlPointAssociation;
+  int epid = 2;
+  ControlPointAssociatedEntry EntryAssociation(epid);
+  ControlPointAssociatedArray ArrayAssociation;
+
+namespace EffectIncrease {
+       void Priority(std::string name, const ControlPoint::ControlPointAssociation &a = NoControlPointAssociation);
+       void MemoryConsumption(std::string name, const ControlPoint::ControlPointAssociation &a = NoControlPointAssociation);
+       void Granularity(std::string name, const ControlPoint::ControlPointAssociation &a = NoControlPointAssociation);
+       void ComputeDurations(std::string name, const ControlPoint::ControlPointAssociation &a = NoControlPointAssociation);
+       void FlopRate(std::string name, const ControlPoint::ControlPointAssociation &a = NoControlPointAssociation);
+       void NumComputeObjects(std::string name, const ControlPoint::ControlPointAssociation &a = NoControlPointAssociation);
+       void NumMessages(std::string name, const ControlPoint::ControlPointAssociation &a = NoControlPointAssociation);
+       void MessageSizes(std::string name, const ControlPoint::ControlPointAssociation &a = NoControlPointAssociation);
+       void MessageOverhead(std::string name, const ControlPoint::ControlPointAssociation &a = NoControlPointAssociation);
+       void UnnecessarySyncronization(std::string name, const ControlPoint::ControlPointAssociation &a = NoControlPointAssociation);
+       void Concurrency(std::string name, const ControlPoint::ControlPointAssociation &a = NoControlPointAssociation);
+       void PotentialOverlap(std::string name, const ControlPoint::ControlPointAssociation &a = NoControlPointAssociation);
+       void LoadBalancingPeriod(std::string name, const ControlPoint::ControlPointAssociation &a = NoControlPointAssociation);
+       void GPUOffloadedWork(std::string name, const ControlPoint::ControlPointAssociation &a = NoControlPointAssociation);
+}
+
+namespace EffectDecrease {
+       void Priority(std::string name, const ControlPoint::ControlPointAssociation &a = NoControlPointAssociation);
+       void MemoryConsumption(std::string name, const ControlPoint::ControlPointAssociation &a = NoControlPointAssociation);
+       void Granularity(std::string name, const ControlPoint::ControlPointAssociation &a = NoControlPointAssociation);
+       void ComputeDurations(std::string name, const ControlPoint::ControlPointAssociation &a = NoControlPointAssociation);
+       void FlopRate(std::string name, const ControlPoint::ControlPointAssociation &a = NoControlPointAssociation);
+       void NumComputeObjects(std::string name, const ControlPoint::ControlPointAssociation &a = NoControlPointAssociation);
+       void NumMessages(std::string name, const ControlPoint::ControlPointAssociation &a = NoControlPointAssociation);
+       void MessageSizes(std::string name, const ControlPoint::ControlPointAssociation &a = NoControlPointAssociation);
+       void MessageOverhead(std::string name, const ControlPoint::ControlPointAssociation &a = NoControlPointAssociation);
+       void UnnecessarySyncronization(std::string name, const ControlPoint::ControlPointAssociation &a = NoControlPointAssociation);
+       void Concurrency(std::string name, const ControlPoint::ControlPointAssociation &a = NoControlPointAssociation);
+       void PotentialOverlap(std::string name, const ControlPoint::ControlPointAssociation &a = NoControlPointAssociation);
+       void LoadBalancingPeriod(std::string name, const ControlPoint::ControlPointAssociation &a = NoControlPointAssociation);
+       void GPUOffloadedWork(std::string name, const ControlPoint::ControlPointAssociation &a = NoControlPointAssociation);
+}
+} //namespace ControlPoint 
index 0d5100f16a25560874c9e38f640a883a9510fb25..c2d5cc6e998746fd3acc0d9264d85f3a4475bada 100755 (executable)
@@ -1,21 +1,28 @@
 #!/usr/bin/perl
 
+use strict;
+use warnings;
+
 # 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(OUT_CPP, ">cp_effects.C");
+open(FILE, "cp_effects.txt");
 
+my $funcdecls;
+my $funccalls;
+my $funcdefs;
 
-open(FILE, "cp_effects.txt");
-while($line = <FILE>){
+while(my $line = <FILE>) {
   chomp $line;
-  if(length($line) > 0){
-    $cp = $line;
+
+  if(length($line) > 0) {
+    my $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";
@@ -25,38 +32,38 @@ while($line = <FILE>){
     $funccalls .= "\tControlPoint::EffectIncrease::$cp(\"name\", ArrayAssociation);\n";
     $funccalls .= "\tControlPoint::EffectDecrease::$cp(\"name\", ArrayAssociation);\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";
-
+    $funcdefs .= "void ControlPoint::EffectDecrease::$cp(std::string s, const ControlPoint::ControlPointAssociation &a) {\n" .
+       "\tinsert(\"$cp\", s, a, EFF_DEC);\n" .
+       "}\n";
+    $funcdefs .= "void ControlPoint::EffectIncrease::$cp(std::string s, const ControlPoint::ControlPointAssociation &a) {\n" .
+       "\tinsert(\"$cp\", s, a, EFF_INC);\n" .
+       "}\n";
   }
 }
 
-
-
-
-
 print OUT_H <<EOF;
 #include <string>
+#include <vector>
 #include <set>
+#include <map>
+#include <utility>
 #include "charm++.h"
 #include "ck.h"
 #include "ckarray.h"
 
 namespace ControlPoint {
-  class ControlPointAssociation{
+  class ControlPointAssociation {
   public:
     std::set<int> EntryID;
     std::set<int> ArrayGroupIdx;
-      ControlPointAssociation(){
+      ControlPointAssociation() {
        // nothing here yet
       }
   };
   
   class ControlPointAssociatedEntry : public ControlPointAssociation {
     public :
-       ControlPointAssociatedEntry() : ControlPointAssociation(){}
+       ControlPointAssociatedEntry() : ControlPointAssociation() {}
 
        ControlPointAssociatedEntry(int epid) : ControlPointAssociation() {
          EntryID.insert(epid);
@@ -91,20 +98,41 @@ print OUT_H "}\n";
 
 print OUT_H "} //namespace ControlPoint \n";
 
-
 print OUT_CPP <<EOF;
 #include "cp_effects.h"
+
 using namespace ControlPoint;
-int main(){
+using namespace std;
+
+enum EFFECT {EFF_DEC, EFF_INC};
+
+EOF
+
+print OUT_CPP <<EOF;
+typedef map<std::string, map<std::string, vector<pair<int, ControlPoint::ControlPointAssociation> > > > cp_effect_map;
+typedef map<std::string, vector<pair<int, ControlPoint::ControlPointAssociation> > > cp_name_map;
+
+CkpvDeclare(cp_effect_map, cp_effects);
+CkpvDeclare(cp_name_map, cp_names);
+
+void initControlPointEffects() {
+\tCkpvInitialize(cp_effect_map, cp_effects);
+\tCkpvInitialize(cp_name_map, cp_names);
+}
+
+void testControlPointEffects() {
 
 EOF
 
 print OUT_CPP "$funccalls";
 
 print OUT_CPP <<EOF;
-  return 0;
 }
 
+void insert(const std::string control_type, const std::string name, const ControlPoint::ControlPointAssociation &a, const int effect) {
+\tCkpvAccess(cp_effects)[control_type][name].push_back(std::make_pair(effect, a));
+\tCkpvAccess(cp_names)[name].push_back(std::make_pair(effect, a));
+}
 EOF
 
 print OUT_CPP "$funcdefs";