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

Static vs dynamic link speed on 32 bit system

I have some legacy code I'm updating and recompiling for both 32 and 64 bit machines/operating systems. The program runs under various varieties of Windows, and the compiler is the Intel Fortran Composer XE 2011 SP1 running on a 64 bit Windows 7 system. The programs use a number of MKL functions.

When testing a 32 bit version of the program on an old Pentium IV machine running 32 bit Windows XP, I discovered that it was about 3 to 4 times slower than the program it was to replace. Many hours later, I found that I could make it run at a speed comparable to the old program by removing mkl_rt.lib from the Resources list and specifiying that MKL libraries be used. The recompiled program is about 2 MB larger and doesn't require the presence of mkl_rt.dll at run time, but it's 3 to 4 times faster than it was. Because up to four similar programs will be installed in the same directory, I'd prefer using the dynamic library. But the speed penalty is much too great. I was of course using the 32 bit versions of mkl_rt.lib in the project and mkl_rt.dll at run time. In the process of tracking down the problem I tried many combinations of optimization and other properties with little effect -- it's due solely to the linking. One variation of the program I tested makes a single call to GETRF and one to GETRS, so the problem isn't due to overhead in calling the functions in the DLL -- it's the execution of the functions themselves that's slow.

The slowdown occurred when using either the single or double precision MKL routines. Interestingly, the original 32 bit programs worked fine and at normal speed on my 64 bit system.

Is there a way to dynamically link the MKL routines without taking such a huge speed reduction on 32 bit systems?

0 Kudos
1 Reply

Hi Groupw_bench,

According to your description, it seems a program with mkl_rt.lib(the import library of mkl_rt.dll) or without it run in different speeds. but you haven't mentioned, what else mkl libraries you are linking. Considering the speed difference, we guess it is multi-threading issue. How many CPU on your Pentium IV machine (or HT is no or not?). Could you please provide us a small test case to show the problem?

Regarding mkl_rt.lib (& mkl_rt.dll), theyare new library we introduced in MKL 10.3 as the article
A New Linking Model-Single Dynamic Library mkl_rt Since Intel MKL 10.3
link mkl_rt.lib(mkl_rt.dll) almost = mkl_intel_c_dll.lib mkl_intel_thread_dll.lib mkl_core_dll.lib libiomp5md.lib. as we know, dll have load overhead than static library,but the overhead should not so big (3 to 4 times). So we need to know the details of MKL static library in your program".For example, Doyou use theparallel or sequential library etc.

Here is MKL link Advice: MKL Link Line Advisor

Best Regards,

0 Kudos