2023-05-25 17:20:16 +02:00
|
|
|
function compute(t::AbstractTask; data...)
|
|
|
|
error("Need to implement compute()")
|
|
|
|
end
|
|
|
|
|
|
|
|
function compute_effort(t::AbstractTask)
|
|
|
|
# default implementation using compute
|
|
|
|
error("Need to implement compute_effort()")
|
|
|
|
end
|
|
|
|
|
|
|
|
function data(t::AbstractTask)
|
|
|
|
error("Need to implement data()")
|
|
|
|
end
|
|
|
|
|
|
|
|
compute_effort(t::AbstractDataTask) = 0
|
|
|
|
compute(t::AbstractDataTask; data...) = data
|
|
|
|
data(t::AbstractDataTask) = getfield(t, :data)
|
|
|
|
|
|
|
|
data(t::AbstractComputeTask) = 0
|
|
|
|
|
2023-05-26 17:07:08 +02:00
|
|
|
function compute_effort(t::FusedComputeTask)
|
|
|
|
(T1, T2) = collect(typeof(t).parameters)
|
|
|
|
return compute_effort(T1()) + compute_effort(T2())
|
|
|
|
end
|
2023-05-25 17:20:16 +02:00
|
|
|
|
|
|
|
# actual compute functions for the tasks can stay undefined for now
|
|
|
|
# compute(t::ComputeTaskU, data::Any) = mycomputation(data)
|
|
|
|
|
2023-05-26 19:25:21 +02:00
|
|
|
function compute_intensity(t::AbstractTask)::UInt64
|
2023-05-25 17:20:16 +02:00
|
|
|
if data(t) == 0
|
2023-05-26 19:25:21 +02:00
|
|
|
return typemax(UInt64)
|
2023-05-25 17:20:16 +02:00
|
|
|
end
|
|
|
|
return compute_effort(t) / data(t)
|
2023-08-24 15:11:54 +02:00
|
|
|
end
|