Skip to content

BUG: Very slow execution of linalg.inv on intel ultra 7 #27174

@jankoslavic

Description

@jankoslavic

Describe the issue:

I am testing this code:

import numpy as np
a = np.random.rand(1000, 1000)
ainv = np.linalg.inv(a)

on an Intel ultra 7 processor (155H).
This should take approx 30-50ms, but it takes 12000ms on numpy 1.26.4 or 2.0 (using pip install numpy). This is really crazy slow!!!

If I unstalled the version 1.26.3 with MKL support from Gohlke:
https://github.com/cgohlke/numpy-mkl-wheels/releases/tag/v2024.1.3
the timing was appox 2000ms, whic is still 100x more than normal.

If I installed Anaconda (which I do not prefer), I have reached 30-50ms.

I am doing anything wrong?

Reproduce the code example:

import numpy as np
a = np.random.rand(1000, 1000)
ainv = np.linalg.inv(a)

Error message:

No response

Python and NumPy Versions:

1.26.3
3.12.5 (tags/v3.12.5:ff3bc82, Aug 6 2024, 20:45:27) [MSC v.1940 64 bit (AMD64)]

Runtime Environment:

[{'numpy_version': '1.26.4',
'python': '3.12.5 (tags/v3.12.5:ff3bc82, Aug 6 2024, 20:45:27) [MSC v.1940 '
'64 bit (AMD64)]',
'uname': uname_result(system='Windows', node='Spectre-JS', release='11', version='10.0.22631', machine='AMD64')},
{'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'],
'found': ['SSSE3',
'SSE41',
'POPCNT',
'SSE42',
'AVX',
'F16C',
'FMA3',
'AVX2'],
'not_found': ['AVX512F',
'AVX512CD',
'AVX512_SKX',
'AVX512_CLX',
'AVX512_CNL',
'AVX512_ICL']}},
{'architecture': 'Haswell',
'filepath': 'C:\Users\janko\AppData\Local\Programs\Python\Python312\Lib\site-packages\numpy.libs\libopenblas64__v0.3.23-293-gc2f4bdbb-gcc_10_3_0-2bde3a66a51006b2b53eb373ff767a3f.dll',
'internal_api': 'openblas',
'num_threads': 22,
'prefix': 'libopenblas',
'threading_layer': 'pthreads',
'user_api': 'blas',
'version': '0.3.23.dev'}]

Context for the issue:

Matrix inversion is essential to me. Such slow inversion makes my code unusable or I have to go for Anaconda.

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