Skip to content

Test failures for larger dimensions with numpy-2.3.1 on fedora #432

@keszybz

Description

@keszybz

Hi! I'm trying to update the package in Fedora, and I'm getting the following failures:

tests/ndarray/test_reductions.py::test_broadcast_params[shapes2-True-0-sum] FAILED                                                                                                   [ 13%]
>>>>>>>>>>>>>>>>>>>>>>>>>>>> traceback >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

axis = 0, keepdims = True, reduce_op = 'sum', shapes = ((100, 100, 100), (100, 100), (100,))

    @pytest.mark.parametrize("reduce_op", ["sum", "mean", "std", "var", "min", "max", "any", "all"])
    @pytest.mark.parametrize("axis", [0, (0, 1), None])
    @pytest.mark.parametrize("keepdims", [True, False])
    @pytest.mark.parametrize(
        "shapes",
        [
            ((5, 5, 5), (5, 5), (5,)),
            ((10, 10, 10), (10, 10), (10,)),
            ((100, 100, 100), (100, 100), (100,)),
        ],
    )
    def test_broadcast_params(axis, keepdims, reduce_op, shapes):
        na1 = np.linspace(0, 1, np.prod(shapes[0])).reshape(shapes[0])
        na2 = np.linspace(1, 2, np.prod(shapes[1])).reshape(shapes[1])
        na3 = np.linspace(2, 3, np.prod(shapes[2])).reshape(shapes[2])
        a1 = blosc2.asarray(na1)
        a2 = blosc2.asarray(na2)
        a3 = blosc2.asarray(na3)

        expr1 = a1 + a2 - a3
        assert expr1.shape == shapes[0]
        expr2 = a1 * a2 + 1
        assert expr2.shape == shapes[0]
        res = expr1 - getattr(expr2, reduce_op)(axis=axis, keepdims=keepdims)
        assert res.shape == shapes[0]
        # print(f"res: {res.shape} expr1: {expr1.shape} expr2: {expr2.shape}")
        nres = eval(f"na1 + na2 - na3 - (na1 * na2 + 1).{reduce_op}(axis={axis}, keepdims={keepdims})")

        tol = 1e-14 if a1.dtype == "float64" else 1e-5
>       np.testing.assert_allclose(res[:], nres, atol=tol, rtol=tol)
E       AssertionError:
E       Not equal to tolerance rtol=1e-14, atol=1e-14
E
E       Mismatched elements: 934032 / 1000000 (93.4%)
E       Max absolute difference among violations: 201.999901
E       Max relative difference among violations: 1.00660045
E        ACTUAL: array([[[-1.505000e+02, -1.505151e+02, -1.505302e+02, ...,
E                -1.407732e+02, -1.407877e+02, -1.408023e+02],
E               [-1.398068e+02, -1.398214e+02, -1.398359e+02, ...,...
E        DESIRED: array([[[-150.50005 , -150.5151  , -150.530151, ..., -151.960042,
E                -151.975095, -151.990147],
E               [-150.995099, -151.010151, -151.025204, ..., -152.455285,...

tests/ndarray/test_reductions.py:157: AssertionError

Looking at the array, the values are different, it's not just a rounding error.

Failing combination:
python3-3.14.0~b3-2.fc43.x86_64
python3-numpy-2.3.1-1.fc43.x86_64
blosc2-2.19.0-1.fc43.x86_64
python-blosc2-3.5.1-2.fc43.src.rpm
build.log

Working combination:
as above, but with
python3-numpy-2.2.6-2.fc43.x86_64

Also working:
python3-3.13.4-1.fc42.x86_64
python3-numpy-2.2.6-1.fc42.x86_64
blosc2-2.19.0-1.fc43.x86_64
python-blosc2-3.5.1-2.fc43

Failing combination:
python3-3.14.0~b3-2.fc43.x86_64
python3-numpy-2.3.1-1.fc43.x86_64
blosc2-2.19.0-1.fc43.x86_64
python-blosc2-3.3.4-2.fc43.src.rpm
build.log

So it seems that it's something that changed in numpy or the other dependencies, not blosc-python itself. But I have no idea what could cause this, so I was just blindly testing combinations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions