8000 BUG: TestLstsqMatrix, residuals not calculated properly for square tests · Issue #29851 · numpy/numpy · GitHub 8000
[go: up one dir, main page]

Skip to content

BUG: TestLstsqMatrix, residuals not calculated properly for square tests #29851

@bwhitt7

Description

@bwhitt7

Describe the issue:

When running numpy/matrixlib/tests/test_matrix_linalg.py in parallel threads (see #29552 for more information about running tests in parallel), in the TestLstsqMatrix class, the tests test_sq_cases and test_empty_sq_cases will occasionally fail.

Looking at the error messages, it looks like the residuals for these square tests are not being calculated properly when ran under parallel threads.

Reproduce the code example:

pip install pytest-run-parallel
spin test numpy/matrixlib/tests/test_matrix_linalg.py::TestLstsqMatrix -- --parallel-threads=auto

Error message:

Large traceback, link to gist: https://gist.github.com/bwhitt7/fba632611b3b5cd127190d47eee34cb0

Python and NumPy Versions:

Python: 3.14.0rc3+ free-threading build
NumPy: 2.4.0.dev

Runtime Environment:

[{'numpy_version': '2.4.0.dev0+git20250930.0f46b6e',
  'python': '3.14.0rc3+ free-threading build (heads/3.14:c76fd771b5c, Sep 25 '
            '2025, 10:25:46) [GCC 13.3.0]',
  'uname': uname_result(system='Linux', node='SPACE', release='6.6.87.2-microsoft-standard-WSL2', version='#1 SMP PREEMPT_DYNAMIC Thu Jun  5 18:30:46 UTC 2025', machine='x86_64')},
 {'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'],
                      'found': ['SSSE3',
                                'SSE41',
                                'POPCNT',
                                'SSE42',
                                'AVX',
                                'F16C',
                                'FMA3',
                                'AVX2'],
                      'not_found': ['AVX512F',
                                    'AVX512CD',
                                    'AVX512_KNL',
                                    'AVX512_KNM',
                                    'AVX512_SKX',
                                    'AVX512_CLX',
                                    'AVX512_CNL',
                                    'AVX512_ICL',
                                    'AVX512_SPR']}},
 {'architecture': 'Haswell',
  'filepath': '/usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so',
  'internal_api': 'openblas',
  'num_threads': 24,
  'prefix': 'libopenblas',
  'threading_layer': 'pthreads',
  'user_api': 'blas',
  'version': '0.3.26'}]

Context for the issue:

I'm working on making the NumPy test suite more thread safe and exposing thread safety issues like this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0