Quansight-Labs/numpy.net

SIMD

Opened this issue · 3 comments

I had see that there have some SIMD test,but i want to know how to use SIMD in numpy.net.at the same time,I find that the preformance of Vector is lowest than Math.net ,how to improve that?

It has been a long time since I looked at adding SIMD to NumpyDotNet. I do have a test application named SIMDTesterApp to experiment to see what kind of performance improvement I might be able to get. I am definitely not an expert in SIMD, and I may have been doing it wrong, but here is what I remember about it.

  1. It is only available in .NET standard 2.1 and above. I have been building for .NET standard 2.0 to cover all portability.
  2. The performance improvement was not very significant (5%), especially for 64-bit data items (long, doubles). From memory, 32-bit values improved about 20%, and 16-bit values about 50%. There is a significant amount of setup involved in setting up the Vector objects which impacts the overall performance.
  3. SIMD works best the data are in a contiguous array. This is not always the case in Numpy. A sliced array is not contiguous.

If you have some good experience with .NET SIMD and can show me a better way than my test application, I will take another look at implementing it in NumpyDotNet.

FYI, I just ran the SIMDTesterApp, it appears that SIMD operations might actually be slower in most cases. But I could be doing something wrong.

To summarize, I am not using SIMD in NumpyDotNet.

I noticed that when constructing a program on dynamics, the point product and forks of a ternary vector were calculated frequently, but I noticed that slicing or matrix multiplication was frequently used and seemed to be less efficient than Math.net. One recommendation is to want numpy.net to support MKL. Also, I want the program to support Net core 8.0 and above. I intend to participate in the development of the software in the future. My idea is to separate the matrix and vector, and keep the same for the higher order matrix. At the same time, I want to introduce the interpolation function of high-dimensional matrix, which is very important for some industries. Thank you very much for providing this package. This work is very eye-catching and interesting, and it is very helpful to me. Thank the developer again.

I am the primary developer. I welcome your help. Thank you.