Speed of Matrix Math Solving Ax=B MKL vs Managed


#1

Deleted, i no longer wish to discuss this openly.


(Christoph Rüegg) #4

Why not? It seems this would have been interesting for the project.


#5

I think the title still stands, I couldn’t see much difference using MKL or not in the speed for these relatively small matrices. Re the alternative solution for tri-diagonals with offband elements, I might start a new topic. There is definitely a much faster solution method, but so far I haven’t got it working reliably, the method I developed became unstable for larger matrices. The original Hofeling and Seader method simply doesn’t seem to work for some cases, although it could just be a typing error somewhere in the paper. At this point i have nothing working reliably (although when it does work its a lot faster).

I might come back to this and if I can get it working, start a new topic.


#6

Some stats, might be useful for somebody,

Solving a 28x28 tridiagonal matrix 10000 times gives the following results.

MathNet.Numerics.Control.UseNativeMKL(); //176 ms
MathNet.Numerics.Control.UseNativeOpenBLAS(); // 1627 ms
MathNet.Numerics.Control.UseManaged(); // 162 ms

The managed code actually appeared typically the fastest option but the NativeMKL code was virtually the same. OpenBlas however was incredibly slow.


(Christoph Rüegg) #7

Thanks!

I’ve also done quite a bit of benchmarking lately. For smaller dense matrices the managed implementation can indeed be faster. If we can determinate a suitable matrix size threshold, it could be an option to have the MKL provider bypass to the managed one on sizes below the threshold. But I also need to review the provider implementation, I expect there are some options to avoid some of the marshaling cost.