Description
Describe the issue:
When attempting to use an ndarray
method (like min()
) with an invalid subscripted array, the returning value is not repeatable when Numpy is compiled with GNU and Intel Classic compilers (note that Intel LLVM compilers behave like GNU). With Intel, the returning value is NaN, with GNU, it is the expected result.
Reproduce the code example:
import numpy as np
rows = np.asarray([0, 0])
val = np.asarray([0.11])
print(val[rows].min()) # Returns 0.11 with GNU and LLVM, NaN with Intel Classic
Error message:
N/A in both cases
Python and NumPy Versions:
Numpy: 1.25.2
Python: 3.11.7 (main, Aug 29 2024, 15:22:52) [GCC Intel(R) C++ gcc 9.2 mode]
Note that this is repeatable on other systems with different versions of gcc
Runtime Environment:
Compiled via spack.
[{'numpy_version': '1.25.2',
'python': '3.11.7 (main, Aug 29 2024, 15:22:52) [GCC Intel(R) C++ gcc 9.2 '
'mode]',
'uname': uname_result(system='Linux', node='hfe02', release='4.18.0-553.22.1.el8_10.x86_64', version='#1 SMP Wed Sep 25 09:20:43 UTC 2024', machine='x86_64')},
{'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'],
'found': ['SSSE3',
'SSE41',
'POPCNT',
'SSE42',
'AVX',
'F16C',
'FMA3',
'AVX2',
'AVX512F',
'AVX512CD',
'AVX512_SKX'],
'not_found': ['AVX512_KNL',
'AVX512_CLX',
'AVX512_CNL',
'AVX512_ICL']}},
{'architecture': 'Haswell',
'filepath': '/scratch1/NCEPDEV/global/David.Huber/SPACK/ss_matplotlib/envs/matplotlib_intel/install/intel/2021.5.0/openblas-0.3.24-tmyu6qy/lib/libopenblas-r0.3.24.so',
'internal_api': 'openblas',
'num_threads': 1,
'prefix': 'libopenblas',
'threading_layer': 'disabled',
'user_api': 'blas',
'version': '0.3.24'}]
Context for the issue:
Found while debugging matplotlib/matplotlib#28762