Skip to content

Commit a2c4b5b

Browse files
committed
fixup! Add keyword argument support
1 parent 7c3eef0 commit a2c4b5b

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

src/array/darray.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ function thunkize(ctx::Context, c::DArray; persist=true)
251251
if persist
252252
foreach(persist!, thunks)
253253
end
254-
Thunk(thunks...; meta=true) do results...
254+
Thunk(map(thunk->nothing=>thunk, thunks)...; meta=true) do results...
255255
t = eltype(results[1])
256256
DArray(t, dmn, dmnchunks,
257257
reshape(Union{Chunk,Thunk}[results...], sz))

src/array/map-reduce.jl

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function stage(ctx::Context, node::Map)
1919
f = node.f
2020
for i=eachindex(domains)
2121
inps = map(x->chunks(x)[i], inputs)
22-
thunks[i] = Thunk((args...) -> map(f, args...), inps...)
22+
thunks[i] = Thunk((args...) -> map(f, args...), map(inp->nothing=>inp, inps)...)
2323
end
2424
DArray(Any, domain(primary), domainchunks(primary), thunks)
2525
end
@@ -40,8 +40,8 @@ end
4040

4141
function stage(ctx::Context, r::ReduceBlock)
4242
inp = stage(ctx, r.input)
43-
reduced_parts = map(x -> Thunk(r.op, x; get_result=r.get_result), chunks(inp))
44-
Thunk((xs...) -> r.op_master(xs), reduced_parts...; meta=true)
43+
reduced_parts = map(x -> Thunk(r.op, nothing=>x; get_result=r.get_result), chunks(inp))
44+
Thunk((xs...) -> r.op_master(xs), map(part->nothing=>part, reduced_parts)...; meta=true)
4545
end
4646

4747
reduceblock_async(f, x::ArrayOp; get_result=true) = ReduceBlock(f, f, x, get_result)
@@ -126,10 +126,10 @@ function stage(ctx::Context, r::Reducedim)
126126
inp = cached_stage(ctx, r.input)
127127
thunks = let op = r.op, dims=r.dims
128128
# do reducedim on each block
129-
tmp = map(p->Thunk(b->reduce(op,b,dims=dims), p), chunks(inp))
129+
tmp = map(p->Thunk(b->reduce(op,b,dims=dims), nothing=>p), chunks(inp))
130130
# combine the results in tree fashion
131131
treereducedim(tmp, r.dims) do x,y
132-
Thunk(op, x,y)
132+
Thunk(op, nothing=>x, nothing=>y)
133133
end
134134
end
135135
c = domainchunks(inp)

src/array/matrix.jl

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ function size(x::Transpose)
1717
end
1818

1919
transpose(x::ArrayOp) = Transpose(transpose, x)
20-
transpose(x::Union{Chunk, Thunk}) = Thunk(transpose, x)
20+
transpose(x::Union{Chunk, Thunk}) = Thunk(transpose, nothing=>x)
2121

2222
adjoint(x::ArrayOp) = Transpose(adjoint, x)
23-
adjoint(x::Union{Chunk, Thunk}) = Thunk(adjoint, x)
23+
adjoint(x::Union{Chunk, Thunk}) = Thunk(adjoint, nothing=>x)
2424

2525
function adjoint(x::ArrayDomain{2})
2626
d = indexes(x)
@@ -91,8 +91,8 @@ function (+)(a::ArrayDomain, b::ArrayDomain)
9191
a
9292
end
9393

94-
(*)(a::Union{Chunk, Thunk}, b::Union{Chunk, Thunk}) = Thunk(*, a,b)
95-
(+)(a::Union{Chunk, Thunk}, b::Union{Chunk, Thunk}) = Thunk(+, a,b)
94+
(*)(a::Union{Chunk, Thunk}, b::Union{Chunk, Thunk}) = Thunk(*, nothing=>a, nothing=>b)
95+
(+)(a::Union{Chunk, Thunk}, b::Union{Chunk, Thunk}) = Thunk(+, nothing=>a, nothing=>b)
9696

9797
# we define our own matmat and matvec multiply
9898
# for computing the new domains and thunks.
@@ -211,7 +211,7 @@ end
211211
function _scale(l, r)
212212
res = similar(r, Any)
213213
for i=1:length(l)
214-
res[i,:] = map(x->Thunk((a,b) -> Diagonal(a)*b, l[i], x), r[i,:])
214+
res[i,:] = map(x->Thunk((a,b) -> Diagonal(a)*b, nothing=>l[i], nothing=>x), r[i,:])
215215
end
216216
res
217217
end

src/array/operators.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Base.@deprecate mappart(args...) mapchunk(args...)
107107
function stage(ctx::Context, node::MapChunk)
108108
inputs = map(x->cached_stage(ctx, x), node.input)
109109
thunks = map(map(chunks, inputs)...) do ps...
110-
Thunk(node.f, ps...)
110+
Thunk(node.f, map(p->nothing=>p, ps)...)
111111
end
112112

113113
DArray(Any, domain(inputs[1]), domainchunks(inputs[1]), thunks)

src/array/setindex.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function stage(ctx::Context, sidx::SetIndex)
3535
local_dmn = ArrayDomain(map(x->x[2], idx_and_dmn))
3636
s = subdmns[idx...]
3737
part_to_set = sidx.val
38-
ps[idx...] = Thunk(ps[idx...]) do p
38+
ps[idx...] = Thunk(nothing=>ps[idx...]) do p
3939
q = copy(p)
4040
q[indexes(project(s, local_dmn))...] .= part_to_set
4141
q

0 commit comments

Comments
 (0)