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

Custom MKL dll

Gottkehaskamp
Beginner
3,047 Views

Hi,

I try to create (my firts time) with the example project ...\tools\builder\MSVS_Projects\VS2019\libintel64
a custom MKL dll. Although the function DGETRF is listed in the "example.def", the linker for my app reports:


1>LinEq_arm.obj : error LNK2001: unresolved external symbol dgetrf_

 

In the created lp64_sequential.lib you can identify the function DGETRF with a text editor.

I have also tried this with other functions from the linker's "unresolved external" list. Always the same negative result. The linker finds the lp64_sequential.lib and read from it. Do the linker needs more information?


Does anyone have any idea what could be wrong?

 

Best regards,

Raimund

 

0 Kudos
1 Solution
Ruqiu_C_Intel
Moderator
2,330 Views

Glad to know it works.


This issue is closing and we will no longer respond to this thread. If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only. 



View solution in original post

0 Kudos
19 Replies
ShanmukhS_Intel
Moderator
3,016 Views

Hi,


Thank you for posting in Intel communities. It seems the issue is from Visual Studio or the way libraries being linked(some dependent libraries might be missing). 


We would like to recommend you to try linking using Intel oneAPI command prompt and check if issue persists. We could see that DGETRF functionality is available 

in ..\tools\builder\lapack_cdecl_example_list and ..\tools\builder\user_example_list (user_example_list is used to to create custom dll based on functionalities provided in that file)


We have tried creating a mkl_custom.dll using command prompt and we could see that mkl_custom.dll got created. (Attached the screen shot for your reference)


Steps required:

  1. You need to traverse to ..\tools\builder\ path.
  2. Need to run command "nmake intel64" under path ..\tools\builder\.
  3. The path consists user_example_list file which already has DGETRF functionality. 
  4. When nmake intel64 is ran, mkl_custom.dll gets built with the functionalities being provided in user_example_list file.


Best Regards,

Shanmukh.SS

 


0 Kudos
Gottkehaskamp
Beginner
3,006 Views

Unfortunately, I have little experience with "nmake", so I guess I need a little help.

I opened the command prompt as administrator and changed to the directory

C:\Program Files (x86)\Intel\oneAPI\mkl\2021.1.1\tools\builder

 

Then I entered the command

nmake intel64

 

The error message is that Windows does not know the command "nmake". Do I still have to set environment variables? Where exactly is the app "nmake"?

 

Best regards,
Raimund

0 Kudos
ShanmukhS_Intel
Moderator
2,995 Views

Hi,


You are expected to perform the shared steps using "Intel oneAPI command prompt for Intel 64 for Visual Studio 2019" and it's not the conventional Windows Command prompt. Could you please cross verify the command prompt you are using, as nmake should be working on Intel oneAPI command prompt.


Best Regards,

Shanmukh.SS


0 Kudos
Gottkehaskamp
Beginner
2,969 Views

Thaank you for the information.

I searched for "Intel oneAPI command prompt for Intel 64 for Visual Studio 2019" but I did not find it in my VS2019. So I used the "developer command prompt" from VS2019 under <Tools><Command Line>, made the steps and got the following:

...

C:\Program Files (x86)\Intel\oneAPI\mkl\latest\tools\builder>nmake intel64

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

set Lib="C:\Program Files (x86)\Intel\oneAPI\mkl"\lib\intel64;%Lib%;"C:\Program Files (x86)\Intel\oneAPI\mkl"\..\compiler\lib\intel64
Zugriff verweigert
NMAKE : fatal error U1077: 'echo' : return code '0x1'
Stop.

...

It seems that nmake was executed, but it does not work. The german error message "Zugriff verweigert" means "Access denied".

 

Where can I find the "Intel oneAPI command prompt for Intel 64 for Visual Studio 2019"?

 

Regards,

Raimund

 

 

0 Kudos
ShanmukhS_Intel
Moderator
2,951 Views

Hi,

 

>>It seems that nmake was executed, but it does not work. The german error message "Zugriff verweigert" means "Access denied".

We would like you to try running with administrator privilege's (Run as Administrator) to overcome this issue.

>>Where can I find the "Intel oneAPI command prompt for Intel 64 for Visual Studio 2019"?

 It's located at (C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Intel oneAPI 2021)depending on the Intel oneAPI version being used by you. Attached the screenshot to let you know how it looks (or)  you can search for "Intel oneAPI command prompt for Intel 64 for Visual Studio 2019" from Windows search option.

ShanmukhS_Intel_0-1642509556558.png

 

 

Best Regards,

Shanmukh.SS

 

0 Kudos
Gottkehaskamp
Beginner
2,931 Views

Thanks so much, now nmake works. This is the response:

Gottkehaskamp_0-1642850775339.png

