Skip to content
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

Investigate failing testcase on macos 14 runners (arm64) #635

Open
veenstrajelmer opened this issue Apr 27, 2024 · 1 comment
Open

Investigate failing testcase on macos 14 runners (arm64) #635

veenstrajelmer opened this issue Apr 27, 2024 · 1 comment

Comments

@veenstrajelmer
Copy link
Collaborator

veenstrajelmer commented Apr 27, 2024

What is the need for this task.
In issue #444 and the associated PR #636, the linux and macos testbenches were restored. However, in that process it was noticed the runner macos-latest results in one failing testcase: FAILED tests/dflowfm/test_net.py::test_create_1d_2d_1d2d

This is the plain HYDROLIB-core code, the test fails on assert network1_link1d2d.shape == (21, 2):

import numpy as np
import matplotlib.pyplot as plt
plt.close("all")
from meshkernel import GeometryList
from hydrolib.core.dflowfm.net.models import Branch, Network

def get_circle_gl(r, detail=100):

    t = np.r_[np.linspace(0, 2 * np.pi, detail), 0]
    polygon = GeometryList(np.cos(t) * r, np.sin(t) * r)
    return polygon

# Define line (spiral)
theta = np.arange(0.1, 20, 0.01)

y = np.sin(theta) * theta
x = np.cos(theta) * theta

dists = np.r_[0.0, np.cumsum(np.hypot(np.diff(x), np.diff(y)))]
dists = dists[np.arange(0, len(dists), 20)]

# Create branch
branch = Branch(geometry=np.stack([x, y], axis=1), branch_offsets=dists)

# Create Mesh1d
network = Network()
network.mesh1d_add_branch(branch, name="branch1")

# Add Mesh2d
network.mesh2d_create_rectilinear_within_extent(
    extent=(-22, -22, 22, 22), dx=2, dy=2
)
network.mesh2d_clip_mesh(geometrylist=get_circle_gl(22))

network.mesh2d_refine_mesh(polygon=get_circle_gl(11), level=1)
network.mesh2d_refine_mesh(polygon=get_circle_gl(3), level=1)

# Add links
network.link1d2d_from_1d_to_2d(branchids=["branch1"], polygon=get_circle_gl(19))

mesh2d_output = network._mesh2d.get_mesh2d()
assert len(mesh2d_output.face_x) == 152
mesh1d_output = network._mesh1d._get_mesh1d()
assert len(mesh1d_output.node_x) == 100

network1_link1d2d = network._link1d2d.link1d2d
network1_con_m1d = network._link1d2d.meshkernel.contacts_get().mesh1d_indices
network1_con_m2d = network._link1d2d.meshkernel.contacts_get().mesh2d_indices
assert network1_link1d2d.shape == (21, 2)
assert network1_con_m1d.size == 21
assert network1_con_m2d.size == 21

_, ax1 = plt.subplots()
network.plot(ax=ax1)

Plots this figure (on windows):
image

macos-latest results in macos-14 which has arm64 architecture. However, the testbank is green on macos-12 and macos-13, which seem to have x86_64 architecture (details in Deltares/MeshKernelPy#162). It seems that this specific part of the meshkernelpy code is not covered by meshkernel tests and it fails on arm64 and not on x86_64 architecture. It seems not a hydrolib-core issue, but this is still valuable information.

What is the task?
Check if this hypothesis is correct and add this testcase to the meshkernel testbench after removing hydrolib-core dependencies.

@veenstrajelmer
Copy link
Collaborator Author

veenstrajelmer commented Apr 29, 2024

This testcase can be reproduced also when all hydrolib-calls are excluded. Therefore, a meshkernelpy issue is created to add this test to the meshkernelpy testbank: Deltares/MeshKernelPy#164. After fixing that issue, hydrolib-core should also have a green testbank on macos-14/macos-latest and this os can be added in ci.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant