Benchmarking right-hand-side evaluations¶
- class myokit.RhsBenchmarker(model, variables=None, exclude_selected=False)¶
Benchmarks a model’s right hand side (rhs).
To enable partial benchmarking the argument
variables
can be used to pass in a list of variables whose combined evaluation time can be obtained by usingbench_part()
. Only non-constant, non-bound variables can be selected.By default, the given list of variables are the only variables included in a partial simulation. This behavior can be inverted by setting
exclude_selected=True
. With this setting, all variables except those in the given list will be tested.A valid myokit model should be provided as the
model
argument.- bench_full(log, repeats=40000, fastest=False)¶
Benchmarks the entire RHS for every position found in the given log file.
The argument
log
should point to amyokit.DataLog
or similar containing the values of all state variables and any bound variables used in the model.The benchmark can be performed in two ways:
fastest=False (default)
Each point in the given log is calculated
repeats
number of times. For each point, the average time it took to do a single calculation is returned.fastest=True
Each point in the given log is calculated
repeats
number of times. For each point, the fastest evaluation time is returned.
- bench_part(log, repeats=40000, fastest=False)¶
This method benchmarks the combined evaluation time of the RHS for all variables passed in when this RhsBenchmarker was created. The combined RHS is benchmarked
repeats
number of times for every point in the given log.The argument
log
should point to amyokit.DataLog
or similar containing the values of all state variables and any bound variables used in the model.Only the selected variables RHS will be evaluated, not their dependencies or nested children variables. Bound and constant variables cannot be selected. If state variables are chosen, their derivative is evaluated.
The benchmark can be performed in two ways:
fastest=False (default)
Each point in the given log is calculated
repeats
number of times. For each point, the average time it took to do a single calculation is returned.fastest=True
Each point in the given log is calculated
repeats
number of times. For each point, the fastest evaluation time is returned.
- mean(times)¶
Like meth:mean_std() but returns only the final mean.
- mean_std(times)¶
Removes outliers and then calculates the mean and standard deviation of the given benchmarked times.