With an editor i can see, that DGETRF is included in the mkl_custom.lib, I included the mkl_custom.lib into th VS2019 project but the linker in VS 2019 is still misssing this Funktion as you can see here:

Gottkehaskamp_1-1642851080813.png

 

What might be the reason. Do I have to include more libs to the linker?

 

Regards,

Raimund

 

0 Kudos
ShanmukhS_Intel
Moderator
2,914 Views

Hi,


Could you please cross verify if all the dependents were added to user_example_list. If you need any other help regarding the Custom DLL builder, you could give the below command/reference link as well.


@nmake -q print_help PRIHE=YES


https://www.intel.com/content/www/us/en/develop/documentation/onemkl-linux-developer-guide/top/linking-your-application-with-onemkl/building-custom-dynamic-linked-shared-libraries/using-the-custom-shared-object-builder.html


Make sure the mkl_custom.lib which was linked is from the correct path. Try compiling and executing the code on Intel OneAPI command prompt. In addition, you could use the below link line advisor for other compiling and linking options.


https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl-link-line-advisor.html#gs.mu939l


Best Regards,

Shanmukh.SS


0 Kudos
Gottkehaskamp
Beginner
2,906 Views

That is very frustrating. I have now added all 77 unresolved externals to the user_example_list, but it doesn't change the result. The linker still thinks that there are 77 unresolved externals :(.


I am absolutely sure that the linker is accessing the correct mkl_custom.lib. If I rename it, for example, the linker reports that it cannot find the custom.lib.

For my settings in VS2019, the Link Line Advisor has identified the following libraries:

mkl_intel_lp64_dll.lib mkl_sequential_dll.lib mkl_core_dll.lib.

The linker works perfectly with these libraries. If I replace the libraries in the property pages under Linker->Additional Dependencies with custom.lib:

Gottkehaskamp_1-1643044553588.png

 

the 77 unresolved externals are not found. Otherwise, the linker does not give any error messages, so it seems to read the custom.dll file correctly. When I look into the file with an editor, all functions are listed.

I have created the file with "nmake intel64 threading=sequential"
created.

Here is the command line VS2019 created:

/OUT:"D:\Daten\Visual Studio-Projekte\TKlassen\CustomDLL\x64\Debug\LinEq.exe" /MANIFEST /NXCOMPAT /PDB:"D:\Daten\Visual Studio-Projekte\TKlassen\CustomDLL\x64\Debug\LinEq.pdb" /DYNAMICBASE "mkl_custom.lib" /DEBUG /LTCG:STATUS /MACHINE:X64 /INCREMENTAL /PGD:"D:\Daten\Visual Studio-Projekte\TKlassen\CustomDLL\x64\Debug\LinEq.pgd" /SUBSYSTEM:CONSOLE /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"x64\Debug\LinEq.exe.intermediate.manifest" /LTCGOUT:"x64\Debug\LinEq.iobj" /ERRORREPORT:PROMPT /ILK:"x64\Debug\LinEq.ilk" /NOLOGO /LIBPATH:"..\..\Armadillo\Intel MKL\lib\intel64" /LIBPATH:"C:\Program Files (x86)\Visual Leak Detector\lib\Win64" /TLBID:1

 

Do I have to change some othe settings in VS2019?

 

Regards,

Raimund

 

 

0 Kudos
ShanmukhS_Intel
Moderator
2,869 Views

Hi,


Could you please share us a sample reproducer, so that we could try reproducing the issue at our end.


Best regards,

Shanmukh.SS


0 Kudos
Gottkehaskamp
Beginner
2,860 Views

Hi,

in the enclusure you find the sample. In the folder CustomDLL are two folders: Armadillo and CustomDLL. In Armadillo are the headers and the libs are needed for using Armadillo together with IntelMKL. Under ...\CustomDLL\Armadillo\Intel MKL\lib\intel64 you find the Intel Libs and there is also the "mkl_custom.lib" witch I created. The list of the embedded functions is available in  ...\CustomDLL\LinEq\user_example_list.

The Visual Studio 2019 project  LinEq is in ..\CustomDLL\LinEq. It is a simple solver for linear equations using Armadillo and IntelMKL. You should start it in Debug und X64  mode. If the "Additional Dependencies" of the Linker Input is set to "mkl_core_dll.lib;mkl_intel_lp64_dll.lib;mkl_sequential_dll.lib" the linker works. If it is set only to "mkl_custom.dll" the linke detects 77 unresolved externals.

 

Please let me know, if you have any further questions.

 

Best regrads,

Raimund

0 Kudos
ShanmukhS_Intel
Moderator
2,822 Views

Hi,

 

We have tried executing your code using both ways, one using (mkl_core_dll.lib; mkl_intel_lp64_dll.lib; mkl_sequential_dll.lib) under Linker -> Input ->Additional Dependencies of Project properties and other way using mkl_custom.lib and we could see that code executes fine in both the cases(Added the screenshots for your reference). Could you please try with latest Intel oneAPI and check if this resolves your linking issue. We have added log statements in the code shared by you as well, to ensure the code executes fine.

 

