From e07ade47ad2eae343a33ec03095049c9055b8599 Mon Sep 17 00:00:00 2001 From: Anton Reinhard Date: Mon, 28 Aug 2023 14:13:04 +0200 Subject: [PATCH] Add abc-model documentation --- src/models/abc/properties.jl | 85 +++++++++++++++++++++++++++++++++++- src/models/abc/types.jl | 46 ++++++++++++++++--- 2 files changed, 123 insertions(+), 8 deletions(-) diff --git a/src/models/abc/properties.jl b/src/models/abc/properties.jl index a4f6506..fcc254b 100644 --- a/src/models/abc/properties.jl +++ b/src/models/abc/properties.jl @@ -1,21 +1,102 @@ -# define compute_efforts tasks computation -# put some "random" numbers here for now +""" + compute_effort(t::ComputeTaskS1) + +Return the compute effort of an S1 task. +""" compute_effort(t::ComputeTaskS1) = 10 + +""" + compute_effort(t::ComputeTaskS2) + +Return the compute effort of an S2 task. +""" compute_effort(t::ComputeTaskS2) = 10 + +""" + compute_effort(t::ComputeTaskU) + +Return the compute effort of a U task. +""" compute_effort(t::ComputeTaskU) = 6 + +""" + compute_effort(t::ComputeTaskV) + +Return the compute effort of a V task. +""" compute_effort(t::ComputeTaskV) = 20 + +""" + compute_effort(t::ComputeTaskP) + +Return the compute effort of a P task. +""" compute_effort(t::ComputeTaskP) = 15 + +""" + compute_effort(t::ComputeTaskSum) + +Return the compute effort of a Sum task. + +Note: This is a constant compute effort, even though sum scales with the number of its inputs. Since there is only ever a single sum node in a graph generated from the ABC-Model, +this doesn't matter. +""" compute_effort(t::ComputeTaskSum) = 1 +""" + show(io::IO, t::DataTask) + +Print the data task to io. +""" function show(io::IO, t::DataTask) return print(io, "Data", t.data) end +""" + show(io::IO, t::ComputeTaskS1) + +Print the S1 task to io. +""" show(io::IO, t::ComputeTaskS1) = print("ComputeS1") + +""" + show(io::IO, t::ComputeTaskS2) + +Print the S2 task to io. +""" show(io::IO, t::ComputeTaskS2) = print("ComputeS2") + +""" + show(io::IO, t::ComputeTaskP) + +Print the P task to io. +""" show(io::IO, t::ComputeTaskP) = print("ComputeP") + +""" + show(io::IO, t::ComputeTaskU) + +Print the U task to io. +""" show(io::IO, t::ComputeTaskU) = print("ComputeU") + +""" + show(io::IO, t::ComputeTaskV) + +Print the V task to io. +""" show(io::IO, t::ComputeTaskV) = print("ComputeV") + +""" + show(io::IO, t::ComputeTaskSum) + +Print the sum task to io. +""" show(io::IO, t::ComputeTaskSum) = print("ComputeSum") +""" + copy(t::DataTask) + +Copy the data task and return it. +""" copy(t::DataTask) = DataTask(t.data) diff --git a/src/models/abc/types.jl b/src/models/abc/types.jl index 5404b21..a160128 100644 --- a/src/models/abc/types.jl +++ b/src/models/abc/types.jl @@ -1,25 +1,59 @@ +""" + DataTask <: AbstractDataTask + +Task representing a specific data transfer in the ABC Model. +""" struct DataTask <: AbstractDataTask data::UInt64 end -# S task with 1 child +""" + ComputeTaskS1 <: AbstractComputeTask + +S task with a single child. +""" struct ComputeTaskS1 <: AbstractComputeTask end -# S task with 2 children +""" + ComputeTaskS2 <: AbstractComputeTask + +S task with two children. +""" struct ComputeTaskS2 <: AbstractComputeTask end -# P task with 0 children +""" + ComputeTaskP <: AbstractComputeTask + +P task with no children. +""" struct ComputeTaskP <: AbstractComputeTask end -# v task with 2 children +""" + ComputeTaskV <: AbstractComputeTask + +v task with two children. +""" struct ComputeTaskV <: AbstractComputeTask end -# u task with 1 child +""" + ComputeTaskU <: AbstractComputeTask + +u task with a single child. +""" struct ComputeTaskU <: AbstractComputeTask end -# task that sums all its inputs, n children +""" + ComputeTaskSum <: AbstractComputeTask + +Task that sums all its inputs, n children. +""" struct ComputeTaskSum <: AbstractComputeTask end +""" + ABC_TASKS + +Constant vector of all tasks of the ABC-Model. +""" ABC_TASKS = [ DataTask, ComputeTaskS1,