2023-08-29 12:57:46 +02:00
|
|
|
"""
|
|
|
|
compute(t::AbstractTask; data...)
|
|
|
|
|
|
|
|
Fallback implementation of the compute function of a compute task, throwing an error.
|
|
|
|
"""
|
2023-05-25 17:20:16 +02:00
|
|
|
function compute(t::AbstractTask; data...)
|
2023-08-25 10:48:22 +02:00
|
|
|
return error("Need to implement compute()")
|
2023-05-25 17:20:16 +02:00
|
|
|
end
|
|
|
|
|
2023-08-29 12:57:46 +02:00
|
|
|
"""
|
|
|
|
compute_effort(t::AbstractTask)
|
|
|
|
|
|
|
|
Fallback implementation of the compute effort of a task, throwing an error.
|
|
|
|
"""
|
2023-05-25 17:20:16 +02:00
|
|
|
function compute_effort(t::AbstractTask)
|
2023-08-25 10:48:22 +02:00
|
|
|
# default implementation using compute
|
|
|
|
return error("Need to implement compute_effort()")
|
2023-05-25 17:20:16 +02:00
|
|
|
end
|
|
|
|
|
2023-08-29 12:57:46 +02:00
|
|
|
"""
|
|
|
|
data(t::AbstractTask)
|
|
|
|
|
|
|
|
Fallback implementation of the data of a task, throwing an error.
|
|
|
|
"""
|
2023-05-25 17:20:16 +02:00
|
|
|
function data(t::AbstractTask)
|
2023-08-25 10:48:22 +02:00
|
|
|
return error("Need to implement data()")
|
2023-05-25 17:20:16 +02:00
|
|
|
end
|
|
|
|
|
2023-08-29 12:57:46 +02:00
|
|
|
"""
|
|
|
|
compute_effort(t::AbstractDataTask)
|
|
|
|
|
|
|
|
Return the compute effort of a data task, always zero, regardless of the specific task.
|
|
|
|
"""
|
2023-05-25 17:20:16 +02:00
|
|
|
compute_effort(t::AbstractDataTask) = 0
|
2023-08-29 12:57:46 +02:00
|
|
|
|
|
|
|
"""
|
|
|
|
compute(t::AbstractDataTask; data...)
|
|
|
|
|
|
|
|
The compute function of a data task, always the identity function, regardless of the specific task.
|
|
|
|
"""
|
2023-05-25 17:20:16 +02:00
|
|
|
compute(t::AbstractDataTask; data...) = data
|
2023-08-29 12:57:46 +02:00
|
|
|
|
|
|
|
"""
|
|
|
|
data(t::AbstractDataTask)
|
|
|
|
|
|
|
|
Return the data of a data task. Given by the task's `.data` field.
|
|
|
|
"""
|
2023-05-25 17:20:16 +02:00
|
|
|
data(t::AbstractDataTask) = getfield(t, :data)
|
|
|
|
|
2023-08-29 12:57:46 +02:00
|
|
|
"""
|
|
|
|
data(t::AbstractComputeTask)
|
|
|
|
|
|
|
|
Return the data of a compute task, always zero, regardless of the specific task.
|
|
|
|
"""
|
2023-05-25 17:20:16 +02:00
|
|
|
data(t::AbstractComputeTask) = 0
|
|
|
|
|
2023-08-29 12:57:46 +02:00
|
|
|
"""
|
|
|
|
compute_effort(t::FusedComputeTask)
|
|
|
|
|
|
|
|
Return the compute effort of a fused compute task.
|
|
|
|
"""
|
2023-05-26 17:07:08 +02:00
|
|
|
function compute_effort(t::FusedComputeTask)
|
2023-08-25 10:48:22 +02:00
|
|
|
(T1, T2) = collect(typeof(t).parameters)
|
|
|
|
return compute_effort(T1()) + compute_effort(T2())
|
2023-05-26 17:07:08 +02:00
|
|
|
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-08-29 12:57:46 +02:00
|
|
|
"""
|
|
|
|
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)
|