Public Documentation
Documentation for ComputableDAGs.jl
's public interface.
See the Internals section of the manual for documentation of everything else.
Contents
Index
ComputableDAGs.ComputableDAGs
ComputableDAGs.@add_call
ComputableDAGs.@add_entry
ComputableDAGs.@assemble_dag
ComputableDAGs.@compute_task
Module
ComputableDAGs.ComputableDAGs
— ModuleComputableDAGs
A module containing tools to represent computations as DAGs.
Macros
ComputableDAGs.@add_call
— Macro@add_call task data varargs
Only valid within a @assemble_dag
block.
Takes an AbstractComputeTask
and arguments in the form of ComputeTaskNode
s, creating a node in the dag currently being assembled (see @assemble_dag
). The resulting node is returned to be used in subsequent @add_call
s.
Arguments
task
: The actual ComputeTask object to use.data
: The data size of the result.varargs...
: Any number of data nodes to use as input. They will be given to the task's function in the same order. Each argument can also be an iterable (vector, tuple, etc.) of nodes, which are automatically unpacked and added individually.
ComputableDAGs.@add_entry
— Macro@add_entry name data
Only valid within a @assemble_dag
block.
Add an entry node to the DAG currently being assembled, with the given name and expected resulting data size. An input_expr
must be defined for the given name.
ComputableDAGs.@assemble_dag
— Macro@assemble_dag begin ... end
Takes a code block within which the @add_call
and @add_entry
macros can be used. It returns the fully assembled DAG.
This macro can not be used recursively.
Example:
dag = @assemble_dag begin
entry_node = @add_entry "input" 64 # name and data size
compute1 = @add_call Compute1() 32 entry_node # task, output data size, and inputs
compute2 = @add_call Compute2() 16 compute1 entry_node # task, output data size, and inputs of the second compute node
# since no more nodes are added, compute2 is automatically the final result of the dag
end
ComputableDAGs.@compute_task
— Macro@compute_task task effort [function]
Defines a compute task to be later added in compute nodes to a DAG, for example using @add_call
. Necessary arguments are the task name and its expected compute effort. Optionally, a function can be provided, making up the task's compute
function. For example, to add a task type that simply adds two child nodes together:
@compute_task Add 1 (+)
In some cases, the function to call might be more complex or need more specific information about the task type, like its type parametrization. For this reason, it is also possible to define the compute function for a compute task manually instead:
@compute_task ComplexTask{T1, T2} 50
ComputableDAGs.compute(::ComplexTask{Int, Float32}, v1, v2) = ...
ComputableDAGs.compute(::ComplexTask{String, Float32}, v1, v2) = ...