00001
00002
00003
00004
00005
00006 #ifndef _AGENT_H
00007 #define _AGENT_H
00008
00009 #include "CentralLB.h"
00010 #include "topology.h"
00011
00012 class Agent {
00013 public:
00014 int npes;
00015
00016 typedef struct _Elem {
00017 int pe;
00018 double Cost;
00019 _Elem(): pe(-1), Cost(-1.0) {}
00020 }Elem;
00021
00022 Elem *preferred_list;
00023
00024
00025 Agent(int p): npes(p) { }
00026 virtual ~Agent() { }
00027
00028 virtual Elem* my_preferred_procs(int *existing_map,int object,int *trialpes,int metric){ return NULL; }
00029 };
00030
00031 class TopologyAgent : public Agent {
00032
00033 public:
00034 CentralLB::LDStats* stats;
00035 LBTopology *topo;
00036
00037 int **commObjs;
00038 int **hopCount;
00039
00040 TopologyAgent(CentralLB::LDStats* lbDB,int p);
00041 ~TopologyAgent() { }
00042 Agent::Elem* my_preferred_procs(int *existing_map,int object,int *trialpes,int metric);
00043 static int compare(const void *p,const void *q);
00044 };
00045
00046 class comlibAgent : public Agent {
00047 protected:
00048 void* comlibstats;
00049 public:
00050 comlibAgent(int p): Agent(p) { }
00051 ~comlibAgent() { }
00052
00053 Agent::Elem* my_preferred_procs(int *existing_map,int object,int *trialpes,int metric);
00054
00055 };
00056
00057 class MulticastAgent : public Agent {
00058 protected:
00059 struct MInfo {
00060 int nbytes;
00061 int messages;
00062 CkVec<int> objs;
00063 MInfo(): nbytes(0), messages(0) {}
00064 MInfo(int b, int n): nbytes(b), messages(n) {}
00065 };
00066 CkVec<MInfo> mcastList;
00067 CkVec<int> *objmap;
00068 int nobj;
00069 public:
00070 MulticastAgent(BaseLB::LDStats* lbDB, int p);
00071 virtual ~MulticastAgent() { delete [] objmap; }
00072
00073 virtual Elem* my_preferred_procs(int *existing_map,int object,int *trialpes,int metric);
00074
00075 };
00076
00077 #endif