@@ -152,19 +152,27 @@ def do_tests(): |
152 | 152 | saveto='') |
153 | 153 | return numpy.asarray(l) |
154 | 154 |
|
| 155 | + # Initialize test count and results dictionnary |
| 156 | + test_total = 0 |
| 157 | + times_dic = {} |
| 158 | + |
155 | 159 | #test in float64 in FAST_RUN mode on the cpu |
156 | 160 | import theano |
157 | 161 | if do_float64: |
158 | 162 | theano.config.floatX = 'float64' |
159 | 163 | theano.config.mode = 'FAST_RUN' |
160 | 164 | float64_times = do_tests() |
| 165 | + times_dic['float64'] = float64_times |
| 166 | + test_total += numpy.size(float64_times) |
161 | 167 | print(algo_executed, file=sys.stderr) |
162 | 168 | print('float64 times', float64_times, file=sys.stderr) |
163 | 169 |
|
164 | 170 | #test in float32 in FAST_RUN mode on the cpu |
165 | 171 | theano.config.floatX = 'float32' |
166 | 172 | if do_float32: |
167 | 173 | float32_times = do_tests() |
| 174 | + times_dic['float32'] = float32_times |
| 175 | + test_total += numpy.size(float32_times) |
168 | 176 | print(algo_executed, file=sys.stderr) |
169 | 177 | print('float32 times', float32_times, file=sys.stderr) |
170 | 178 |
|
@@ -186,6 +194,8 @@ def do_tests(): |
186 | 194 | if do_gpu: |
187 | 195 | theano.sandbox.cuda.use('gpu') |
188 | 196 | gpu_times = do_tests() |
| 197 | + times_dic['gpu'] = gpu_times |
| 198 | + test_total += numpy.size(gpu_times) |
189 | 199 | print(algo_executed, file=sys.stderr) |
190 | 200 | print('gpu times', gpu_times, file=sys.stderr) |
191 | 201 |
|
@@ -213,30 +223,18 @@ def do_tests(): |
213 | 223 | if do_float32 and do_gpu: |
214 | 224 | print('float32/gpu', float32_times / gpu_times, file=sys.stderr) |
215 | 225 |
|
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: |
| 226 | + # Generate JUnit performance report |
| 227 | + # Define speedtest file write method |
| 228 | + def write_junit(f, algos, times, label): |
| 229 | + for algo, time in zip(algos, times): |
| 230 | + f.write(' <testcase classname="{label}" name="{algo}" time="{time}">' |
| 231 | + .format(label=label, algo=algo, time=time)) |
| 232 | + f.write(' </testcase>\n') |
| 233 | + |
| 234 | + with open('speedtests_time.xml', 'w') as f: |
233 | 235 | 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: |
| 236 | + f.write('<testsuite name="dlt_speedtests" tests="{ntests}">\n' |
| 237 | + .format(ntests=test_total)) |
| 238 | + for label, times in times_dic.items(): |
| 239 | + write_junit(f, algo_executed, times, label) |
242 | 240 | f.write('</testsuite>\n') |