Skip to content

BUG: Unusual test failures (whitespace-related?) on ppc32 with numpy-1.25.1 #24239

Closed

Description

@thesamesam

Describe the issue:

I get several more test failures with numpy-1.25.1 than I do with numpy-1.24.4 on ppc32:

  • numpy-1.24.4: 15 failed, 25832 passed, 883 skipped, 31 xfailed, 7 xpassed, 387 warnings
  • numpy-1.25.1: 71 failed, 34200 passed, 931 skipped, 31 xfailed, 6 xpassed, 709 warnings

It's worth noting that we've switched prematurely to building with Meson in Gentoo for 1.25.x, although I hope that's not relevant for this bug.

What's especially interesting is that a bunch of the failures seem to be whitespace related in TestArray2String.

There are some other errors in the log as well which look endianness related. Some of these aren't new to us (see https://bugs.gentoo.org/707116, #11831, #12638).

Reproduce the code example:

I've only reproduced this via the numpy test suite.

Error message:

I get the following test failures with numpy-1.25.1:

FAILED core/tests/test_defchararray.py::TestOperations::test_mod - AssertionError: 
FAILED core/tests/test_api.py::test_array_array - AssertionError: 
FAILED core/tests/test_arrayprint.py::TestArrayRepr::test_subclass - AssertionError: 
FAILED core/tests/test_arrayprint.py::TestArrayRepr::test_0d_object_subclass - AssertionError: 
FAILED core/tests/test_arrayprint.py::TestArray2String::test_basic - AssertionError
FAILED core/tests/test_arrayprint.py::TestArray2String::test_structure_format_int - AssertionError: 
FAILED core/tests/test_arrayprint.py::TestArray2String::test_edgeitems_kwarg - AssertionError: 
FAILED core/tests/test_arrayprint.py::TestArray2String::test_summarize_2d - AssertionError: 
FAILED core/tests/test_arrayprint.py::TestArray2String::test_linewidth - AssertionError: 
FAILED core/tests/test_arrayprint.py::TestPrintOptions::test_precision_zero - AssertionError: 
FAILED core/tests/test_arrayprint.py::TestPrintOptions::test_formatter - AssertionError: 
FAILED core/tests/test_arrayprint.py::TestPrintOptions::test_formatter_reset - AssertionError: 
FAILED core/tests/test_arrayprint.py::TestPrintOptions::test_0d_arrays - AssertionError: 
FAILED core/tests/test_arrayprint.py::TestPrintOptions::test_legacy_stray_comma - AssertionError: 
FAILED core/tests/test_arrayprint.py::TestPrintOptions::test_dtype_linewidth_wrapping - AssertionError: 
FAILED core/tests/test_arrayprint.py::TestPrintOptions::test_linewidth_repr - AssertionError: 
FAILED core/tests/test_arrayprint.py::TestPrintOptions::test_linewidth_str - AssertionError: 
FAILED core/tests/test_arrayprint.py::TestPrintOptions::test_edgeitems - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[B-U] - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[H-S] - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[H-U] - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[I-S] - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[I-U] - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[L-S] - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[L-U] - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[Q-S] - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[Q-U] - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[P-S] - AssertionError: 
FAILED core/tests/test_overrides.py::TestNDArrayMethods::test_repr - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[P-U] - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[e-S] - AssertionError: 
FAILED core/tests/test_records.py::TestFromrecords::test_recarray_repr - AssertionError: 
FAILED core/tests/test_records.py::TestFromrecords::test_0d_recarray_repr - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[e-U] - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[f-S] - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[f-U] - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[d-S] - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[d-U] - AssertionError: 
FAILED core/tests/test_shape_base.py::TestConcatenate::test_concatenate_axis_None - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[g-S] - AssertionError: 
FAILED core/tests/test_numeric.py::TestCreationFuncs::test_full - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[g-U] - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[F-S] - AssertionError: 
FAILED core/tests/test_numeric.py::TestStringFunction::test_set_string_function - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[F-U] - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[D-S] - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[D-U] - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[G-S] - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[G-U] - AssertionError: 
FAILED ma/tests/test_core.py::TestMaskedArray::test_basic0d - AssertionError: 
FAILED ma/tests/test_core.py::TestMaskedArray::test_str_repr - AssertionError: 
FAILED ma/tests/test_core.py::TestMaskedArray::test_str_repr_legacy - AssertionError: 
FAILED matrixlib/tests/test_defmatrix.py::TestProperties::test_repr - AssertionError
FAILED matrixlib/tests/test_interaction.py::test_array_equal_error_message_matrix - AssertionError: 
FAILED polynomial/tests/test_printing.py::TestRepr::test_polynomial_str - AssertionError: 
FAILED polynomial/tests/test_printing.py::TestRepr::test_chebyshev_str - AssertionError: 
FAILED polynomial/tests/test_printing.py::TestRepr::test_legendre_repr - AssertionError: 
FAILED polynomial/tests/test_printing.py::TestRepr::test_hermite_repr - AssertionError: 
FAILED polynomial/tests/test_printing.py::TestRepr::test_hermiteE_repr - AssertionError: 
FAILED testing/tests/test_utils.py::TestAlmostEqual::test_error_message - AssertionError: 
FAILED f2py/tests/test_kind.py::TestKind::test_int - AssertionError: selectedintkind(19): expected 16 but got -1
FAILED core/tests/test_multiarray.py::TestDtypedescr::test_structured_non_void - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[b-U] - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[h-S] - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[i-S] - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[i-U] - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[l-S] - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[q-S] - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[p-S] - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[p-U] - AssertionError: 
FAILED core/tests/test_nditer.py::test_iter_copy_casts[B-S] - AssertionError: 
======================================================== 71 failed, 34200 passed, 931 skipped, 31 xfailed, 6 xpassed, 709 warnings in 470.58s (0:07:50) ========================================================
 * ERROR: dev-python/numpy-1.25.1-r1::gentoo failed (test phase):
 *   pytest failed with python3.11

