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

Dynamically link without using CPU-specific DLLs

Kemp__Victor
Beginner
569 Views

Hello.

How can I compile a program to link MKL dynamically and so that it only uses the basic DLLs (mkl_intel_thread.dll, mkl_core.dll, libiomp5md.dll) and won't try to load different ones like mkl_avx.dll, mkl_avx2.dll, etc. on different processors?

Or is there an environment variable or something to do that?

 

0 Kudos
7 Replies
Gennady_F_Intel
Moderator
569 Views

you don't need to link explicitly about this dll - it happens automatically.  You also may try to build your owner custom dll which will contain all optimizations for all cpu types. You may refer to the MKL User Guide - see Building Custom Dynamic-link Libraries.

0 Kudos
Kemp__Victor
Beginner
569 Views

Thanks Gennady though what I want is the opposite. To make it not use those extra DLLs.

0 Kudos
Kemp__Victor
Beginner
569 Views

I've worked it out now. If mkl_def.dll is present at runtime and mkl_avx2.dll/etc are missing, then uses that default dll and doesn't demand the CPU-specific ones.

0 Kudos
Gennady_F_Intel
Moderator
569 Views

we didn't test such mode and in the case, if you will experience some runtime or performance problems, then back to the recommended building mode with mkl.

0 Kudos
Kemp__Victor
Beginner
569 Views

Oh, but surely that's what will be used on an older CPU, isn't it? I find that results with mkl_avx2.dll appear to be wrong in one case but are much better with mkl_def.dll.

Another problem is the large size of all those files which makes distribution a bit less convenient.

 

0 Kudos
Gennady_F_Intel
Moderator
569 Views

if the results are wrong, make sense to give us the example that shows this problem. You may also try to submit the ticket against MKL into the intel online service center (https://supporttickets.intel.com/).

0 Kudos
Kemp__Victor
Beginner
569 Views

Unfortunately, it's not my software so it would be quite a lot of work to make an example the clearly shows the problem. I'm not even sure it's really a bug. The results with mkl_avx2.dll have about 10x the magnitude of random noise in the solution as it does with only mkl_def.dll. Both have this noise though so it might be an ill-conditioned problem I'm trying to solve or in some other way pushing it beyond what it's meant to do.

I'm confused about why using only mkl_def.dll is risky though. Is that not what it falls back on when the other features like AVX and SIMD aren't available? Surely it's safe on an older processor without those extra features?

0 Kudos
Reply