Added GreedyRefineLB
[charm.git] / src / ck-ldb / Makefile_lb.sh
blobba4e4cce243ca1f96659a02dff477cbe75e3b79f
1 #!/bin/sh
3 #Typical load balancers
4 COMMON_LDBS="DummyLB GreedyLB GreedyRefineLB CommLB RandCentLB RefineLB RefineCommLB RotateLB DistributedLB HybridLB ComboCentLB RefineSwapLB NeighborLB OrbLB BlockLB GreedyCommLB NodeLevelLB"
5 #Load balancers for more specialized circumstances
6 SPECIALIZED_LDBS="GraphPartLB GraphBFTLB GridCommLB GridCommRefineLB HbmLB RefineKLB TempAwareCommLB TreeMatchLB GreedyAgentLB NeighborCommLB PhasebyArrayLB RecBipartLB CommAwareRefineLB AdaptiveLB"
7 #Load balanders which have an external dependency, or require some other kind of intervention
8 UNCOMMON_LDBS="MetisLB ScotchLB TeamLB WSLB GridMetisLB TempAwareGreedyLB GridHybridSeedLB TopoCentLB GridHybridLB TopoLB RefineTopoLB TempAwareRefineLB"
10 ALL_LDBS="$COMMON_LDBS $SPECIALIZED_LDBS"
12 out="Make.lb"
14 echo "# Automatically generated by script Makefile_lb.sh" > $out
15 echo "COMMON_LDBS=\\" >> $out
16 for bal in $COMMON_LDBS
17 do
18 echo " \$(L)/libmodule$bal.a \\" >> $out
19 done
20 echo " manager.o" >> $out
21 echo >> $out
23 echo "ALL_LDBS=\\" >> $out
24 for bal in $ALL_LDBS
25 do
26 echo " \$(L)/libmodule$bal.a \\" >> $out
27 done
28 echo " manager.o" >> $out
29 echo >> $out
31 for bal in $ALL_LDBS $UNCOMMON_LDBS
32 do
33 dep=""
34 [ -r libmodule$bal.dep ] && dep="cp -f libmodule$bal.dep "'$'"(L)/"
35 manager=""
36 [ $bal = 'GreedyCommLB' ] && manager="manager.o"
37 [ $bal = 'GridCommLB' ] && manager="manager.o"
38 [ $bal = 'GridCommRefineLB' ] && manager="manager.o"
39 [ $bal = 'GridHybridLB' ] && manager="manager.o"
40 [ $bal = 'GridHybridSeedLB' ] && manager="manager.o"
41 [ $bal = 'TreeMatchLB' ] && manager="tm_tree.o tm_bucket.o tm_timings.o tm_mapping.o"
43 #implicit make rules exist for xxxxLB, we override them so users can choose
44 #make xxxxLB if they only want to build one without the kitchen sink of EveryLB
46 cat >> $out << EOB
47 $bal: $bal.o $manager
48 \$(CHARMC) -o \$(L)/libmodule$bal.a $bal.o $manager
50 \$(L)/libmodule$bal.a: $bal.o $manager
51 \$(CHARMC) -o \$(L)/libmodule$bal.a $bal.o $manager
52 $dep
53 LBHEADERS += $bal.h $bal.decl.h
55 EOB
56 done
58 echo "// AUTOMATICALLY GENERATED FILE" > EveryLB.ci
59 echo "" >> EveryLB.ci
60 echo "module EveryLB {" >> EveryLB.ci
61 for bal in $ALL_LDBS
63 echo " extern module $bal;" >> EveryLB.ci
64 done
65 echo "" >> EveryLB.ci
66 echo " initnode void initEveryLB(void);" >> EveryLB.ci
67 echo "};" >> EveryLB.ci
69 echo "// AUTOMATICALLY GENERATED FILE" > CommonLBs.ci
70 echo "" >> CommonLBs.ci
71 echo "module CommonLBs {" >> CommonLBs.ci
72 for bal in $COMMON_LDBS
74 echo " extern module $bal;" >> CommonLBs.ci
75 done
76 echo "" >> CommonLBs.ci
77 echo " initnode void initCommonLBs(void);" >> CommonLBs.ci
78 echo "};" >> CommonLBs.ci
80 echo "# used for make depends" >> $out
81 echo "ALL_LB_OBJS=EveryLB.o \\" >> $out
82 echo " CommonLBs.o \\" >> $out
83 for bal in $ALL_LDBS $UNCOMMON_LDBS
85 echo " $bal.o \\" >> $out
86 done
87 echo " manager.o \\" >> $out
88 echo " tm_tree.o \\" >> $out
89 echo " tm_timings.o \\" >> $out
90 echo " tm_bucket.o \\" >> $out
91 echo " tm_mapping.o" >> $out
93 echo "# EveryLB dependecies" >> $out
94 echo "EVERYLB_DEPS=EveryLB.o \\" >> $out
95 for bal in $ALL_LDBS
97 echo " $bal.o \\" >> $out
98 done
99 echo " manager.o \\" >> $out
100 echo " tm_tree.o \\" >> $out
101 echo " tm_timings.o \\" >> $out
102 echo " tm_bucket.o \\" >> $out
103 echo " tm_mapping.o" >> $out
105 echo "# CommonLBs dependencies" >> $out
106 echo "COMMONLBS_DEPS=CommonLBs.o \\" >> $out
107 for bal in $COMMON_LDBS
109 echo " $bal.o \\" >> $out
110 done
111 echo " manager.o" \\>> $out
113 # The badly formed implicit make rules for EveryLB and CommonLB are
114 # explicitly redefined so that they do right thing (make a proper
115 # libmodule). This also allows us to use them in the primary Makefile
116 # in an intuitive manner.
118 cat >> $out <<EOB
120 EveryLB: \$(EVERYLB_DEPS)
121 \$(CHARMC) -o \$(L)/libmoduleEveryLB.a \$(EVERYLB_DEPS)
123 \$(L)/libmoduleEveryLB.a: \$(EVERYLB_DEPS)
124 \$(CHARMC) -o \$(L)/libmoduleEveryLB.a \$(EVERYLB_DEPS)
126 CommonLB: \$(COMMONLBS_DEPS)
127 \$(CHARMC) -o \$(L)/libmoduleCommonLBs.a \$(COMMONLBS_DEPS)
129 \$(L)/libmoduleCommonLBs.a: \$(COMMONLBS_DEPS)
130 \$(CHARMC) -o \$(L)/libmoduleCommonLBs.a \$(COMMONLBS_DEPS)