Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

benchmark

Benchmark parallel templates


Description

Benchmark parallel templates

Plot result of parallel benchmark

Usage

benchmark(obj, n = 10, expr = NULL, cores = NULL)

## S3 method for class 'parallelBenchmark'
plot(x, type = "b", ..., show = c("speedup",
  "time"), legendpos = "topleft")

Arguments

obj

Object from MakeADFun

n

Number of replicates to obtain reliable results.

expr

Optional expression to benchmark instead of default.

cores

Optional vector of cores.

x

Object to plot

type

Plot type

...

Further plot arguments

show

Plot relative speedup or relative time?

legendpos

Position of legend

Details

By default this function will perform timings of the most critical parts of an AD model, specifically

  1. Objective function of evaluated template.

  2. Gradient of evaluated template.

  3. Sparse hessian of evaluated template.

  4. Cholesky factorization of sparse hessian.

(for pure fixed effect models only the first two). Expressions to time can be overwritten by the user (expr). A plot method is available for Parallel benchmarks.

Examples

## Not run: 
runExample("linreg_parallel",thisR=TRUE)  ## Create obj
ben <- benchmark(obj,n=100,cores=1:4)
plot(ben)
ben <- benchmark(obj,n=10,cores=1:4,expr=expression(do.call("optim",obj)))
plot(ben)

## End(Not run)

TMB

Template Model Builder: A General Random Effect Tool Inspired by 'ADMB'

v1.7.20
GPL-2
Authors
Kasper Kristensen [aut, cre, cph], Brad Bell [cph], Hans Skaug [ctb], Arni Magnusson [ctb], Casper Berg [ctb], Anders Nielsen [ctb], Martin Maechler [ctb], Theo Michelot [ctb], Mollie Brooks [ctb], Alex Forrence [ctb], Christoffer Moesgaard Albertsen [ctb], Cole Monnahan [ctb]
Initial release
2021-04-08

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.