Skip to content

Commit dec07f3

Browse files
committed
fixup! Move Sch.ThunkOptions into Options
1 parent 68570e8 commit dec07f3

File tree

4 files changed

+6
-18
lines changed

4 files changed

+6
-18
lines changed

src/options.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ Stores per-task options to be passed to the scheduler.
1414
- `proclist=nothing`: (Deprecated) Force task to use one or more processors that are instances/subtypes of a contained type. Alternatively, a function can be supplied, and the function will be called with a processor as the sole argument and should return a `Bool` result to indicate whether or not to use the given processor. `nothing` enables all default processors.
1515
- `get_result::Bool=false`: Whether the worker should store the result directly (`true`) or as a `Chunk` (`false`)
1616
- `meta::Bool=false`: When `true`, values are not `move`d, and are passed directly as `Chunk`, if they are not immediate values
17-
- `cache::Bool=false`: When `true`, caches the task's result in it's associated `Thunk` as `.cache_ref`
1817
- `syncdeps::Set{Any}`: Contains any additional tasks to synchronize with
1918
- `time_util::Dict{Type,Any}`: Indicates the maximum expected time utilization for this task. Each keypair maps a processor type to the utilization, where the value can be a real (approximately the number of nanoseconds taken), or `MaxUtilization()` (utilizes all processors of this type). By default, the scheduler assumes that this task only uses one processor.
2019
- `alloc_util::Dict{Type,UInt64}`: Indicates the maximum expected memory utilization for this task. Each keypair maps a processor type to the utilization, where the value is an integer representing approximately the maximum number of bytes allocated at any one time.
@@ -37,7 +36,6 @@ Base.@kwdef mutable struct Options
3736

3837
get_result::Union{Bool,Nothing} = nothing
3938
meta::Union{Bool,Nothing} = nothing
40-
cache::Union{Bool,Nothing} = nothing
4139

4240
syncdeps::Union{Set{Any},Nothing} = nothing
4341

@@ -112,7 +110,6 @@ function populate_defaults!(opts::Options, sig)
112110
maybe_default!(opts, Val{:proclist}(), sig)
113111
maybe_default!(opts, Val{:get_result}(), sig)
114112
maybe_default!(opts, Val{:meta}(), sig)
115-
maybe_default!(opts, Val{:cache}(), sig)
116113
maybe_default!(opts, Val{:syncdeps}(), sig)
117114
maybe_default!(opts, Val{:time_util}(), sig)
118115
maybe_default!(opts, Val{:alloc_util}(), sig)

src/sch/Sch.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1517,7 +1517,7 @@ function do_task(to_proc, task::TaskSpec)
15171517
else
15181518
# TODO: Cache this Chunk locally in CHUNK_CACHE right now
15191519
tochunk(result, to_proc;
1520-
device, cache=something(options.cache, false),
1520+
device,
15211521
tag=options.storage_root_tag,
15221522
leaf_tag=something(options.storage_leaf_tag, MemPool.Tag()),
15231523
retain=something(options.storage_retain, false))

src/thunk.jl

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,6 @@ julia> collect(t) # computes the result and returns it to the current process
4747
for each property are described in the next section.
4848
- `option=value`: The same as passing `kwargs` to `delayed`.
4949
50-
## Public Properties
51-
- `meta::Bool=false`: If `true`, instead of fetching cached arguments from
52-
`Chunk`s and passing the raw arguments to the called function, instead pass the
53-
`Chunk`. Useful for doing manual fetching or manipulation of `Chunk`
54-
references. Non-`Chunk` arguments are still passed as-is. -
55-
`processor::Processor=OSProc()` - The processor associated with the called
56-
function. Useful if the called function is a callable struct that exists on a
57-
given processor and should be transferred appropriately. -
58-
`scope::Dagger.AbstractScope=DefaultScope()` - The scope associated with the
59-
called function. Useful if the called function is a callable struct that may
60-
only be transferred to, and executed within, the specified scope.
61-
6250
## Options
6351
- `options`: An `Options` struct providing the options for the `Thunk`.
6452
If omitted, options can also be specified by passing key-value pairs as
@@ -147,6 +135,9 @@ function Thunk(f, xs...;
147135
if kwargs !== nothing
148136
options_merge!(options, (;kwargs...))
149137
end
138+
if haskey(kwargs, :cache)
139+
@warn "The cache argument is deprecated, as it is now always true" maxlog=1
140+
end
150141
spec.cache_ref = cache_ref
151142
spec.affinity = affinity
152143
return Thunk(spec)
@@ -166,7 +157,7 @@ function affinity(t::Thunk)
166157
return t.affinity
167158
end
168159

169-
if t.cache && t.cache_ref !== nothing
160+
if t.cache_ref !== nothing
170161
aff_vec = affinity(t.cache_ref)
171162
else
172163
aff = Dict{OSProc,Int}()

src/utils/chunks.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ new `Chunk`.
152152
153153
All other kwargs are passed directly to `MemPool.poolset`.
154154
"""
155-
function tochunk(x::X, proc::P=OSProc(), scope::S=AnyScope(); cache=false, device=nothing, rewrap=false, kwargs...) where {X,P,S}
155+
function tochunk(x::X, proc::P=OSProc(), scope::S=AnyScope(); device=nothing, rewrap=false, kwargs...) where {X,P,S}
156156
if device === nothing
157157
device = if Sch.walk_storage_safe(x)
158158
MemPool.GLOBAL_DEVICE[]

0 commit comments

Comments
 (0)