NGSolve / netgen

https://ngsolve.org
GNU Lesser General Public License v2.1
298 stars 131 forks source link

some test_geo tests fail on non-Intel architectures #167

Open drew-parsons opened 1 year ago

drew-parsons commented 1 year ago

A subset of the same tests from test_tutorials.py::test_geoFiles fails on non-Intel architectures such as arm64. It looks like a simple matter of floating point tolerance, though a couple are integer tests. The specific set is

=========================== short test summary info ============================
FAILED test_tutorials.py::test_geoFiles[boxcyl.geo-mp11-5] - 22509.04709 == 22512.616569 ± 2.3e-01
FAILED test_tutorials.py::test_geoFiles[cylsphere.geo-mp61-1] - assert 228.55775864 == 224.99962174 ± 2.2e-03
FAILED test_tutorials.py::test_geoFiles[cylsphere.geo-mp64-4] - assert 17714 == 17680
FAILED test_tutorials.py::test_geoFiles[hinge.stl-mp99-5] - assert 125397 == 124571
FAILED test_tutorials.py::test_geoFiles[part1.stl-mp129-1] - assert 457 == 458
FAILED test_tutorials.py::test_geoFiles[part1.stl-mp132-4] - assert 73017 == 73083
FAILED test_tutorials.py::test_geoFiles[sculpture.geo-mp149-4] - assert 1875.8247719 == 1875.2535427 ± 1.9e-02
FAILED test_tutorials.py::test_geoFiles[sphereincube.geo-mp168-5] - assert 13989 == 13967
FAILED test_tutorials.py::test_geoFiles[twobricks.geo-mp199-0] - assert 46 == 41
FAILED test_tutorials.py::test_geoFiles[twobricks.geo-mp201-2] - assert [29.602, 120.18] == approx([29.60...18 ± 1.2e-02])`
FAILED test_tutorials.py::test_geoFiles[twobricks.geo-mp202-3] - assert 46 == 41
FAILED test_tutorials.py::test_geoFiles[twocubes.geo-mp205-0] - assert 46 == 41
FAILED test_tutorials.py::test_geoFiles[twocubes.geo-mp207-2] - assert [29.602, 120.18] == approx([29.60...18 ± 1.2e-02])
FAILED test_tutorials.py::test_geoFiles[twocubes.geo-mp208-3] - assert 46 == 41
====== 14 failed, 143 passed, 107 skipped, 1 warning in 241.73s (0:04:01) ======

Build logs can be found at https://buildd.debian.org/status/package.php?p=netgen&suite=experimental (past builds will be found under the "old" links at https://buildd.debian.org/status/package.php?p=netgen)

An example is the boxcyl error from arm64 at https://buildd.debian.org/status/fetch.php?pkg=netgen&arch=arm64&ver=6.2.2305%2Bdfsg1-1exp1&stamp=1699664433&raw=0

_______________________ test_geoFiles[boxcyl.geo-mp11-5] _______________________

filename = 'boxcyl.geo'
mp = <netgen.libngpy._meshing.MeshingParameters object at 0xffff9888cc30>, i = 5
refdata = {'boundarycondition.geo': [{'angles_tet': [27.291, 136.38], 'angles_trig': [23.577, 123.09], 'ne1d': 74, 'ne2d': 52, ....2d': 1648, ...}, {'angles_tet': [20.726, 143.6], 'angles_trig': [23.171, 123.6], 'ne1d': 160, 'ne2d': 4738, ...}], ...}

    @pytest.mark.parametrize(("filename", "mp", "i"), getParameters())
    def test_geoFiles(filename, mp, i, refdata):
        ref = refdata[filename]
        import filecmp
        print("load geo", filename)
        mp = MeshingParameters(mp, parallel_meshing=False)
        mesh = generateMesh(filename, mp)
        mesh.Save(filename+'_seq.vol.gz')
        with TaskManager():
            mesh_par = generateMesh(filename, mp)
            mesh_par.Save(filename+'_par.vol.gz')

        assert filecmp.cmp(filename+'_seq.vol.gz', filename+'_par.vol.gz')
>       checkData(mesh, mp, ref[i])

test_tutorials.py:131: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

mesh = <netgen.libngpy._meshing.Mesh object at 0xffff9888cf70>
mp = <netgen.libngpy._meshing.MeshingParameters object at 0xffff9888cc30>
ref = {'angles_tet': [25.158, 143.56], 'angles_trig': [26.346, 116.86], 'ne1d': 456, 'ne2d': 2480, ...}

    def checkData(mesh, mp, ref):
        data = getData(mesh, mp)
        assert ref['ne1d'] == data['ne1d']
        assert ref['ne2d'] == data['ne2d']
        assert ref['ne3d'] == data['ne3d']
        assert json.loads(ref['quality_histogram']) == pytest.approx(json.loads(data['quality_histogram']), abs=1, rel=0.4)
>       assert ref['total_badness'] == pytest.approx(data['total_badness'], rel=1e-5)
E       assert 22509.04709 == 22512.616569 ± 2.3e-01
E         comparison failed
E         Obtained: 22509.04709
E         Expected: 22512.616569 ± 2.3e-01

test_tutorials.py:44: AssertionError
----------------------------- Captured stdout call -----------------------------
load geo boxcyl.geo
drew-parsons commented 1 year ago

For what it's worth, these tutorial geo tests pass on armhf, https://buildd.debian.org/status/fetch.php?pkg=netgen&arch=armhf&ver=6.2.2305%2Bdfsg1-1exp5&stamp=1699917420&raw=0