-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question about possible assembly over predefined indices #123
Comments
It's a bit unclear what function assemble!(K, F, elements)
@floop for i in eachindex(elements)
Fe, Ke = compute_contribution(elements[i])
Klinc = (Ke, elements[i].vec_idxs)
Flinc = (Fe, elements[i].mat_idxs)
@reduce() do (Kl = zeros(size(K)); Klinc), (Fl = zeros(size(F)); Flinc)
if Flinc isa Tuple
(Fe, mat_idxs) = Flinc
Fl[vec_idxs] .+= Fe
else
Fl .+= Flinc
end
if Klinc isa Tuple
(Ke, mat_idxs) = Klinc
Kl[mat_idxs] .+= Ke
else
Kl .+= Klinc
end
end
end
K .= Kl
F .= Fl
end (This pattern would be easier to write once #117 lands) |
Sorry for not being more explicit but you guessed it right, and the above code works well.
Am I doing something wrong or is FLoops not really expected to help in this case? Thanks! |
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):
Note that this is a reduce operation as several elements may share the same indices
vec_idxs
andmat_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
andKl
arrays?Thanks!
The text was updated successfully, but these errors were encountered: