00001 #include <string>
00002 #include <vector>
00003 #include <set>
00004 #include <map>
00005 #include <utility>
00006 #include <charm++.h>
00007 #include <ck.h>
00008 #include <ckarray.h>
00009
00011
00012
00014
00015
00016 #ifndef __CP_EFFECTS_H__
00017 #define __CP_EFFECTS_H__
00018
00019 #if CMK_WITH_CONTROLPOINT
00020
00021 namespace ControlPoint {
00022
00023 enum DIRECTION {EFF_DEC, EFF_INC};
00024
00025 class ControlPointAssociation {
00026 public:
00027 std::set<int> EntryID;
00028 std::set<int> ArrayGroupIdx;
00029 ControlPointAssociation() {
00030
00031 }
00032 };
00033
00034 class ControlPointAssociatedEntry : public ControlPointAssociation {
00035 public :
00036 ControlPointAssociatedEntry() : ControlPointAssociation() {}
00037
00038 ControlPointAssociatedEntry(int epid) : ControlPointAssociation() {
00039 EntryID.insert(epid);
00040 }
00041 };
00042
00043 class ControlPointAssociatedArray : public ControlPointAssociation {
00044 public:
00045 ControlPointAssociatedArray() : ControlPointAssociation() {}
00046
00047 ControlPointAssociatedArray(const CProxy_ArrayBase &a) : ControlPointAssociation() {
00048 CkGroupID aid = a.ckGetArrayID();
00049 int groupIdx = aid.idx;
00050 ArrayGroupIdx.insert(groupIdx);
00051 }
00052 };
00053
00054 class NoControlPointAssociation : public ControlPointAssociation { };
00055
00056
00057 void initControlPointEffects();
00058 ControlPointAssociatedEntry assocWithEntry(const int entry);
00059 ControlPointAssociatedArray assocWithArray(const CProxy_ArrayBase &array);
00060
00061
00062 typedef std::map<std::string,std::map<std::string, std::pair<int, std::vector<ControlPoint::ControlPointAssociation> > > > cp_effect_map;
00063
00064
00065
00066
00067
00068 namespace EffectIncrease {
00069 void Priority(std::string name, const ControlPoint::ControlPointAssociation &a);
00070 void Priority(std::string name);
00071 void MemoryConsumption(std::string name, const ControlPoint::ControlPointAssociation &a);
00072 void MemoryConsumption(std::string name);
00073 void GrainSize(std::string name, const ControlPoint::ControlPointAssociation &a);
00074 void GrainSize(std::string name);
00075 void ComputeDurations(std::string name, const ControlPoint::ControlPointAssociation &a);
00076 void ComputeDurations(std::string name);
00077 void FlopRate(std::string name, const ControlPoint::ControlPointAssociation &a);
00078 void FlopRate(std::string name);
00079 void NumComputeObjects(std::string name, const ControlPoint::ControlPointAssociation &a);
00080 void NumComputeObjects(std::string name);
00081 void NumMessages(std::string name, const ControlPoint::ControlPointAssociation &a);
00082 void NumMessages(std::string name);
00083 void MessageSizes(std::string name, const ControlPoint::ControlPointAssociation &a);
00084 void MessageSizes(std::string name);
00085 void MessageOverhead(std::string name, const ControlPoint::ControlPointAssociation &a);
00086 void MessageOverhead(std::string name);
00087 void UnnecessarySyncronization(std::string name, const ControlPoint::ControlPointAssociation &a);
00088 void UnnecessarySyncronization(std::string name);
00089 void Concurrency(std::string name, const ControlPoint::ControlPointAssociation &a);
00090 void Concurrency(std::string name);
00091 void PotentialOverlap(std::string name, const ControlPoint::ControlPointAssociation &a);
00092 void PotentialOverlap(std::string name);
00093 void LoadBalancingPeriod(std::string name, const ControlPoint::ControlPointAssociation &a);
00094 void LoadBalancingPeriod(std::string name);
00095 void GPUOffloadedWork(std::string name, const ControlPoint::ControlPointAssociation &a);
00096 void GPUOffloadedWork(std::string name);
00097
00098 }
00099
00100 namespace EffectDecrease {
00101 void Priority(std::string name, const ControlPoint::ControlPointAssociation &a);
00102 void Priority(std::string name);
00103 void MemoryConsumption(std::string name, const ControlPoint::ControlPointAssociation &a);
00104 void MemoryConsumption(std::string name);
00105 void GrainSize(std::string name, const ControlPoint::ControlPointAssociation &a);
00106 void GrainSize(std::string name);
00107 void ComputeDurations(std::string name, const ControlPoint::ControlPointAssociation &a);
00108 void ComputeDurations(std::string name);
00109 void FlopRate(std::string name, const ControlPoint::ControlPointAssociation &a);
00110 void FlopRate(std::string name);
00111 void NumComputeObjects(std::string name, const ControlPoint::ControlPointAssociation &a);
00112 void NumComputeObjects(std::string name);
00113 void NumMessages(std::string name, const ControlPoint::ControlPointAssociation &a);
00114 void NumMessages(std::string name);
00115 void MessageSizes(std::string name, const ControlPoint::ControlPointAssociation &a);
00116 void MessageSizes(std::string name);
00117 void MessageOverhead(std::string name, const ControlPoint::ControlPointAssociation &a);
00118 void MessageOverhead(std::string name);
00119 void UnnecessarySyncronization(std::string name, const ControlPoint::ControlPointAssociation &a);
00120 void UnnecessarySyncronization(std::string name);
00121 void Concurrency(std::string name, const ControlPoint::ControlPointAssociation &a);
00122 void Concurrency(std::string name);
00123 void PotentialOverlap(std::string name, const ControlPoint::ControlPointAssociation &a);
00124 void PotentialOverlap(std::string name);
00125 void LoadBalancingPeriod(std::string name, const ControlPoint::ControlPointAssociation &a);
00126 void LoadBalancingPeriod(std::string name);
00127 void GPUOffloadedWork(std::string name, const ControlPoint::ControlPointAssociation &a);
00128 void GPUOffloadedWork(std::string name);
00129
00130 }
00131
00132
00133 }
00134
00135 CkpvExtern(ControlPoint::cp_effect_map, cp_effects);
00136
00137
00138 #endif
00139 #endif