-
-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Skip negative cell indices when packing coefficients #3361
Conversation
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.
Tested it locally with this script and everything runs fine. The SEGV I was previously having doesn't appear anymore.
Thanks @jorgensd ! 🎉
@jpdean do you have time to look at this? |
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.
@jorgensd Is there a change we could make to avoid this check? I haven't looked at the details for a long time . . .
* Skip negative cell indices when packing coefficients * Simplify MPI send recv * Ruff formatting * Small logic simplification --------- Co-authored-by: Garth N. Wells <gnw20@cam.ac.uk>
Continuation of #3260.
If one has multiple disjoint sub-meshes in a variational form, then restricting packing by
enabled_coefficients
per integral type is not sufficient.Example follows:
Divide an interval mesh in three disjoint cell sets (left, center, right).
If we want to create a coupling from the right submesh to the parent mesh at the interface between center and right),
we can add an integral
(u_parent("+")-u_parent("-"))*v_right("+")*dS(interface_rc)
to our variational form.Similarly we could do the same for the left integral:
(u_parent("+")-u_parent("-"))*v_left("+")*dS(interface_lc)
.However, now both coefficient v_right and v_left will be packed for all facets marked with either interface_rc or interface_lc, which leads to undefined behavior (segfaults).
The following PR adds a check after fetching the cell during packing, and only packs coefficients if the cell index is positive.
Issue reported by @RemDelaporteMathurin when trying to adapt my example: https://gist.github.com/jorgensd/8a5c32f491195e838f5863ca88b27bce#file-problem-py to multiple surfaces.