@@ -98,43 +98,7 @@ def speed(): |
98 | 98 | do_gpu = True |
99 | 99 |
|
100 | 100 | algo_executed = [s for idx, s in enumerate(algo) if to_exec[idx]] |
101 | | - #Timming expected are from the buildbot that have an i7-920 @ |
102 | | - # 2.67GHz with hyperthread enabled for the cpu, 12G of ram. An GeForce GTX |
103 | | - # 580 for the GPU. OS=Fedora 14, gcc=4.5.1, python/BLAS from EPD |
104 | | - # 7.1-2 (python 2.7.2, mkl unknow). BLAS with only 1 thread. |
105 | | - |
106 | | - expected_times_64 = numpy.asarray([9.3, 21.0, 76.1, 73.7, 116.4, |
107 | | - 346.9, 355.0, 268.2, 115.8, 16.8, 91.6]) |
108 | | - expected_times_32 = numpy.asarray([6.4, 14.7, 42.5, 63.1, 71, |
109 | | - 191.2, 199.0, 201.9, 107, 12.6, 61.3]) |
110 | | - |
111 | | - # Number with just 1 decimal are new value that are faster with |
112 | | - # the Theano version 0.5rc2 Other number are older. They are not |
113 | | - # updated, as we where faster in the past! |
114 | | - # TODO: find why and fix this! |
115 | | - |
116 | | -# Here is the value for the buildbot on February 3th 2012 with a GTX 285 |
117 | | -# sgd, cg mlp conv da |
118 | | -# sda dbn rbm |
119 | | -# gpu times[3.72957802, 9.94316864, 29.1772666, 9.13857198, 25.91144657, |
120 | | -# 18.30802011, 53.38651466, 285.41386175] |
121 | | -# expected [3.076634879, 7.555234910, 18.99226785, 9.58915591, 24.130070450, |
122 | | -# 24.77524018, 92.66246653, 322.340329170] |
123 | | -# sgd, cg mlp conv da |
124 | | -# sda dbn rbm |
125 | | -#expected/get [0.82492841, 0.75984178, 0.65092691, 1.04930573, 0.93125138 |
126 | | -# 1.35324519 1.7356905 1.12937868] |
127 | | - |
128 | | - expected_times_gpu = numpy.asarray([2.9, 7.55523491, 18.99226785, |
129 | | - 5.8, 19.2, |
130 | | - 11.2, 7.3, 122, 112.5, 31.1, 8.3]) |
131 | | - expected_times_64 = [s for idx, s in enumerate(expected_times_64) |
132 | | - if to_exec[idx]] |
133 | | - expected_times_32 = [s for idx, s in enumerate(expected_times_32) |
134 | | - if to_exec[idx]] |
135 | | - expected_times_gpu = [s for idx, s in enumerate(expected_times_gpu) |
136 | | - if to_exec[idx]] |
137 | | - |
| 101 | + |
138 | 102 | def time_test(m, l, idx, f, **kwargs): |
139 | 103 | if not to_exec[idx]: |
140 | 104 | return |
@@ -196,19 +160,13 @@ def do_tests(): |
196 | 160 | float64_times = do_tests() |
197 | 161 | print(algo_executed, file=sys.stderr) |
198 | 162 | print('float64 times', float64_times, file=sys.stderr) |
199 | | - print('float64 expected', expected_times_64, file=sys.stderr) |
200 | | - print('float64 % expected/get', ( |
201 | | - expected_times_64 / float64_times), file=sys.stderr) |
202 | 163 |
|
203 | 164 | #test in float32 in FAST_RUN mode on the cpu |
204 | 165 | theano.config.floatX = 'float32' |
205 | 166 | if do_float32: |
206 | 167 | float32_times = do_tests() |
207 | 168 | print(algo_executed, file=sys.stderr) |
208 | 169 | print('float32 times', float32_times, file=sys.stderr) |
209 | | - print('float32 expected', expected_times_32, file=sys.stderr) |
210 | | - print('float32 % expected/get', ( |
211 | | - expected_times_32 / float32_times), file=sys.stderr) |
212 | 170 |
|
213 | 171 | if do_float64: |
214 | 172 | print('float64/float32', ( |
@@ -218,18 +176,10 @@ def do_tests(): |
218 | 176 | 'in one place'), file=sys.stderr) |
219 | 177 | print(algo_executed, file=sys.stderr) |
220 | 178 | print('float64 times', float64_times, file=sys.stderr) |
221 | | - print('float64 expected', expected_times_64, file=sys.stderr) |
222 | | - print('float64 % expected/get', ( |
223 | | - expected_times_64 / float64_times), file=sys.stderr) |
224 | 179 | print('float32 times', float32_times, file=sys.stderr) |
225 | | - print('float32 expected', expected_times_32, file=sys.stderr) |
226 | | - print('float32 % expected/get', ( |
227 | | - expected_times_32 / float32_times), file=sys.stderr) |
228 | 180 |
|
229 | 181 | print('float64/float32', ( |
230 | 182 | float64_times / float32_times), file=sys.stderr) |
231 | | - print('expected float64/float32', ( |
232 | | - expected_times_64 / float32_times), file=sys.stderr) |
233 | 183 |
|
234 | 184 | #test in float32 in FAST_RUN mode on the gpu |
235 | 185 | import theano.sandbox.cuda |
@@ -238,9 +188,6 @@ def do_tests(): |
238 | 188 | gpu_times = do_tests() |
239 | 189 | print(algo_executed, file=sys.stderr) |
240 | 190 | print('gpu times', gpu_times, file=sys.stderr) |
241 | | - print('gpu expected', expected_times_gpu, file=sys.stderr) |
242 | | - print('gpu % expected/get', ( |
243 | | - expected_times_gpu / gpu_times), file=sys.stderr) |
244 | 191 |
|
245 | 192 | if do_float64: |
246 | 193 | print('float64/gpu', float64_times / gpu_times, file=sys.stderr) |
@@ -252,50 +199,44 @@ def do_tests(): |
252 | 199 | print(algo_executed, file=sys.stderr) |
253 | 200 | if do_float64: |
254 | 201 | print('float64 times', float64_times, file=sys.stderr) |
255 | | - print('float64 expected', expected_times_64, file=sys.stderr) |
256 | | - print('float64 % expected/get', ( |
257 | | - expected_times_64 / float64_times), file=sys.stderr) |
258 | 202 | if do_float32: |
259 | 203 | print('float32 times', float32_times, file=sys.stderr) |
260 | | - print('float32 expected', expected_times_32, file=sys.stderr) |
261 | | - print('float32 % expected/get', ( |
262 | | - expected_times_32 / float32_times), file=sys.stderr) |
263 | 204 | if do_gpu: |
264 | 205 | print('gpu times', gpu_times, file=sys.stderr) |
265 | | - print('gpu expected', expected_times_gpu, file=sys.stderr) |
266 | | - print('gpu % expected/get', ( |
267 | | - expected_times_gpu / gpu_times), file=sys.stderr) |
268 | 206 |
|
269 | 207 | print() |
270 | 208 | if do_float64 and do_float32: |
271 | 209 | print('float64/float32', ( |
272 | 210 | float64_times / float32_times), file=sys.stderr) |
273 | | - print('expected float64/float32', ( |
274 | | - expected_times_64 / float32_times), file=sys.stderr) |
275 | 211 | if do_float64 and do_gpu: |
276 | 212 | print('float64/gpu', float64_times / gpu_times, file=sys.stderr) |
277 | | - print('expected float64/gpu', ( |
278 | | - expected_times_64 / gpu_times), file=sys.stderr) |
279 | 213 | if do_float32 and do_gpu: |
280 | 214 | print('float32/gpu', float32_times / gpu_times, file=sys.stderr) |
281 | | - print('expected float32/gpu', ( |
282 | | - expected_times_32 / gpu_times), file=sys.stderr) |
283 | | - |
284 | | - def compare(x, y): |
285 | | - ratio = x / y |
286 | | - # If there is more then 5% difference between the expected |
287 | | - # time and the real time, we consider this an error. |
288 | | - return sum((ratio < 0.95) + (ratio > 1.05)) |
289 | | - |
290 | | - print(file=sys.stderr) |
291 | | - if do_float64: |
292 | | - err = compare(expected_times_64, float64_times) |
293 | | - print('speed_failure_float64=' + str(err), file=sys.stderr) |
294 | | - if do_float32: |
295 | | - err = compare(expected_times_32, float32_times) |
296 | | - print('speed_failure_float32=' + str(err), file=sys.stderr) |
297 | | - if do_gpu: |
298 | | - err = compare(expected_times_gpu, gpu_times) |
299 | | - print('speed_failure_gpu=' + str(err), file=sys.stderr) |
300 | | - |
301 | | - assert not numpy.isnan(gpu_times).any() |
| 215 | + |
| 216 | + # Write JUnit xml for speed test performance report |
| 217 | + |
| 218 | + speed_file = 'speedtests_time.xml' |
| 219 | + |
| 220 | + # Define speed test file write method |
| 221 | + def write_junit(filename, algos, times, label): |
| 222 | + with open(filename, 'a') as f: |
| 223 | + for algo, time in zip(algos, times): |
| 224 | + f.write(' <testcase classname="{label}" name="{algo}" time="{time}">' |
| 225 | + .format(label=label, algo=algo, time=time)) |
| 226 | + f.write(' </testcase>\n') |
| 227 | + |
| 228 | + test_total = numpy.size(float64_times) \ |
| 229 | + + numpy.size(float32_times) \ |
| 230 | + + numpy.size(gpu_times) |
| 231 | + |
| 232 | + with open(speed_file, 'w') as f: |
| 233 | + f.write('<?xml version="1.0" encoding="UTF-8"?>\n') |
| 234 | + f.write('<testsuite name="theano_speedtests" tests="{ntests}">\n' |
| 235 | + .format(ntests=numpy.size(test_total))) |
| 236 | + |
| 237 | + write_junit(speed_file, algo_executed, float64_times, label='float64') |
| 238 | + write_junit(speed_file, algo_executed, float32_times, label='float32') |
| 239 | + write_junit(speed_file, algo_executed, gpu_times, label='gpu') |
| 240 | + |
| 241 | + with open(speed_file, 'a') as f: |
| 242 | + f.write('</testsuite>\n') |