Title: | Compile Odin to Dust |
---|---|
Description: | Less painful than it sounds, this package compiles an odin model to use dust, our new stochastic model system. Supports only a subset of odin models (discrete time stochastic models with no interpolation and no delays). |
Authors: | Rich FitzJohn [aut, cre], Alex Hill [aut], John Lees [aut], Imperial College of Science, Technology and Medicine [cph] |
Maintainer: | Rich FitzJohn <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.3.13 |
Built: | 2024-11-01 05:56:49 UTC |
Source: | https://github.com/mrc-ide/odin.dust |
Compile an odin model to work with dust.
odin_dust(x, ..., options = NULL) odin_dust_(x, ..., options = NULL)
odin_dust(x, ..., options = NULL) odin_dust_(x, ..., options = NULL)
x |
Either the name of a file to read, a text string (if length is greater than 1 elements will be joined with newlines) or an expression. |
... |
Arguments passed to odin_dust_options,
including |
options |
An odin::odin_options or odin_dust_options
object. If given it overrides arguments; if it is already a
|
Note that this does not (yet) support the full odin output object, instead creating the more limited dust interface. However, for many uses this should be considerably faster than the interface that odin normally uses (built on dde).
When including custom C++ code you may want to set additional options in order to enable compilation. You can do this by including pseudo-attributes
// [[odin.dust::cpp_std(C++17)]]
- use this to change the C++
standard used in compilation; this is passed to dust::dust()
as the cpp_std
option. It is only necessary to pass in values
greater than C++11 at present as that is dust's default.
// [[odin.dust::linking_to(pkg)]]
- use this to make include
files present in an R package (e.g., BH) available. You can use
as many of these attributes as you need.
Options for controlling odin_dust; this is a superset of odin::odin_options
odin_dust_options( ..., real_type = NULL, rng_state_type = NULL, gpu = NULL, gpu_generate = NULL, compiler_options = NULL, optimisation_level = NULL, options = NULL )
odin_dust_options( ..., real_type = NULL, rng_state_type = NULL, gpu = NULL, gpu_generate = NULL, compiler_options = NULL, optimisation_level = NULL, options = NULL )
... |
Arguments passed to odin::odin_options, including
|
real_type |
C++ type to use for real (floating point)
numbers. Defaults to |
rng_state_type |
C++ type to use for the random number
generator. Defaults to |
gpu |
Experimental! Generate support for running models
on a GPU. This implies |
gpu_generate |
Experimental Generate gpu support code. This does not require a gpu or nvcc toolchain, but creates code that could be compiled for a gpu. This is primarily intended for testing and development as the generated code will be slower than the normal cpu version, and the compilation time will be considerably slower. Currently not supported within package code. |
compiler_options |
Additional options for the C++ compiler, passed to dust::dust |
optimisation_level |
Shorthand control over optimisation
level, passed to dust::dust. If provided should be one of
|
options |
An odin::odin_options or odin_dust_options
object. If given it overrides arguments; if it is already a
|
A list of options (class odin_options
) to
pass to odin.dust::odin_dust
odin.dust::odin_dust_options()
odin.dust::odin_dust_options()
Update generated code in a package that uses odin and dust to
provide a model. This will generate new dust code in inst/dust
and from that generate a full model in src
, and an R interface
in R/dust.R
, along with the cpp11 attributes that are needed to
use the model.
odin_dust_package(path, options = NULL)
odin_dust_package(path, options = NULL)
path |
Path to the package root (the directory that
contains |
options |
An odin::odin_options or odin_dust_options
object. If given it overrides arguments; if it is already a
|
The path to the package