ShanmukhS_Intel_1-1644241968587.jpeg

 

 

ShanmukhS_Intel_0-1644241852656.jpeg

 

 

Best Regards,

Shanmukh.SS

 

0 Kudos
ShanmukhS_Intel
Moderator
2,798 Views

Hi,


Reminder:

Has the information provided helped? Is your issue resolved? Kindly let us know if we could close this thread at end.


Best Regards,

Shanmukh.SS


0 Kudos
Gottkehaskamp
Beginner
2,778 Views

No, unfortunately not, I still have the same problem. I am now working with VS2022 and the latest version of Intel MKL.

Have you changed anything in the project settings? E.g. if you change the parameter "Use oneMKL" from "No" to "Sequential" in the "Property Pages" under "Intel Libraries for oneApi", VS accesses the MKL libraries installed on the computer, regardless of which libraries are additionally specified to the linker under "Additional Dependencies".

I am surprised that you were able to execute the programme, because the mkl_custom.dll is missing. Without this dll, the programme should not be executable if it was created with the mkl_custom.lib.

Or have you created a new mkl_custom.lib and mkl_custm.dll?

Best Regards,

Raimund

0 Kudos
ShanmukhS_Intel
Moderator
2,761 Views

Hi,


>>Have you changed anything in the project settings? E.g. if you change the parameter "Use oneMKL" from "No" to "Sequential" in the "Property Pages" under "Intel Libraries for oneApi", VS accesses the MKL libraries installed on the computer, regardless of which libraries are additionally specified to the linker under "Additional Dependencies".


We have used OneMKL under parallel mode. Below is the path for corresponding configuration.

Under Configuration Properties -> Intel Libraries for oneAPI -> Use oneMKL -> Parallel


>>I am surprised that you were able to execute the programme, because the mkl_custom.dll is missing. Without this dll, the programme should not be executable if it was created with the mkl_custom.lib.

Or have you created a new mkl_custom.lib and mkl_custm.dll?


We have created a new mkl_custom.lib using the user_example_list and by adding under Configuration Properties -> Linker -> Input -> mkl_custom.lib and we could see the code executes fine, We have added logs to ensure code is getting executed successfully.


Kindly let us know if you need any details specific, so that we could assist you on that.


Best Regards,

Shanmukh.SS


0 Kudos
Gottkehaskamp
Beginner
2,748 Views

Then I understand why the program works for you without any problems. As soon as you start in VS under
"Configuration Properties -> Intel Libraries for oneAPI -> Use oneMKL ->" you set "Parallel" or "Sequential" VS uses the installed standard libs and DLLs. This means that mkl_custom.lib and also mkl_custom.dll are not used at all. This is true regardless of which additional lib's you provide to VS.
You can test this by simply deleting mkl_custom.dll, the program will then work.
This is also the case with me. As long as "Use oneMKL" is set to Parallel or Sequential, the program works without problems, but does not use the custom.dll but the standard libraries:
...
'LinEq.exe' (Win32): Loaded 'C:\Program Files (x86)\Intel\oneAPI\mkl\2022.0.2\redist\intel64\mkl_core.2.dll'. Module was built without symbols.
'LinEq.exe' (Win32): Loaded 'C:\Program Files (x86)\Intel\oneAPI\mkl\2022.0.2\redist\intel64\mkl_avx2.2.dll'. Module was built without symbols.
'LinEq.exe' (Win32): Loaded 'C:\Program Files (x86)\Intel\oneAPI\mkl\2022.0.2\redist\intel64\mkl_vml_avx2.2.dll'. Module was built without symbols.
...

If you want VS to access the mkl_custom.dll and mkl_custom.lib (and that's exactly what I want) then you have to set "Use oneMKL" to "No". But then there are the described problems.

Best Regards,
Gottkehaskamp

0 Kudos
ShanmukhS_Intel
Moderator
2,542 Views

Hi,


We are working on your issue internally. We will get back to you soon with an update.


Best Regards,

Shanmukh.SS


0 Kudos
Ruqiu_C_Intel
Moderator
2,395 Views

Hi,

Looks the the custom.lib missed the symbols. After checking the configure file user_example_list, it does missed them. Attached the updated configure file user_example_list.txt here, please modify file user_example_list.txt to user_example_list and run the command

nmake intel64 to generate mkl_custom.lib. Thanks

0 Kudos
Gottkehaskamp
Beginner
2,370 Views

It works!

Thank you very much for your kind and patient help.


Best Regards,

Raimund

 

0 Kudos
Ruqiu_C_Intel
Moderator
2,331 Views

Glad to know it works.


This issue is closing and we will no longer respond to this thread. If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only. 



0 Kudos
Reply