Using Intel® Math Kernel Library and Intel® Integrated Performance Primitives in the Microsoft* .NET* Framework

Intel® Performance Libraries such as Intel® MKL and Intel® IPP are unmanaged code libraries. They are written in native programming languages and compiled to machine code which can run on a target computer directly. This article is intended to educate Intel® MKL and Intel® IPP users on the basics of calling these libraries from .NET Framework languages such as C#.

To download complete article click here -  323195-001US.pdf


About the Author

Naveen Gv is a Technical Consulting Engineer (TCE) in the performance library team. At Intel he has specialized on Multi-core programming, Intel Performance Primitives and Intel Math Kernel Library. His professional interests are teaching Multi core Programming Methodology to software community and implementing Digital Signal Processing algorithms on x86 platform. Naveen has worked with several universities across Asia Pacific to implement Multi-Core programming in academia. His e-mail address is naveen.gv at intel.com

For more complete information about compiler optimizations, see our Optimization Notice.

3 comments

Top
trombif's picture

Very interesting paper on how you can deal with automatic or manual pinning...
I am actually using mkl in a C# project, to make it as simple as possible, I chose automatic pinning. Problem is results in using DSYEV function (for eigen values/vectors) are not totally reproductible (my matrix is about 500x500), there are few differences, but there are some ...
I am actually evaluating mkl 10.3 (last one), using mkl_rt.dll provided in folder. I red something about 16-byte boundaries : some told me to use mkl_malloc but I can't make it work ...
Examples provided for C# and mkl do not deal with this issue ... (I am using VS 2008, maybe in VS 2010, objetcs are automatically 16-bytes aligned?)

Any idea ?
Thank you very much !

Rave Rcihter's picture

Because the IPPs are written in native code that translates into machine code (x86 Intel syntax), a wrapper can for the bridge between the unmanaged code and and the managed C#. In .NET, the System.Runtime.InteropServices namespace contains classes that have methods that can easily call native C Dlls and therefore other system functions. If you are a .NET Framework C# programmer, then you know that when you work with unmanaged code --whether it's COM or native libraries written in C++ -- there is a type system gap that must be bridged. For example a string to the .NET Framework is not the same thing as a string in C++. C++ works sometimes with pointers, while C# works with object references. In C++, the closest thing to an object reference is void*. Marshaling performs the transformations to the bits so that data instances can used on both sides of the fence. Because marshaling creates extra overhead, the IPPs can ease that cost and help to bridge that disconnect.

Gennady F. (Intel)'s picture

For those whom are interesting, please look at the article ( http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/).
You can find there some examples show how to call dfti, blas level3, lapack, pardiso and vml routines in your C# program.
--Gennady

Add a Comment

Have a technical question? Visit our forums. Have site or software product issues? Contact support.