@@ -28,7 +28,7 @@ function ode_shootout(args...;kwargs...)
28
28
ShootOut (args... ;kwargs... )
29
29
end
30
30
31
- benchtime (bench) = BenchmarkTools. time (mean (bench))/ 1e9
31
+ benchtime (bench) = BenchmarkTools. time (minimum (bench))/ 1e9
32
32
33
33
function Shootout (prob,setups;appxsol= nothing ,names= nothing ,error_estimate= :final ,numruns= 20 ,seconds= 2 ,kwargs... )
34
34
N = length (setups)
299
299
end
300
300
301
301
function WorkPrecisionSet (prob:: AbstractRODEProblem ,abstols,reltols,setups,test_dt= nothing ;
302
- numruns_error = 20 ,
302
+ numruns = 20 , numruns_error = 20 ,
303
303
print_names= false ,names= nothing ,appxsol_setup= nothing ,
304
- error_estimate= :final ,parallel_type = :none ,numruns = 20 ,seconds = Inf , kwargs... )
304
+ error_estimate= :final ,parallel_type = :none ,kwargs... )
305
305
306
306
timeseries_errors = DiffEqBase. has_analytic (prob. f) && error_estimate ∈ TIMESERIES_ERRORS
307
307
weak_timeseries_errors = error_estimate ∈ WEAK_TIMESERIES_ERRORS
@@ -313,6 +313,7 @@ function WorkPrecisionSet(prob::AbstractRODEProblem,abstols,reltols,setups,test_
313
313
if names == nothing
314
314
names = [string (parameterless_type (setups[i][:alg ])) for i= 1 : length (setups)]
315
315
end
316
+ time_tmp = Vector {Float64} (undef,numruns)
316
317
317
318
# First calculate all of the errors
318
319
if parallel_type == :threads
@@ -352,37 +353,28 @@ function WorkPrecisionSet(prob::AbstractRODEProblem,abstols,reltols,setups,test_
352
353
dense_errors = dense_errors)
353
354
end
354
355
end
356
+ GC. gc ()
355
357
# Now time it
356
358
for k in 1 : N
357
359
for j in 1 : M
358
- fails = 0
359
- local benchable
360
- @label START
361
- try
362
- benchable = if ! haskey (setups[k],:dts )
363
- @benchmarkable (solve ($ prob,$ (setups[k][:alg ]);
364
- $ kwargs... ,
365
- abstol= $ (abstols[j]),
366
- reltol= $ (reltols[j]),
360
+ for i in 1 : numruns
361
+ time_tmp[i] = @elapsed if ! haskey (setups[k],:dts )
362
+ sol = solve (prob,setups[k][:alg ];
363
+ kwargs... ,
364
+ abstol= abstols[j],
365
+ reltol= reltols[j],
367
366
timeseries_errors= false ,
368
- dense_errors = false ))
367
+ dense_errors = false )
369
368
else
370
- @benchmarkable ( solve ($ prob,$ ( setups[k][:alg ]) ;
371
- $ kwargs... ,abstol= $ ( abstols[j]) ,
372
- reltol= $ ( reltols[j]) ,dt= $ ( setups[k][:dts ][j]) ,
373
- timeseries_errors= false ,
374
- dense_errors = false ) )
369
+ sol = solve (prob,setups[k][:alg ];
370
+ kwargs... ,abstol= abstols[j],
371
+ reltol= reltols[j],dt= setups[k][:dts ][j],
372
+ timeseries_errors= false ,
373
+ dense_errors = false )
375
374
end
376
- catch
377
- # sometimes BenchmarkTools errors with
378
- # `ERROR: syntax: function argument and static parameter names must be distinct`
379
- # so, we are catching that error and try a few times.
380
- fails += 1
381
- fails > 4 && rethrow ()
382
- @goto START
383
375
end
384
- bench = run (benchable, samples = numruns, seconds = seconds )
385
- times[j,k] = benchtime (bench )
376
+ times[j,k] = mean (time_tmp )
377
+ GC . gc ( )
386
378
end
387
379
end
388
380
0 commit comments