-
Notifications
You must be signed in to change notification settings - Fork 172
BUG: fix reuse of matfree adjoint Interpolator #4623
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
base: release
Are you sure you want to change the base?
Conversation
df3e169
to
ed3f5b9
Compare
ed3f5b9
to
462f355
Compare
Is there any chance this could be two PRs? It's hard to understand the parallel bits when mixed into the other changes. Also note that the halo freezing stuff is done automatically in pyop3, so maybe you don't have to worry about optimising that here. |
d8d6687
to
19fa12e
Compare
I'm having a hard time with git. The parloop removal is the only other thing that's not adressing the bug, should be easy to ignore from the rest of the PR. |
347184c
to
7d4b07a
Compare
7d4b07a
to
f7dbe9b
Compare
v = firedrake.Function(W) | ||
expr = expr._ufl_expr_reconstruct_(operand, v=v) | ||
with weight.dat.vec_ro as w, dual_arg.dat.vec_ro as x, v.dat.vec_wo as y: | ||
callables += (partial(y.pointwiseMult, x, w),) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@connorjward it turns out that this pointwiseMult is the source of the evil. I fixed it by splitting it in two separate calls, so that multiplication is done in-place.
x.copy(y)
y.pointwiseMult(y, w)
I have no explanation why this approach works and the original doesn't.
800bf4c
to
21c9173
Compare
948c50e
to
1a35688
Compare
Co-authored-by: Connor Ward <[email protected]>
Description
Fixes a parallel bug when reusing a matfree adjoint
Interpolator
. Summation withaccess=INC
skipped the halo exchange after the first call toInterpolator.assemble()
. On subsequent calls the summation only happened locally within each process, but not across processes.This bug did not affect
assemble(interpolate(...))
because the Interpolator there is never reused.