Graph
Type
ComputableDAGs.DAG
— TypeDAG
The representation of the graph as a set of Node
s.
Operation
s can be applied on it using push_operation!
and reverted using pop_operation!
like a stack. To get the set of possible operations, use get_operations
. The members of the object should not be manually accessed, instead always use the provided interface functions.
ComputableDAGs.DAG
— MethodDAG()
Construct and return an empty DAG
.
ComputableDAGs.PossibleOperations
— TypePossibleOperations
A struct storing all possible operations on a DAG
. To get the PossibleOperations
on a DAG
, use get_operations
.
ComputableDAGs.PossibleOperations
— MethodPossibleOperations()
Construct and return an empty PossibleOperations
object.
Interface
ComputableDAGs.can_pop
— Methodcan_pop(graph::DAG)
Return true
if pop_operation!
is possible, false
otherwise.
ComputableDAGs.pop_operation!
— Methodpop_operation!(graph::DAG)
Revert the latest applied operation on the graph.
See also: DAG
, push_operation!
ComputableDAGs.push_operation!
— Methodpush_operation!(graph::DAG, operation::Operation)
Apply a new operation to the graph.
See also: DAG
, pop_operation!
ComputableDAGs.reset_graph!
— Methodreset_graph!(graph::DAG)
Reset the graph to its initial state with no operations applied.
Compare
Base.in
— Methodin(edge::Edge, graph::DAG)
Check whether the edge is part of the graph.
Base.in
— Methodin(node::Node, graph::DAG)
Check whether the node is part of the graph.
Mute
ComputableDAGs._insert_edge!
— Function_insert_edge!(graph::DAG, node1::Node, node2::Node, index::Int=0; track = true, invalidate_cache = true)
Insert the edge between node1
(child) and node2
(parent) into the graph. An optional integer index can be given. The arguments of the function call that this node compiles to will then be ordered by these indices.
For creating new graphs, use the public version insert_edge!
instead which uses the defaults false for the keywords.
Keyword Arguments
track::Bool
: Whether to add the changes to theDAG
'sDiff
. Should be setfalse
in parsing or graph creation functions for performance.invalidate_cache::Bool
: Whether to invalidate caches associated with the changes. Should also be turned off for graph creation or parsing.
See also: _insert_node!
, _remove_node!
, _remove_edge!
ComputableDAGs._insert_node!
— Method_insert_node!(graph::DAG, node::Node; track = true, invalidate_cache = true)
Insert the node into the graph.
For creating new graphs, use the public version insert_node!
instead which uses the defaults false for the keywords.
Keyword Arguments
track::Bool
: Whether to add the changes to the DAG
's Diff
. Should be set false
in parsing or graph creation functions for performance.
invalidate_cache::Bool
: Whether to invalidate caches associated with the changes. Should also be turned off for graph creation or parsing.
See also: _remove_node!
, _insert_edge!
, _remove_edge!
ComputableDAGs._remove_edge!
— Method_remove_edge!(graph::DAG, node1::Node, node2::Node; track = true, invalidate_cache = true)
Remove the edge between node1 (child) and node2 (parent) into the graph. Returns the integer index of the removed edge.
Keyword Arguments
track::Bool
: Whether to add the changes to theDAG
'sDiff
. Should be setfalse
in parsing or graph creation functions for performance.invalidate_cache::Bool
: Whether to invalidate caches associated with the changes. Should also be turned off for graph creation or parsing.
See also: _insert_node!
, _remove_node!
, _insert_edge!
ComputableDAGs._remove_node!
— Method_remove_node!(graph::DAG, node::Node; track = true, invalidate_cache = true)
Remove the node from the graph.
Keyword Arguments
track::Bool
: Whether to add the changes to the DAG
's Diff
. Should be set false
in parsing or graph creation functions for performance.
invalidate_cache::Bool
: Whether to invalidate caches associated with the changes. Should also be turned off for graph creation or parsing.
See also: _insert_node!
, _insert_edge!
, _remove_edge!
ComputableDAGs.get_snapshot_diff
— Methodget_snapshot_diff(graph::DAG)
Return the graph's Diff
since last time this function was called.
See also: revert_diff!
, AppliedOperation
and revert_operation!
ComputableDAGs.insert_edge!
— Functioninsert_edge!(graph::DAG, node1::Node, node2::Node)
Insert the edge between node1 (child) and node2 (parent) into the graph.
ComputableDAGs.insert_node!
— Methodinsert_node!(graph::DAG, node::Node)
insert_node!(graph::DAG, task::AbstractTask, name::String="")
Insert the node into the graph or alternatively construct a node from the given task and insert it.
ComputableDAGs.invalidate_caches!
— Methodinvalidate_caches!(graph::DAG, operation::NodeReduction)
Invalidate the operation caches for a given NodeReduction
.
This deletes the operation from the graph's possible operations and from the involved nodes' own operation caches.
ComputableDAGs.invalidate_caches!
— Methodinvalidate_caches!(graph::DAG, operation::NodeSplit)
Invalidate the operation caches for a given NodeSplit
.
This deletes the operation from the graph's possible operations and from the involved nodes' own operation caches.
ComputableDAGs.invalidate_operation_caches!
— Methodinvalidate_operation_caches!(graph::DAG, node::ComputeTaskNode)
Invalidate the operation caches of the given node through calls to the respective invalidate_caches!
functions.
ComputableDAGs.invalidate_operation_caches!
— Methodinvalidate_operation_caches!(graph::DAG, node::DataTaskNode)
Invalidate the operation caches of the given node through calls to the respective invalidate_caches!
functions.
Base.show
— Methodshow(io::IO, graph::DAG)
Print the given graph to io. If there are too many nodes it will print only a summary of them.
ComputableDAGs.show_nodes
— Methodshow_nodes(io::IO, graph::DAG)
Print a graph's nodes. Should only be used for small graphs as it prints every node in a list.
Properties
ComputableDAGs.get_entry_nodes
— Methodget_entry_nodes(graph::DAG)
Return a vector of the graph's entry nodes.
ComputableDAGs.get_exit_node
— Methodget_exit_node(graph::DAG)
Return the graph's exit node. This assumes the graph only has a single exit node. If the graph has multiple exit nodes, the one encountered first will be returned.
ComputableDAGs.get_properties
— Methodget_properties(graph::DAG)
Return the graph's GraphProperties
.
ComputableDAGs.operation_stack_length
— Methodoperation_stack_length(graph::DAG)
Return the number of operations applied to the graph.
Validate
ComputableDAGs.is_connected
— Methodis_connected(graph::DAG)
Return whether the given graph is connected.
ComputableDAGs.is_scheduled
— Methodis_scheduled(graph::DAG)
Validate that the entire graph has been scheduled, i.e., every ComputeTaskNode
has its .device
set.
ComputableDAGs.is_valid
— Methodis_valid(graph::DAG)
Validate the entire graph using asserts. Intended for testing with @assert is_valid(graph)
.