- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am having a terrible time setting up Intel's Math Kernel for Visual C#. I have downloaded and ran the install file with no luck of accessing the Math Kernel Functions inside of the mkl.dll file. When I implement one of mkl.dll functions a BadImageFormatException is thrown. Online documentations instructs you to go through the visual studio command prompt and call:
"mklvars.bat" ia32 nmake ia32
When I run this throught the shell mklvars.bat ia32 is accepted and nmake ia32 throws and it throws an error within the command prompt.
I tried using the MKL_Link_Tool.exe with the following result and still receive the bad image exception:
Code:
class Program { static class MKL { [DllImport("mkl.dll", CallingConvention = CallingConvention.Cdecl)] internal static extern int DftiCreateDescriptor(ref IntPtr desc, int precision, int domain, int dimention, int length); } [STAThread] static void Main(string[] args) { IntPtr pnt = new IntPtr(32); try { Console.Write(MKL.DftiCreateDescriptor(ref pnt, 1, 1, 10, 10) + ""); } catch (BadImageFormatException ex) { Debug.WriteLine(ex.Message); } } } }
I can't figure out how to use Intel's Math Kernel Library with Visual Studio... Can anyone help me set up MKL (escpicially the BLAS and LA packages) Thank you.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Assuming that you have downloaded and extracted the three zip files at https://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program?wapkw=mkl%20c%23, before running "nmake ia32" on a 64-bit system you have to set the environment variable CSCOPTS=/platform:x86 (to receive this information, run the command nmake help).
To do the same from Visual Studio, from the IFort command window run devenv, and create a new C# console project, add the C# source code to the project, select the configuration and build.
Note that the examples are all set up to run, output results to the console and quit, so you may want to put a breakpoint at the last source line of Main before running each program.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Michael,
If possible, could you please use dependency walker to detect if all dlls are founded. as the article described
In order to avoid the dynamic library environment check, you may first to try mkl_intel_c.lib mkl_sequential.lib mkl_core.lib. which is static library and sequential library. then try other configuration.
Best Regards,
Ying

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page