00001 #ifndef _GRIDCOMMREFINELB_H_ 00002 #define _GRIDCOMMREFINELB_H_ 00003 00004 #include <limits.h> 00005 #include "CentralLB.h" 00006 00007 #define CK_LDB_GRIDCOMMREFINELB_TOLERANCE 1.10 00008 00009 #ifndef MAXINT 00010 #define MAXINT 2147483647 00011 #endif 00012 00013 void CreateGridCommRefineLB (); 00014 00015 class PE_Data_T 00016 { 00017 public: 00018 bool available; 00019 int cluster; 00020 int num_objs; 00021 int num_lan_objs; 00022 int num_lan_msgs; 00023 int num_wan_objs; 00024 int num_wan_msgs; 00025 double relative_speed; 00026 double scaled_load; 00027 }; 00028 00029 class Object_Data_T 00030 { 00031 public: 00032 bool migratable; 00033 int cluster; 00034 int from_pe; 00035 int to_pe; 00036 int num_lan_msgs; 00037 int num_wan_msgs; 00038 double load; 00039 }; 00040 00041 class GridCommRefineLB : public CBase_GridCommRefineLB 00042 { 00043 public: 00044 GridCommRefineLB (const CkLBOptions &); 00045 GridCommRefineLB (CkMigrateMessage *msg); 00046 00047 bool QueryBalanceNow (int step); 00048 void work (LDStats *stats); 00049 void pup (PUP::er &p) { } 00050 00051 private: 00052 int Get_Cluster (int pe); 00053 void Initialize_PE_Data (CentralLB::LDStats *stats); 00054 int Available_PE_Count (); 00055 int Compute_Number_Of_Clusters (); 00056 void Initialize_Object_Data (CentralLB::LDStats *stats); 00057 void Examine_InterObject_Messages (CentralLB::LDStats *stats); 00058 void Place_Objects_On_PEs (); 00059 void Remap_Objects_To_PEs (int cluster); 00060 int Find_Maximum_WAN_Object (int pe); 00061 int Find_Minimum_WAN_PE (int cluster); 00062 void Remove_Object_From_PE (int target_object, int target_pe); 00063 void Assign_Object_To_PE (int target_object, int target_pe); 00064 00065 int Num_PEs; 00066 int Num_Objects; 00067 int Num_Clusters; 00068 PE_Data_T *PE_Data; 00069 Object_Data_T *Object_Data; 00070 double CK_LDB_GridCommRefineLB_Tolerance; 00071 }; 00072 00073 #endif