compile {TMB} | R Documentation |
Compile a C++ template into a shared object file. OpenMP flag is set if the template is detected to be parallel.
compile(file, flags = "", safebounds = TRUE, safeunload = TRUE, openmp = isParallelTemplate(file[1]), libtmb = TRUE, libinit = TRUE, tracesweep = FALSE, ...)
file |
C++ file. |
flags |
Character with compile flags. |
safebounds |
Turn on preprocessor flag for bound checking? |
safeunload |
Turn on preprocessor flag for safe DLL unloading? |
openmp |
Turn on openmp flag? Auto detected for parallel templates. |
libtmb |
Use precompiled TMB library if available (to speed up compilation)? |
libinit |
Turn on preprocessor flag to register native routines? |
tracesweep |
Turn on preprocessor flag to trace AD sweeps? (Silently disables |
... |
Passed as Makeconf variables. |
TMB relies on R's built in functionality to create shared libraries independent of the platform.
A template is compiled by compile("template.cpp")
, which will call R's makefile with appropriate
preprocessor flags.
Compiler and compiler flags can be stored in a configuration file. In order of precedence either via
the file pointed at by R_MAKEVARS_USER or the file ~/.R/Makevars if it exists.
Additional configuration variables can be set with the flags
and ...
arguments, which will override any
previous selections.