Add remaining documentation, fix broken refs

This commit is contained in:
Anton Reinhard 2023-08-28 18:43:11 +02:00
parent 8a6e3864eb
commit e4f2ae5b85
12 changed files with 47 additions and 30 deletions

View File

@ -5,8 +5,8 @@
### Types
```@autodocs
Modules = [MetagraphOptimization]
Pages = ["model/abc/types.jl"]
Order = [:type]
Pages = ["models/abc/types.jl"]
Order = [:type, :constant]
```
### Parse

View File

@ -7,6 +7,13 @@ Pages = ["task/type.jl"]
Order = [:type]
```
## Create
```@autodocs
Modules = [MetagraphOptimization]
Pages = ["task/create.jl"]
Order = [:function]
```
## Compare
```@autodocs
Modules = [MetagraphOptimization]

View File

@ -4,6 +4,12 @@ Documentation for `MetagraphOptimization.jl`'s public interface.
See the Internals section of the manual for documentation of everything else.
```@autodocs
Modules = [MetagraphOptimization]
Pages = ["MetagraphOptimization.jl"]
Order = [:module]
```
## Contents
```@contents

View File

@ -184,7 +184,7 @@ end
Return the graph's [`Diff`](@ref) since last time this function was called.
See also: [`revert_diff`](@ref), [`AppliedOperation`](@ref) and [`revert_operation`](@ref)
See also: [`revert_diff!`](@ref), [`AppliedOperation`](@ref) and [`revert_operation!`](@ref)
"""
function get_snapshot_diff(graph::DAG)
return swapfield!(graph, :diff, Diff())

View File

@ -109,7 +109,7 @@ end
"""
revert_diff!(graph::DAG, diff::Diff)
Revert the given diff on the graph. Used to revert the individual [`ApplieOperation`](@ref)s with [`revert_operation`](@ref).
Revert the given diff on the graph. Used to revert the individual [`AppliedOperation`](@ref)s with [`revert_operation!`](@ref).
"""
function revert_diff!(graph::DAG, diff::Diff)
# add removed nodes, remove added nodes, same for edges

View File

@ -2,6 +2,11 @@
using Base.Threads
"""
get_operations(graph::DAG)
Return the [`PossibleOperations`](@ref) of the graph at the current state.
"""
function get_operations(graph::DAG)
apply_all!(graph)

View File

@ -5,7 +5,7 @@ An abstract base class for operations. An operation can be applied to a [`DAG`](
Possible operations on a [`DAG`](@ref) can be retrieved using [`get_operations`](@ref).
See also: [`push_operation`](@ref), [`pop_operation`](@ref)
See also: [`push_operation!`](@ref), [`pop_operation!`](@ref)
"""
abstract type Operation end
@ -16,7 +16,7 @@ An abstract base class for already applied operations.
An applied operation can be reversed iff it is the last applied operation on the DAG.
Every applied operation stores a [`Diff`](@ref) from when it was initially applied to be able to revert the operation.
See also: [`revert_operation`](@ref).
See also: [`revert_operation!`](@ref).
"""
abstract type AppliedOperation end

14
src/task/create.jl Normal file
View File

@ -0,0 +1,14 @@
"""
copy(t::AbstractDataTask)
Fallback implementation of the copy of an abstract data task, throwing an error.
"""
copy(t::AbstractDataTask) =
error("Need to implement copying for your data tasks!")
"""
copy(t::AbstractComputeTask)
Return a copy of the given compute task.
"""
copy(t::AbstractComputeTask) = typeof(t)()

View File

@ -66,3 +66,10 @@ end
# actual compute functions for the tasks can stay undefined for now
# compute(t::ComputeTaskU, data::Any) = mycomputation(data)
"""
get_types(::FusedComputeTask{T1, T2})
Return a tuple of a the fused compute task's components' types.
"""
get_types(::FusedComputeTask{T1, T2}) where {T1, T2} = (T1, T2)

View File

@ -28,25 +28,3 @@ Also see: [`get_types`](@ref).
"""
struct FusedComputeTask{T1 <: AbstractComputeTask, T2 <: AbstractComputeTask} <:
AbstractComputeTask end
"""
get_types(::FusedComputeTask{T1, T2})
Return a tuple of a the fused compute task's components' types.
"""
get_types(::FusedComputeTask{T1, T2}) where {T1, T2} = (T1, T2)
"""
copy(t::AbstractDataTask)
Fallback implementation of the copy of an abstract data task, throwing an error.
"""
copy(t::AbstractDataTask) =
error("Need to implement copying for your data tasks!")
"""
copy(t::AbstractComputeTask)
Return a copy of the given compute task.
"""
copy(t::AbstractComputeTask) = typeof(t)()

View File

@ -12,7 +12,7 @@ end
NodeTrie
Trie data structure for node reduction, inserts nodes by children.
Assumes that given nodes have ordered vectors of children (see [`sort_node`](@ref)).
Assumes that given nodes have ordered vectors of children (see [`sort_node!`](@ref)).
First insertion level is the node's own task type and thus does not have a value (every node has a task type).
See also: [`insert!`](@ref) and [`collect`](@ref)

View File

@ -33,7 +33,7 @@ end
sort_node!(node::Node)
Sort the nodes' parents and children vectors. The vectors are mostly very short so sorting does not take a lot of time.
Sorted nodes are required to make the finding of [`NodeReduction`](@ref)s a lot faster using the [`Trie`](@ref) data structure.
Sorted nodes are required to make the finding of [`NodeReduction`](@ref)s a lot faster using the [`NodeTrie`](@ref) data structure.
"""
function sort_node!(node::Node)
sort!(node.children, lt = lt_nodes)