
00001 #ifndef _GRIDCOMMLB_H_ 00002 #define _GRIDCOMMLB_H_ 00003 00004 #include <limits.h> 00005 #include <math.h> 00006 #include "CentralLB.h" 00007 00008 #define CK_LDB_GRIDCOMMLB_MODE 0 00009 #define CK_LDB_GRIDCOMMLB_BACKGROUND_LOAD 1 00010 #define CK_LDB_GRIDCOMMLB_LOAD_TOLERANCE 0.10 00011 00012 #ifndef MAXINT 00013 #define MAXINT 2147483647 00014 #endif 00015 00016 #ifndef MAXDOUBLE 00017 #define MAXDOUBLE 1e10 00018 #endif 00019 00020 #if CONVERSE_VERSION_VMI 00021 extern "C" int CmiGetCluster (int process); 00022 #endif 00023 00024 void CreateGridCommLB (); 00025 00026 class PE_Data_T 00027 { 00028 public: 00029 CmiBool available; 00030 int cluster; 00031 int num_objs; 00032 int num_lan_objs; 00033 int num_lan_msgs; 00034 int num_wan_objs; 00035 int num_wan_msgs; 00036 double relative_speed; 00037 double scaled_load; 00038 }; 00039 00040 class Object_Data_T 00041 { 00042 public: 00043 CmiBool migratable; 00044 int cluster; 00045 int from_pe; 00046 int to_pe; 00047 int num_lan_msgs; 00048 int num_wan_msgs; 00049 double load; 00050 }; 00051 00052 class GridCommLB : public CentralLB 00053 { 00054 public: 00055 GridCommLB (const CkLBOptions &); 00056 GridCommLB (CkMigrateMessage *msg); 00057 00058 CmiBool QueryBalanceNow (int step); 00059 void work (LDStats *stats); 00060 void pup (PUP::er &p) { CentralLB::pup (p); } 00061 00062 private: 00063 int Get_Cluster (int pe); 00064 void Initialize_PE_Data (CentralLB::LDStats *stats); 00065 int Available_PE_Count (); 00066 int Compute_Number_Of_Clusters (); 00067 void Initialize_Object_Data (CentralLB::LDStats *stats); 00068 void Examine_InterObject_Messages (CentralLB::LDStats *stats); 00069 void Map_NonMigratable_Objects_To_PEs (); 00070 void Map_Migratable_Objects_To_PEs (int cluster); 00071 int Find_Maximum_Object (int cluster); 00072 int Find_Minimum_PE (int cluster); 00073 void Assign_Object_To_PE (int target_object, int target_pe); 00074 00075 int CK_LDB_GridCommLB_Mode; 00076 int CK_LDB_GridCommLB_Background_Load; 00077 double CK_LDB_GridCommLB_Load_Tolerance; 00078 00079 int Num_PEs; 00080 int Num_Objects; 00081 int Num_Clusters; 00082 PE_Data_T *PE_Data; 00083 Object_Data_T *Object_Data; 00084 }; 00085 00086 #endif
1.5.5