-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Hi, I'm trying to write a parallel reduction but haven't seen it in the docs and cannot make it work.
The idea is the following (MWE):
function assemble!(K, F, elements)
@floop for i in eachindex(elements)
Fe, Ke = compute_contribution(elements[i])
@reduce() do (Kl = zeros(size(K)); Ke), (Fl = zeros(size(F)); Fe)
Fl[elements[i].vec_idxs] .+= Fe
Kl[elements[i].mat_idxs] .+= Ke
end
end
K .= Kl
F .= Fl
end
Note that this is a reduce operation as several elements may share the same indices vec_idxs and mat_idxs.
Is this kind of operation supported in FLoops? If so, could you point me how to make it work (even better without allocating intermediate Fl and Kl arrays?
Thanks!
Metadata
Metadata
Assignees
Labels
No labels