-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
237 lines (204 loc) · 9.07 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="build" name="peersim-push-sum">
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.6"/>
<property name="source" value="1.6"/>
<path id="classpath">
<pathelement location="bin"/>
<pathelement location="lib/commons-io-2.4/commons-io-2.4.jar"/>
<pathelement location="lib/commons-math3-3.2/commons-math3-3.2.jar"/>
<pathelement location="lib/peersim-1.0.5/peersim-1.0.5.jar"/>
<pathelement location="lib/peersim-1.0.5/djep-1.0.0.jar"/>
<pathelement location="lib/peersim-1.0.5/jep-2.3.0.jar"/>
</path>
<!-- === clean targets === -->
<target name="clean" description="Delete build artifacts and documentation.">
<delete dir="bin"/>
<delete dir="doc"/>
</target>
<target name="clean-plot" description="Delete plot data and images.">
<delete dir="plot"/>
</target>
<target name="clean-all" depends="clean,clean-plot" description="Delete build artifacts, documentation and plots."/>
<!-- === build targets === -->
<target name="build" description="Compile the Java classes.">
<mkdir dir="bin"/>
<javac classpathref="classpath" debug="true" debuglevel="${debuglevel}" srcdir="src" destdir="bin" includeantruntime="false" source="${source}" target="${target}"/>
</target>
<target name="docs" depends="build" description="Create the Javadoc.">
<javadoc classpathref="classpath" packagenames="*" sourcepath="src" destdir="doc" additionalparam="-notimestamp">
<link href="http://docs.oracle.com/javase/6/docs/api/"/>
<link href="http://commons.apache.org/proper/commons-io/javadocs/api-2.4/"/>
<link href="http://commons.apache.org/proper/commons-math/javadocs/api-3.2/"/>
<link href="http://peersim.sourceforge.net/doc/"/>
</javadoc>
</target>
<!-- === example run targets === -->
<target name="run-pp-cd" depends="build" description="Run a simulation of the cycle-driven Push-Pull protocol.">
<java classname="peersim.Simulator" classpathref="classpath" failonerror="true" fork="yes">
<arg value="config/pp-cd.config"/>
</java>
</target>
<target name="run-pp-ed" depends="build" description="Run a simulation of the event-driven Push-Pull protocol.">
<java classname="peersim.Simulator" classpathref="classpath" failonerror="true" fork="yes">
<arg value="config/pp-ed.config"/>
</java>
</target>
<target name="run-ps-cd" depends="build" description="Run a simulation of the cycle-driven Push-Sum protocol.">
<java classname="peersim.Simulator" classpathref="classpath" failonerror="true" fork="yes">
<arg value="config/ps-cd.config"/>
</java>
</target>
<target name="run-ps-ed" depends="build" description="Run a simulation of the event-driven Push-Sum protocol.">
<java classname="peersim.Simulator" classpathref="classpath" failonerror="true" fork="yes">
<arg value="config/ps-ed.config"/>
</java>
</target>
<!-- === plot targets === -->
<property name="ext" value="png" description="Plot image type: png or svg."/>
<condition property="gnuplot_bin" value="gnuplot.exe" else="gnuplot">
<os family="windows"/>
</condition>
<target name="-sim" depends="build">
<java classname="peersim.rangesim.RangeSimulator" classpathref="classpath" failonerror="true" fork="yes">
<arg value="config/${type}.config"/>
<arg value="range.N N;${noderange}"/>
<arg value="range.CLUSTERS CLUSTERS;${clusterrange}"/>
<!--<arg value="random.seed ${randomSeed}"/>-->
<arg value="include.init ${wire} ${dist} ${init}"/>
<arg value="control.obs.plotfile ${prefix}-${type}.data"/>
</java>
</target>
<target name="-plot">
<antcall target="-sim">
<param name="type" value="pp-cd"/>
<param name="init" value=""/>
</antcall>
<antcall target="-sim">
<param name="type" value="ps-cd"/>
<param name="init" value="weights"/>
</antcall>
<antcall target="-sim">
<param name="type" value="pp-ed"/>
<param name="init" value="timer"/>
</antcall>
<antcall target="-sim">
<param name="type" value="ps-ed"/>
<param name="init" value="weights timer"/>
</antcall>
<exec executable="${gnuplot_bin}">
<arg line="-e "IMG='${img}';TERM='${ext}';DATA_PP_CD='${prefix}-pp-cd.data';DATA_PS_CD='${prefix}-ps-cd.data';DATA_PP_ED='${prefix}-pp-ed.data';DATA_PS_ED='${prefix}-ps-ed.data';TITLE='${title}';XLABEL='${xlabel}';XCOL=${xcolumn};STEPSIZE=1000" plot.p"/>
</exec>
</target>
<target name="plot-fc" description="Simulate and plot: Fully connected.">
<antcall target="-plot">
<param name="prefix" value="plot/sim-fc"/>
<param name="img" value="plot/sim-fc.${ext}"/>
<param name="title" value="Fully Connected"/>
<param name="xlabel" value="nodes"/>
<param name="xcolumn" value="2"/>
<param name="noderange" value="8:128|*2" />
<param name="clusterrange" value="1" />
<param name="wire" value="wire_fc"/>
<param name="dist" value="dist_lin"/>
<!--<param name="randomSeed" value="123" />-->
</antcall>
</target>
<target name="plot-kout" description="Simulate and plot: k-Out.">
<antcall target="-plot">
<param name="prefix" value="plot/sim-kout"/>
<param name="img" value="plot/sim-kout.${ext}"/>
<param name="title" value="k-Out"/>
<param name="xlabel" value="nodes"/>
<param name="xcolumn" value="2"/>
<param name="noderange" value="8:128|*2" />
<param name="clusterrange" value="1" />
<param name="wire" value="wire_kout"/>
<param name="dist" value="dist_lin"/>
<!--<param name="randomSeed" value="123" />-->
</antcall>
</target>
<target name="plot-cl-n" description="Simulate and plot: Clusters (over node range).">
<antcall target="-plot">
<param name="prefix" value="plot/sim-cl-n"/>
<param name="img" value="plot/sim-cl-n.${ext}"/>
<param name="title" value="4 Clusters; x Nodes"/>
<param name="xlabel" value="nodes"/>
<param name="xcolumn" value="2"/>
<param name="noderange" value="8:128|*2" />
<param name="clusterrange" value="4" />
<param name="wire" value="wire_cl"/>
<param name="dist" value="dist_lin"/>
<!--<param name="randomSeed" value="123" />-->
</antcall>
</target>
<target name="plot-cl-c" description="Simulate and plot: Clusters (over cluster range).">
<antcall target="-plot">
<param name="prefix" value="plot/sim-cl-c"/>
<param name="img" value="plot/sim-cl-c.${ext}"/>
<param name="title" value="x Clusters; 64 Nodes"/>
<param name="xlabel" value="clusters"/>
<param name="xcolumn" value="15"/>
<param name="noderange" value="64" />
<param name="clusterrange" value="2,4,8,16" />
<param name="wire" value="wire_cl"/>
<param name="dist" value="dist_lin"/>
<!--<param name="randomSeed" value="123" />-->
</antcall>
</target>
<target name="all-plots" depends="clean-plot,plot-fc,plot-kout,plot-cl-n,plot-cl-c" description="Simulate and plot all parameter sets."/>
<!-- === graphviz targets === -->
<condition property="graphviz_bin" value="dot.exe" else="dot">
<os family="windows"/>
</condition>
<target name="-sim-graph" depends="build">
<mkdir dir="plot"/>
<java classname="peersim.Simulator" classpathref="classpath" failonerror="true" fork="yes">
<arg value="config/graph.config"/>
<arg value="N=${nodes}"/>
<arg value="K=${kout}"/>
<arg value="CLUSTERS=${clusters}"/>
<arg value="include.init ${wire} graph"/>
<arg value="init.graph.filename ${data}"/>
</java>
</target>
<target name="-plot-graph" depends="-sim-graph">
<exec executable="${graphviz_bin}">
<arg value="-Kcirco"/>
<arg value="-T${ext}"/>
<arg value="-o${img}"/>
<arg value="${data}"/>
</exec>
</target>
<target name="graph-fc" description="Generate an image of a fully connected graph.">
<antcall target="-plot-graph">
<param name="img" value="plot/graph-fc.${ext}"/>
<param name="data" value="plot/graph-fc.dot"/>
<param name="wire" value="wire_fc"/>
<param name="nodes" value="8"/>
<param name="kout" value="0"/>
<param name="clusters" value="1"/>
</antcall>
</target>
<target name="graph-kout" description="Generate an image of a k-out graph.">
<antcall target="-plot-graph">
<param name="img" value="plot/graph-kout.${ext}"/>
<param name="data" value="plot/graph-kout.dot"/>
<param name="wire" value="wire_kout"/>
<param name="nodes" value="16"/>
<param name="kout" value="4"/>
<param name="clusters" value="1"/>
</antcall>
</target>
<target name="graph-cl" description="Generate an image of a clusters graph.">
<antcall target="-plot-graph">
<param name="img" value="plot/graph-cl.${ext}"/>
<param name="data" value="plot/graph-cl.dot"/>
<param name="wire" value="wire_cl"/>
<param name="nodes" value="18"/>
<param name="kout" value="0"/>
<param name="clusters" value="3"/>
</antcall>
</target>
<target name="all-graph" depends="graph-fc,graph-kout,graph-cl" description="Generate all graph images."/>
</project>