Broken locate_cells_ref_coords_and_dists? #3001
-
I am having some extremely bizarre problems with the For example, something like this: from firedrake import *
import numpy as np
mesh = UnitSquareMesh(3,3, quadrilateral=True)
coords = np.array([[0,0],[0.9,0.1],[0.5,0.5],[0.2, 0.8]])
print(mesh.locate_cells_ref_coords_and_dists(coords)) Will sometimes give:
or otherwise,
rather than the expected:
I can't find any other problems (only the vertexonly tests fail), and I cannot pinpoint the issue any further. I have tried updating and re-installing firedrake to no avail. And there are no warnings or issues with the install at all. Has anyone else run in to this problem before? I would appreciate any pointers as to how to resolve or any next steps. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 9 replies
-
I can reproduce this: In [1]: from firedrake import *
...: import numpy as np
...:
...: mesh = UnitSquareMesh(3,3, quadrilateral=True)
...: coords = coords = np.array([[0,0],[0.9,0.1],[0.5,0.5],[0.2, 0.8]])
...: print(mesh.locate_cells_ref_coords_and_dists(coords))
(array([3, 0, 7, 0], dtype=int32), array([[0., 0.],
[0., 0.],
[0., 0.],
[0., 0.]]), array([0. , 0.33333333, 0.66666667, 1. ])) I also get a bunch of test fails including a load of out of bounds errors. Looks like we have a memory access bug on Mac. |
Beta Was this translation helpful? Give feedback.
-
This is an error in how we were calling a C function. C is a very low-level language, and this sort of error results in accessing memory at the wrong locations. Unlike Python, where analogous errors will immediately raise an exception, in C the effect of this sort of bug is sensitively dependent on the precise layout of the memory in the program concerned. This depends on hardware, operating system, compiler version, library versions.... There are any number of seemingly innocuous changes that can change the behaviour of a bug like this. Indeed, the question that presents itself when we find an error of this sort isn't really "why did that fail now?", it's "how on Earth did we get away with this for so long!" |
Beta Was this translation helpful? Give feedback.
I claim #3003 fixes this. Thanks for the very clear bug report @rubyturner.