Library Reference
Decapodes
Decapodes.compile
— Methodcompile(d::SummationDecapode, inputs::Vector{Symbol}, alloc_vectors::Vector{AllocVecCall}, optimizable_dec_operators::Set{Symbol}, dimension::Int, stateeltype::DataType, code_target::AbstractGenerationTarget, preallocate::Bool)
Function that compiles the computation body. d
is the input Decapode, inputs
is a vector of state variables and literals, alloc_vec
should be empty when passed in, optimizable_dec_operators
is a collection of all DEC operator symbols that can use special in-place methods, dimension
is the dimension of the problem (usually 1 or 2), stateeltype
is the type of the state elements (usually Float32 or Float64), code_target
determines what architecture the code is compiled for (either CPU or CUDA), and preallocate
which is set to true
by default and determines if intermediate results can be preallocated..
Decapodes.compile_env
— Methodcompile_env(d::SummationDecapode, dec_matrices::Vector{Symbol}, con_dec_operators::Set{Symbol}, code_target::AbstractGenerationTarget)
This creates the symbol to function linking for the simulation output. Those run through the default_dec
backend expect both an in-place and an out-of-place variant in that order. User defined operations only support out-of-place.
Decapodes.gensim
— Methodgensim(user_d::SummationDecapode, input_vars::Vector{Symbol}; dimension::Int=2, stateeltype::DataType = Float64, code_target::AbstractGenerationTarget = CPUTarget(), preallocate::Bool = true)
Generates the entire code body for the simulation function. The returned simulation function can then be combined with a mesh, provided by CombinatorialSpaces
, and a function describing symbol to operator mappings to return a simulator that can be used to solve the represented equations given initial conditions.
Arguments:
user_d
: The user passed Decapode for which simulation code will be generated. (This is not modified)
input_vars
is the collection of variables whose values are known at the beginning of the simulation. (Defaults to all state variables and literals in the Decapode)
Keyword arguments:
dimension
: The dimension of the problem. (Defaults to 2
)(Must be 1
or 2
)
stateeltype
: The element type of the state forms. (Defaults to Float64
)(Must be Float32
or Float64
)
code_target
: The intended architecture target for the generated code. (Defaults to CPUTarget()
)(Use CUDATarget()
for NVIDIA CUDA GPUs)
preallocate
: Enables(true
)/disables(false
) pre-allocated caches for intermediate computations. Some functions, such as those that determine Jacobian sparsity patterns, or perform auto-differentiation, may require this to be disabled. (Defaults to true
)
[ Info: Page built in 2 seconds.
[ Info: This page was last built at 2024-08-21T00:17:12.832.