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

Problem linking files for x64 in C#

gregrowe
Beginner
1,230 Views
Hi, I've been using a dll created by using the walkthrough at http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/ to integrate MKL into my application successfully for several months now but have recently needed to add several new functions to it including djacobi. For the x86 dll I managed to find all the libraries I required to successfully build it, however for the x64 build I have not been able to find the library/libraries which I need to link to include djacobi. Any help would be greatly appreciated.

Thanks, Greg.
0 Kudos
1 Solution
Vladimir_Koldakov__I
New Contributor III
1,230 Views

Hi Greg,

Now I see, you are using MKL 10.1 where djacobi is located in the mkl_solver_lp64.lib library.

In my case (MKL 10.2.5) it is located in the mkl_intel_lp64.

Try to add mkl_solver_lp64.lib or use MKL 10.2.5/6.

Thanks,

Vladimir

View solution in original post

0 Kudos
6 Replies
Vladimir_Koldakov__I
New Contributor III
1,230 Views

Hi Greg,


Just include djacobi in the functions list MKLfunctions.lst and rebuild mkl.dll.

To find the required libraries try to use Intel Math Kernel Library Link Line Advisor http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/.

You can find the libraries in the makefile as well:

MKL_LIB="mkl_intel_lp64_dll.lib mkl_intel_thread_dll.lib mkl_core_dll.lib"

Thanks,

Vladimir

0 Kudos
gregrowe
Beginner
1,230 Views
Hi Vladimir,
Thanks for your help, I had already added djacobi to the function list and found to build the x86 version of the dll I had to add "mkl_intel_c.lib mkl_core.lib mkl_solver.lib mkl_intel_thread.lib libiomp5md.lib" to the MKL_LIB parameter in the makefile (following a suggestion I found elsewhere on the forums) so that nmake would not return with a linker exception. Unfortunately I can't add this to the x64 version as there isn't a "mkl_intel_c.lib" library for x64. I tried the link line advisor but its suggested link line still throws a linker exception (user.def : error LNK2001: unresolved external symbol djacobi). If you can think of anything else that could help that would be great.
Thanks, Greg.
0 Kudos
Vladimir_Koldakov__I
New Contributor III
1,230 Views

Hi Greg,

Try to do the following steps.

1. Download Intel_MKL_C#_Examples.zip from the http://software.intel.com/en-us/articles/using-intel-mkl-in-your-c-program/

2. Extract the content into any directory, there are 7 files:

05/27/2009 03:16 PM 9,676 dfti_d1.cs
05/27/2009 03:16 PM 5,117 dgeev.cs
05/27/2009 03:15 PM 4,412 dgemm.cs
08/10/2010 10:54 PM 3,858 makefile
08/10/2010 09:37 PM 222 MKLfunctions.lst
05/27/2009 03:16 PM 9,213 pardiso.cs
05/27/2009 03:16 PM 5,683 vddiv.cs

3. Add djacobi and other names into the MKLfunctions.lst file.

4. In the Visual Studio x64 Command Prompt change the directory to the directory with the extracted files.

5. Type here:

nmake em64t MKLROOT="mkl_root_directory"

where mkl_root_directory is something like C:\Programme\Intel\MKL\10.2.5.035

6. You will see mkl.dll in the same directory. Try to use it.

Thanks,

Vladimir

0 Kudos
gregrowe
Beginner
1,230 Views
Hi Vladimir,

I followed your instructions exactly and received exactly the same error as before :

D:\\Dev\\MKLTemp>nmake em64t MKLROOT="D:\\Program Files\\Intel\\MKL\\10.1.1.022"

Microsoft Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.

Add path of the MKL libraries to the lib environment variable
set lib=%MKLROOT%\em64t\lib;%lib%
MKL entries for custom dll
Workaround for pardiso
Microsoft C/C++ Optimizing Compiler Version 15.00.30729.01 for x64
Copyright (C) Microsoft Corporation. All rights reserved.

_fseeki64.c
Build MKL custom dll
nmake mkl.dll MACHINE=AMD64 MKL_LIB="mkl_intel_lp64_dll.lib mkl_intel_thread_dll.lib mkl_core_dll.lib" MSLIB=user32.lib

Microsoft Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.

link /DLL /MACHINE:AMD64 /def:user.def _fseeki64.obj mkl_intel_lp64_dll.lib mkl_intel_thread_dll.lib mkl_core_dll.lib libiomp5md.lib user32.lib /out:mkl.dll
Microsoft Incremental Linker Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.

user.def : error LNK2001: unresolved external symbol djacobi
mkl.lib : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\link.EXE"' : return code '0x460'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\nmake.EXE"' : return code '0x2'
Stop.

I'm fairly sure the only problem is that djacobi isn't in mkl_intel_lp64_dll.lib, mkl_intel_thread_dll.lib, mkl_core_dll.lib or libiomp5md.lib and we need to add the library it is in unfortunately I have no idea which library contains djacobi. Any further help would be great.

Thanks, Greg.
0 Kudos
Vladimir_Koldakov__I
New Contributor III
1,231 Views

Hi Greg,

Now I see, you are using MKL 10.1 where djacobi is located in the mkl_solver_lp64.lib library.

In my case (MKL 10.2.5) it is located in the mkl_intel_lp64.

Try to add mkl_solver_lp64.lib or use MKL 10.2.5/6.

Thanks,

Vladimir

0 Kudos
gregrowe
Beginner
1,230 Views
Hi Vladimir,

Thanks very much that worked perfectly.

Greg.
0 Kudos
Reply