NumCpp icon indicating copy to clipboard operation
NumCpp copied to clipboard

Does NumCpp generates vectorized instructions (AVX512)?

Open IshaanKarnik opened this issue 3 years ago • 2 comments

Does NumCpp generates vectorized instructions (e.g. AVX512) after compiling with proper flags?

NumPy is able to leverage performance benefits from SIMD (vectorized) instruction set as per this link.

IshaanKarnik avatar Dec 02 '22 23:12 IshaanKarnik

I'd like to know the answer too.

I'm considering putting NumCpp into production. And I'm facing a situation where performance really matters.

And also, does this project welcome PRs? What instructions should I follow if I want to contribute?

SnowWalkerJ avatar Feb 13 '25 13:02 SnowWalkerJ

The short answer is that the NumCpp library does not do anything special to assure vectorized instructions are generated. The element-wise operations are for the most part built on top of the standard <algorithm> algorithms. If you compile with the NUMCPP_USE_MULTITHREAD option then they will default to using the std::par_unseq execution policy. So depending on your compiler and standard library implementation it can/may generate vectorized instructions.

dpilger26 avatar Feb 27 '25 19:02 dpilger26