Node
Type
ComputableDAGs.ComputeTaskNode
— TypeComputeTaskNode <: Node
Any node that computes a result from inputs using an AbstractComputeTask
.
Fields
.task
: The node's compute task type. A concrete subtype of AbstractComputeTask
..parents
: A vector of the node's parents (i.e. nodes that depend on this one)..children
: A vector of tuples with the node's children (i.e. nodes that this one depends on) and their index, used to order the arguments for the AbstractComputeTask
..id
: The node's id. Improves the speed of comparisons and is used as a unique identifier..nodeReduction
: Either this node's NodeReduction
or missing
, if none. There can only be at most one..nodeSplit
: Either this node's NodeSplit
or missing
, if none. There can only be at most one..device
: The Device this node has been scheduled on by a Scheduler
.
ComputableDAGs.DataTaskNode
— TypeDataTaskNode <: Node
Any node that transfers data and does no computation.
Fields
.task
: The node's data task type. Usually DataTask
..parents
: A vector of the node's parents (i.e. nodes that depend on this one)..children
: A vector of tuples of the node's children (i.e. nodes that this one depends on) and their indices, indicating their order in the resulting function call passed to the task..id
: The node's id. Improves the speed of comparisons and is used as a unique identifier..nodeReduction
: Either this node's NodeReduction
or missing
, if none. There can only be at most one..nodeSplit
: Either this node's NodeSplit
or missing
, if none. There can only be at most one..name
: The name of this node for entry nodes into the graph (is_entry_node
) to reliably assign the inputs to the correct nodes when executing.
ComputableDAGs.Edge
— TypeEdge
Type of an edge in the graph. Edges can only exist between a DataTaskNode
and a ComputeTaskNode
or vice versa, not between two of the same type of node.
An edge always points from child to parent: child = e.edge[1]
and parent = e.edge[2]
. Additionally, the Edge
contains the
index` which is used as the child's index in the parent node.
The child is the prerequisite node of the parent.
ComputableDAGs.Node
— TypeCreate
ComputableDAGs.make_edge
— Functionmake_edge(n1::Node, n2::Node, index::Int)
Fallback implementation of make_edge
throwing an error. If you got this error it likely means you tried to construct an edge between two nodes of the same type.
ComputableDAGs.make_edge
— Functionmake_edge(n1::DataTaskNode, n2::ComputeTaskNode)
Construct and return a new Edge
pointing from n1
(child) to n2
(parent).
The index parameter is 0 by default and is passed to the parent node as argument index for its child.
ComputableDAGs.make_edge
— Functionmake_edge(n1::ComputeTaskNode, n2::DataTaskNode, index::Int)
Construct and return a new Edge
pointing from n1
(child) to n2
(parent).
The index parameter is 0 by default and is passed to the parent node as argument index for its child.
ComputableDAGs.make_node
— Functionmake_node(t::AbstractDataTask)
Construct and return a new DataTaskNode
with the given task.
ComputableDAGs.make_node
— Methodmake_node(t::AbstractComputeTask)
Construct and return a new ComputeTaskNode
with the given task.
ComputableDAGs.make_node
— Methodmake_node(t::AbstractTask)
Fallback implementation of make_node
for an AbstractTask
, throwing an error.
Compare
Base.:==
— Method==(e1::Edge, e2::Edge)
Equality comparison between two edges.
Base.:==
— Method==(n1::Node, n2::Node)
Fallback equality comparison between two nodes. For equal node types, the more specific versions of this function will be called.
Base.:==
— Method==(n1::ComputeTaskNode, n2::ComputeTaskNode)
Equality comparison between two ComputeTaskNode
s.
Base.:==
— Method==(n1::DataTaskNode, n2::DataTaskNode)
Equality comparison between two DataTaskNode
s.
Properties
ComputableDAGs.children
— Methodchildren(node::Node)
Return node's children.
A node's children are its prerequisite nodes, nodes that need to execute before the task of this node.
A node's children are the nodes that must run before it.
ComputableDAGs.is_child
— Methodis_child(potential_child::Node, node::Node)
Return whether the potential_child
is a child of node
.
ComputableDAGs.is_entry_node
— Methodis_entry_node(node::Node)
Return whether this node is an entry node in its graph, i.e., it has no children.
ComputableDAGs.is_exit_node
— Methodis_exit_node(node::Node)
Return whether this node is an exit node of its graph, i.e., it has no parents.
ComputableDAGs.is_parent
— Methodis_parent(potential_parent::Node, node::Node)
Return whether the potential_parent
is a parent of node
.
ComputableDAGs.parents
— Methodparents(node::Node)
Return the node's parents.
A node's parents are its subsequent nodes, nodes that need this node to execute.
ComputableDAGs.partners
— Methodpartners(node::Node, set::Set{Node})
Alternative version to partners(node::Node)
, avoiding allocation of a new set. Works on the given set and returns nothing
.
ComputableDAGs.partners
— Methodpartners(node::Node)
Return a vector of all partners of this node.
A node's partners are all parents of any of its children. The result contains no duplicates and includes the node itself.
This is very slow when there are multiple children with many parents. This is less of a problem in siblings(node::Node)
because (depending on the model) there are no nodes with a large number of children, or only a single one.
ComputableDAGs.siblings
— Methodsiblings(node::Node)
Return a vector of all siblings of this node.
A node's siblings are all children of any of its parents. The result contains no duplicates and includes the node itself.
ComputableDAGs.task
— Methodtask(node::Node)
Return the node's task.
Base.show
— Methodshow(io::IO, e::Edge)
Print a short string representation of the edge to io.
Base.show
— Methodshow(io::IO, n::Node)
Print a short string representation of the node to io.
ComputableDAGs.to_var_name
— Methodto_var_name(id::UUID)
Return the uuid as a string usable as a variable name in code generation.
Validate
ComputableDAGs.is_valid
— Methodis_valid(graph::DAG, node::ComputeTaskNode)
Verify that the given compute node is valid in the graph. Call with @assert
or @test
when testing or debugging.
This also calls is_valid_node(graph::DAG, node::Node)
.
ComputableDAGs.is_valid
— Methodis_valid(graph::DAG, node::DataTaskNode)
Verify that the given compute node is valid in the graph. Call with @assert
or @test
when testing or debugging.
This also calls is_valid_node(graph::DAG, node::Node)
.
ComputableDAGs.is_valid_node
— Methodis_valid_node(graph::DAG, node::Node)
Verify that a given node is valid in the graph. Call like @test is_valid_node(g, n)
. Uses @assert
to fail if something is invalid but also provide an error message.
This function is very performance intensive and should only be used when testing or debugging.
See also this function's specific versions for the concrete Node types is_valid(graph::DAG, node::ComputeTaskNode)
and is_valid(graph::DAG, node::DataTaskNode)
.