00001 #ifndef _TOPOLB_H_
00002 #define _TOPOLB_H_
00003
00004 #include "CentralLB.h"
00005 #include "topology.h"
00006
00007 #ifndef INFTY
00008 #define INFTY 999999999
00009 #endif
00010
00011
00012
00013
00014
00015 extern "C" void METIS_PartGraphRecursive (int*, int*, int*, int*, int*, int*,
00016 int*, int*, int*, int*, int*);
00017
00018 extern "C" void METIS_PartGraphKway (int*, int*, int*, int*, int*, int*,
00019 int*, int*, int*, int*, int*);
00020
00021 extern "C" void METIS_PartGraphVKway (int*, int*, int*, int*, int*, int*,
00022 int*, int*, int*, int*, int*);
00023
00024 extern "C" void METIS_WPartGraphRecursive (int*, int*, int*, int*,
00025 int*, int*, int*, int*,
00026 float*, int*, int*, int*);
00027
00028 extern "C" void METIS_WPartGraphKway (int*, int*, int*, int*,
00029 int*, int*, int*, int*,
00030 float*, int*, int*, int*);
00031
00032 extern "C" void METIS_mCPartGraphRecursive (int*, int*, int*, int*,
00033 int*, int*, int*, int*,
00034 int*, int*, int*, int*);
00035
00036 extern "C" void METIS_mCPartGraphKway (int*, int*, int*, int*, int*,
00037 int*, int*, int*, int*, int*,
00038 int*, int*, int*);
00039
00040
00041
00042
00043
00044
00045 void CreateTopoLB ();
00046
00047 class TopoLB : public CBase_TopoLB
00048 {
00049 public:
00050 TopoLB (const CkLBOptions &opt);
00051 TopoLB (CkMigrateMessage *m) : CBase_TopoLB (m) { };
00052
00053 void work (LDStats *stats);
00054
00055 void pup (PUP::er &p) { }
00056
00057 LBTopology *topo;
00058
00059 protected:
00060
00061 double **dist;
00062 double **comm;
00063 double *commUA;
00064 double **hopBytes;
00065 bool *pfree;
00066 bool *cfree;
00067 int *assign;
00068 double total_comm;
00069
00070 virtual void computePartitions(CentralLB::LDStats *stats,int count,int *newmap);
00071 virtual void allocateDataStructures(int num_procs);
00072 virtual void freeDataStructures(int num_procs);
00073 virtual void initDataStructures(CentralLB::LDStats *stats,int count,int *newmap);
00074 virtual void printDataStructures(int num_procs, int num_objs, int *newmap);
00075 virtual double getHopBytes(CentralLB::LDStats *stats,int count,CkVec<int>obj_to_proc);
00076 virtual double getHopBytesNew(int *assign_map, int count);
00077 void performMapping(int *newmap, int count);
00078
00079 bool QueryBalanceNow (int step);
00080 };
00081
00082
00083 #endif