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

Custom Dynamic-link Library Builder and MKL_DIRECT_CALL

Berk
Beginner
642 Views

I'd like to set the MKL_DIRECT_CALL flag for the custom MKL dll that we are using from a C application and hopefully speed up the matrix operations. Will it be enough to set the flag for the C application alone? What about the makefile for the custom MKL dll? 

0 Kudos
1 Solution
Ying_H_Intel
Employee
642 Views

Hi Berk, 

We did the investigation. you can

1)  include dgemm_direct and dgemm_direct_  in  user_example_list. (user_def_file.def)  to create custom.dll

2) then  you can just call dgemm() and add –DMKL_DIRECT_CALL with include "mkl.h". 

Best Regards,
Ying 

View solution in original post

0 Kudos
4 Replies
Ying_H_Intel
Employee
642 Views

Hi, 

Are you reading the article, 

https://software.intel.com/en-us/articles/improve-intel-mkl-performance-for-small-problems-the-use-of-mkl-direct-call

Right? 

MKL_DIRECT_CALL flag is pre-processor macros to be defined to instruct Intel MKL to pick the fast path for small matrices.  It was using during  compile phase,  so it should be ok for you to add such option

 on Linux system, simply add -DMKL_DIRECT_CALL or -DMKL_DIRECT_CALL_SEQ. On Windows, the syntax is /DMKL_DIRECT_CALL or /DMKL_DIRECT_CALL_SEQ.

in your makefile  (same as /Qstd=c99 ) both for c application and custom MKL Dll. 

Best Regards,

Ying 

 

0 Kudos
Berk
Beginner
642 Views

Hi Ying,

 

Thanks for your reply. Yes I've read the article before posting, and my question was if using MKL by not directly linking with it but via a custom made MKL dll changed anything or not. I especially wanted to know if I needed to declare the flag when building the custom MKL dll, and if so, where & how. It looks trivial to define & use the flag in our main C project that calls the custom MKL dll for matrix operations. I am not sure how to do the same for the custom MKL dll itself, though...

Berk

0 Kudos
Ying_H_Intel
Employee
643 Views

Hi Berk, 

We did the investigation. you can

1)  include dgemm_direct and dgemm_direct_  in  user_example_list. (user_def_file.def)  to create custom.dll

2) then  you can just call dgemm() and add –DMKL_DIRECT_CALL with include "mkl.h". 

Best Regards,
Ying 

0 Kudos
Berk
Beginner
642 Views

Hi Ying,

 

Thanks for your reply. One final question: Does this flag affect PARDISO at all? If so, how can I set it on my custom dll exposing PARDISO calls to my application?

Thanks again for you help.

Berk

0 Kudos
Reply