Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6956 Discussions

Intel MKL 10.3 with C# 32-bit and 64-bit

Mullins__Brian
Beginner
1,315 Views

I am using Intel MKL 10.3 with Visual Studio 2010 and Windows 7 (64-bit). I am trying to use the MKL functions in my C# code. I need to create 32-bit and 64-bit versions of my C# program.
I followed the instructions under the heading Building the Examples with IntelMKL 10.3athttp://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program. I was able to successfully execute the command nmake intel64 MKLREDIST="c:\\Program Files\\Intel\\ComposerXE-2011\\redist" from both the Visual Studio Command Prompt (2010) and Visual Studio x64 Win64 Command Prompt (2010), however, I when I tried to execute nmake ia32 MKLREDIST="c:\\Program Files\\Intel\\ComposerXE-2011\\redist" from either prompt...I got the following error:
C:\\Program Files (x86)\\Intel\\ComposerXE-2011\\mkl\\tools\\builder>nmake ia32 MKLREDIST="C:\\Program Files (x86)\\Intel\\ComposerXE-2011\\redist" Microsoft Program Maintenance Utility Version 10.00.30319.01 Copyright (C) Microsoft Corporation. All rights reserved. set Lib=..\\..\\lib\\ia32;%Lib%;;..\\..\\..\\compiler\\lib\\ia32 type functions_list >> user_def_file.def Microsoft Library Manager Version 10.00.40219.01 Copyright (C) Microsoft Corporation. All rights reserved. Microsoft Library Manager Version 10.00.40219.01 Copyright (C) Microsoft Corporation. All rights reserved. link /DLL /MANIFEST /MACHINE:IX86 /NODEFAULTLIB /def:user_def_file.def .\\temp_cdll\\*.obj mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib msvcrt.lib kernel32.lib user32.lib bufferoverflowu.lib /out:mkl_custom.dll Microsoft Incremental Linker Version 10.00.40219.01 Copyright (C) Microsoft Corporation. All rights reserved. LINK : fatal error LNK1181: cannot open input file 'bufferoverflowu.lib' NMAKE : fatal error U1077: '"c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\BIN\\link.EXE"' : return code '0x49d' Stop.
The strange thing about this whole situation is that I am able to compile and execute a 32-bit version of my C# program without any issues; however, when I compile and run the 64-bit version, I get the following run-time error:
The program '[6568] IntelMKL.vshost.exe: Managed (v4.0.30319)' has exited with code 1 (0x1).
Can anyone help me figure out what I need to do to use Intel MKL 10.3 with 32- and 64-bit versions of my C# program? Thanks!
0 Kudos
1 Solution
5 Replies
Gennady_F_Intel
Moderator
1,315 Views
1)
##------------------------------------------------------------------------------
## if you get the message:
## LINK : fatal error LNK1181: cannot open input file 'bufferoverflowu.lib'
##------------------------------------------------------------------------------
## add option 'buf_lib=' or comment the line below
buf_lib = bufferoverflowu.lib
##------------------------------------------------------------------------------## if you get the message:## LINK : fatal error LNK1181: cannot open input file 'bufferoverflowu.lib'##------------------------------------------------------------------------------## add option 'buf_lib=' or comment the line belowbuf_lib = bufferoverflowu.lib
0 Kudos
Gennady_F_Intel
Moderator
1,315 Views
see also this KB describing using mkl with .net environment
0 Kudos
Mullins__Brian
Beginner
1,315 Views
Hi Gennady,

Thank you very much for responding to my question. I have been referring to the link that you provided...unless I'm missing something, it doesn't address the problems that I'm experiencing. I just tried to re-run the "ia32" version of the nmake command today and now I'm getting a different error:
C:\Users\poibri01\Desktop\Intel_MKL_C#_Examples_03>nmake ia32 MKLREDIST="C:\Program Files (x86)\Intel\ComposerXE-2011\redist" Microsoft Program Maintenance Utility Version 10.00.30319.01 Copyright (C) Microsoft Corporation. All rights reserved. Add path of the MKL redistributable to the path environment variable set path=%MKLREDIST%\ia32\mkl;%MKLREDIST%\ia32\compiler;%path% Build and run examples nmake /a dgemm.exe dgeev.exe dfti_d1.exe pardiso.exe vddiv.exe mkl_dcscmv.exe Microsoft Program Maintenance Utility Version 10.00.30319.01 Copyright (C) Microsoft Corporation. All rights reserved. Compile dgemm.cs csc .\dgemm.cs Microsoft Visual C# 2010 Compiler version 4.0.30319.1 Copyright (C) Microsoft Corporation. All rights reserved. Run dgemm example dgemm.exe MKL cblas_dgemm example alpha=1 beta=-1 Matrix A 1 2 3 4 5 6 Matrix B 0 1 0 1 1 0 0 1 1 0 1 0 Initial C 5 1 3 3 11 4 6 9 Unhandled Exception: System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) at mkl.CBLASNative.cblas_dgemm(Int32 Order, Int32 TransA, Int32 TransB, Int32 M, Int32 N, Int32 K, Double alpha, Double[] A, Int32 lda, Double[] B, Int32 ldb, Double beta, Double[] C, Int32 ldc) at test_dgemm.Main(String[] args) NMAKE : fatal error U1077: '.\dgemm.exe' : return code '0xe0434352' Stop. NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\amd64\nmake.EXE"' : return code '0x2' Stop.

Just to summarize my situation:

  1. I am using Visual Studio 2010 with Intel MKL 10.3 and Windows 7 (64-bit).
  2. The following paths are in my PATH environment variable:
    C:\Program Files (x86)\Intel\ComposerXE-2011\redist\ia32; C:\Program Files (x86)\Intel\ComposerXE-2011\redist\intel64; C:\Program Files (x86)\Intel\ComposerXE-2011\redist\ia32\compiler; C:\Program Files (x86)\Intel\ComposerXE-2011\redist\intel64\compiler; C:\Program Files (x86)\Intel\ComposerXE-2011\mkl\lib\ia32; C:\Program Files (x86)\Intel\ComposerXE-2011\mkl\lib\intel64
  3. I am able to run the "intel64" version of the nmake command from both the "Visual Studio Command Prompt (2010)" and the "Visual Studio x64 Win64 Command Prompt (2010)":
    nmake intel64 MKLREDIST="C:\Program Files (x86)\Intel\ComposerXE-2011\redist"
  4. I am NOT able to run the "ia32" version of the nmake command from either command prompt:
    nmake ia32 MKLREDIST="C:\Program Files (x86)\Intel\ComposerXE-2011\redist"
  5. I am able to compile and run a 32-bit version of my C# program using the MKL functions.
  6. I get a runtime error when I run a 64-bit version of my C# program:
    The program '[3640] IntelMKL.vshost.exe: Managed (v4.0.30319)' has exited with code 1 (0x1).
0 Kudos
Mullins__Brian
Beginner
1,315 Views

@mecej4: Thank you very much for your help...after following your suggestion to use the makefile inside "Intel_MKL_C#_Examples_02.zip" I was able to successfully compile and run both versions (32-bit and 64-bit) of my C# program. This is a huge relief...I spent hours trying to get this to work.Again, I really appreciate all your time and help. I wish you the very best! =)

0 Kudos
Reply