Skip to content

BUG: numpy.linalg.matrix_rank brings different results on two devices #28716

@0x1abcd

Description

@0x1abcd

Describe the issue:

numpy.linalg.matrix_rank brings different results, when running on two devices with the same NumPy version.
I'm curious as to why this is happening?

Reproduce the code example:

import numpy as np

print(np.linalg.matrix_rank(np.array([[1.0,1.0],[1.0,1.0]]),tol=0.0))

Error message:

Device 1 result:
1

Device 2 result:
2

Python and NumPy Versions:

Device 1 :
2.2.3
3.10.0 (default, Mar 3 2022, 09:58:08) [GCC 7.5.0]

Device 2 :
2.2.3
3.10.12 (main, Feb 4 2025, 14:57:36) [GCC 11.4.0]

Runtime Environment:

Device 1 :
[{'numpy_version': '2.2.3',
'python': '3.10.0 (default, Mar 3 2022, 09:58:08) [GCC 7.5.0]',
'uname': uname_result(system='Linux', node='zzz', release='5.15.167.4-microsoft-standard-WSL2', version='#1 SMP Tue Nov 5 00:21:55 UTC 2024', 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']}},
{'architecture': 'Haswell',
'filepath': '/home/jacin/anaconda3/envs/llm4api/lib/python3.10/site-packages/numpy.libs/libscipy_openblas64_-6bb31eeb.so',
'internal_api': 'openblas',
'num_threads': 18,
'prefix': 'libscipy_openblas',
'threading_layer': 'pthreads',
'user_api': 'blas',
'version': '0.3.28'}]

Device 2 :
[{'numpy_version': '2.2.3',
'python': '3.10.12 (main, Feb 4 2025, 14:57:36) [GCC 11.4.0]',
'uname': uname_result(system='Linux', node='xxx', release='6.11.0-19-generic', version='#19~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Feb 17 11:51:52 UTC 2', machine='x86_64')},
{'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'],
'found': ['SSSE3',
'SSE41',
'POPCNT',
'SSE42',
'AVX',
'F16C',
'FMA3',
'AVX2',
'AVX512F',
'AVX512CD',
'AVX512_SKX',
'AVX512_CLX',
'AVX512_CNL',
'AVX512_ICL'],
'not_found': ['AVX512_KNL', 'AVX512_KNM']}},
{'architecture': 'SkylakeX',
'filepath': '/usr/local/lib/python3.10/dist-packages/numpy.libs/libscipy_openblas64_-6bb31eeb.so',
'internal_api': 'openblas',
'num_threads': 16,
'prefix': 'libscipy_openblas',
'threading_layer': 'pthreads',
'user_api': 'blas',
'version': '0.3.28'}]

Context for the issue:

No response

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