Library Reference
Decapodes
Decapodes.compile
— Methodcompile(d::SummationDecapode, inputs::Vector{Symbol}, inplace_dec_ops::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, inplace_dec_ops
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, basic_dec_ops::Vector{Symbol}, contracted_ops::Vector{Symbol}, code_target::AbstractGenerationTarget)
Emit code to define functions given operator Symbols.
Default operations return a tuple of an in-place and an out-of-place function. User-defined operations return an out-of-place function.
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
)
contract
: Enables(true
)/disables(false
) pre-computation of matrix-matrix multiplications for chains of such operators. This feature can interfere with certain auto-differentiation methods, in which case this can be disabled. (Defaults to true
)
multigrid
: Enables multigrid methods during code generation. If true
, then the function produced by gensim
will expect a PrimalGeometricMapSeries
. (Defaults to false
)
[ Info: Page built in 3 seconds.
[ Info: This page was last built at 2024-12-17T20:08:40.125.