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

Proper include of Intel MKL in a Visual Studio project

StephaneSES
Novice
1,223 Views

This is a somewhat newbee question. In the development of one of my programs, I am using MKL PARDISO. Now, here is the question(s):

 

I am unsure what is the proper way to set the MKL dependencies in my Visual Studio solution/project. On the one hand I have the Qmkl compiler flag, which seems to be enough on its own for my code to work (Qmkl:parallel) - but is it too much? And on the other hand, we have tools such as Link Line Advisor, that gives the few requested MKL libs to be explicitly specified in the project linker properties. So, which one should be used? What's the difference? Could Qmkl add more than strictly necessary (if there could be a difference at all).

 

Thank you.

0 Kudos
1 Solution
VarshaS_Intel
Moderator
1,036 Views

Hi,

 

In general, it is better to enable the compiler option -Qmkl in Project B as it is only using the subroutine in Project A. If we enable the /Qmkl option in Project A then by default it will include all the libraries that are needed to run any MKL code which will lead to an increase in memory.

 

As mentioned by you Project A needs to be present in other projects such as Project C to Project Z which don't have any MKL code then it won't be necessary for other projects rather than an increase in the memory size.

 

Could you please provide us with your complete use case so that we could investigate more?

 

Thanks & Regards,

Varsha


View solution in original post

5 Replies
VarshaS_Intel
Moderator
1,177 Views

Hi Stephane,

 

Thanks for posting in Intel Communities.

 

While running your MKL code using Microsoft Visual Studio, if you are enabling the Intel MKL by selecting Sequential/Parallel/Cluster then it will use the same options and libraries that are been mentioned in the Intel Link Line Advisor.

 

If you want to compile MKL code quickly, then you can use the option /Qmkl it will include all the libraries and paths same as Link Line Advisor but this option can be used only with the Intel compilers. For more details, please refer to the below link:

https://www.intel.com/content/www/us/en/docs/dpcpp-cpp-compiler/developer-guide-reference/2023-0/qmkl-qmkl.html

 

If you are using Intel Link Line Advisor, then you can see different fields and it can be used for different compilers(like gnu, intel) and also it is compatible with several compilers and third-party libraries, and provides different interfaces to the functionality.  For more details, please find the below link:

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

 

There is no difference if you are using Intel Link Line Advisor or the /Qmkl option. Please find the below screenshot where we have enabled the /Qmkl option in Visual Studio and still the libraries and compiler options used are the same.

VarshaS_Intel_0-1681999168779.png

 

Could you please let us know if you have any other queries?

 

Thanks & Regards,

Varsha

 

 

0 Kudos
StephaneSES
Novice
1,146 Views

Hello, 

 

thank you very much for your reply. I do have more questions actually. Here goes:

Let's say I have projects B to Z which all have project A (which produces a .lib) in their Visual Studio solution. So for instance, Solution B would be:

 

B.sln
|______A.vfproj
|______B.vfproj

 

Where B produces an exe (B to Z can be a mix of exes and DLLs). Now, let's assume B is the only project to use a subroutine in A. That subroutine relies on some Intel MKL function.

 

Now, should project A tell the compiler to (statically) link to certain libraries in MKL through the Qmkl compiler flag[1], or is it better to left it to "No" and have project B set its flag to either "parallel" or "sequential" instead? What will be the impact, if any, on projects C to Z if Qmkl is set in A? Will A increase in size, a few MB more (apparently up to 15MB), and C to Z as well in turn, even though they use nothing in MKL?


[1]: https://www.intel.com/content/www/us/en/docs/cpp-compiler/developer-guide-reference/2021-8/qmkl-qmkl.html

0 Kudos
StephaneSES
Novice
1,075 Views

Hi, have you seen my answer? Thank you!

0 Kudos
VarshaS_Intel
Moderator
1,037 Views

Hi,

 

In general, it is better to enable the compiler option -Qmkl in Project B as it is only using the subroutine in Project A. If we enable the /Qmkl option in Project A then by default it will include all the libraries that are needed to run any MKL code which will lead to an increase in memory.

 

As mentioned by you Project A needs to be present in other projects such as Project C to Project Z which don't have any MKL code then it won't be necessary for other projects rather than an increase in the memory size.

 

Could you please provide us with your complete use case so that we could investigate more?

 

Thanks & Regards,

Varsha


VarshaS_Intel
Moderator
978 Views

Hi Stephane,


Glad to know that your issue is resolved. Thanks for accepting our solution. If you need any other information, please start a new thread as this thread will no longer be monitored by Intel.


Thanks & Regards,

Varsha


0 Kudos
Reply