Full log (xz-compressed): https://bugs.gentoo.org/attachment.cgi?id=866019.



### Runtime information:

1.25.1
3.11.4 (main, Jul  5 2023, 00:34:18) [GCC 13.1.1 20230527]

### Context for the issue:

- Downstream Gentoo bug: https://bugs.gentoo.org/910739
- This affects us deploying newer versions of Numpy. Dropping Numpy on an architecture means dropping a very large number of packages, as it's often needed as a direct dependency if not as a test dependency.

Activity

  1. seberg commented on Jul 23, 2023

    @seberg
    Member

    Using meson does very much not seem advisable at all, assuming it works, you still should get a slower than wanted build.

    The main failure I see seem to me thing like:

    a = np.zeros(5, dtype="S5)
    a[0] = 3  # even this probably fails
    print(a.tobytes())  # lets see what got stored (side-step oppisite direction)
    
    # if that works, try:
    np.copyto(a, 3)
    print(a.tobytes()) 
    

    Can you check if the first and/or second fail?

    I suppose it would have to be related with the PPC32 platform somehow, but not sure where to look.

  2. thesamesam commented on Jul 23, 2023

    @thesamesam
    ContributorAuthor

    wrt meson: yeah, that's fine, we've already filed a bunch of bugs for things. Having Meson makes life a lot easier for us because of the hacks needed for distutils to get cross working. We've already discussed it w/ Ralf (not saying he loves it, but he's aware).

    The main failure I see seem to me thing like:

    a = np.zeros(5, dtype="S5)
    a[0] = 3  # even this probably fails
    print(a.tobytes())  # lets see what got stored (side-step oppisite direction)
    
    

    b'3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'

    if that works, try:

    np.copyto(a, 3)
    print(a.tobytes())

    b'1\x00\x00\x00\x001\x00\x00\x00\x001\x00\x00\x00\x001\x00\x00\x00\x001\x00\x00\x00\x00'

  3. seberg commented on Jul 23, 2023

    @seberg
    Member

    Hummm, well, the second is nonense, its filling in 1 not 3. Although it should end up doing much the same code path internally, unless string to string copies are broken 🤔.

    But first let's see, does this part work? (i.e. the first step, converting the NumPy 3 to the right string). That seems more likely to be wrong then:

    s = np.int_(3)
    print(repr(s))
    print(s)
    a = np.array(3)[()]
    print(s)
    
  4. thesamesam commented on Jul 23, 2023

    @thesamesam
    ContributorAuthor
    ppc32-testing ~ # cat /tmp/foo2.py
    import numpy as np
    
    s = np.int_(3)
    print(repr(s))
    print(s)
    a = np.array(3)[()]
    print(s)
    
    ppc32-testing ~ # python /tmp/foo2.py
    1
    1
    1

    Huh!

  5. seberg commented on Jul 23, 2023

    @seberg
    Member

    OK. that was helpful, thanks.

    @mattip another oversight in gh-23746 from everyone glancing at the code, although I am very surprised that this could fly under the radar long enough?!

    I suppose it hits seriously only on a big-endian machine that also has a "weird" size for C long...

    @thesamesam if you want to look at that, the casts in that PR are clearly wrong mixing bit-sized names with C names.

  6. added this to the 1.25.2 release milestone on Jul 23, 2023
  7. thesamesam commented on Jul 23, 2023

    @thesamesam
    ContributorAuthor

    Many thanks for your help! Let me give that a whack.

  8. seberg commented on Jul 24, 2023

    @seberg
    Member

    @thesamesam could you also post the last remaining (clear) error you are seeing, or maybe just create a new issue?

  9. added a commit that references this issue on Jul 25, 2023
    d9c0c96
  10. added a commit that references this issue on Jul 30, 2023
    8a731a5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions