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
|
|
|
|
|
|
|
|
# define compute_efforts tasks computation
|
|
|
|
# put some "random" numbers here for now
|
|
|
|
compute_effort(t::ComputeTaskS1) = 10
|
|
|
|
compute_effort(t::ComputeTaskS2) = 10
|
|
|
|
compute_effort(t::ComputeTaskU) = 6
|
|
|
|
compute_effort(t::ComputeTaskV) = 20
|
|
|
|
compute_effort(t::ComputeTaskP) = 15
|
|
|
|
|
|
|
|
# actual compute functions for the tasks can stay undefined for now
|
|
|
|
# compute(t::ComputeTaskU, data::Any) = mycomputation(data)
|
|
|
|
|
2023-05-25 17:58:06 +02:00
|
|
|
function compute_intensity(t::AbstractTask)::UInt32
|
2023-05-25 17:20:16 +02:00
|
|
|
if data(t) == 0
|
|
|
|
return typemax(UInt32)
|
|
|
|
end
|
|
|
|
return compute_effort(t) / data(t)
|
|
|
|
end
|
|
|
|
|
|
|
|
function ==(t1::AbstractTask, t2::AbstractTask)
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
|
|
|
function ==(t1::AbstractComputeTask, t2::AbstractComputeTask)
|
|
|
|
return typeof(t1) == typeof(t2)
|
|
|
|
end
|
|
|
|
|
|
|
|
function ==(t1::AbstractDataTask, t2::AbstractDataTask)
|
|
|
|
return data(t1) == data(t2)
|
|
|
|
end
|