Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor I
39 Views

Is there an easy way to create a static library that contains the required MKL functions

Jump to solution

Hello,

when building an executable or dynamic library that uses MKL functions, all I need to do is specify -mkl=sequential on the compiler and linker command line. icc will automatically do everything that is required (add include-directions, pull in libraries, ...). That is nice and easy.

Now I want to build a static library (.a archive). The objects in this library invoke functions from MKL so I want to pack the required MKL objects into the static library as well so that I have only one static library that contains anything -- and preferably only those MKL objects that are actually required. I know how to do that by explicitly collecting the required MKL objects into the static library. But this feels cumbersome and also a little error prone. Is there anything similar to -mkl=sequential for this scenario? Would using xiar instead of ar help in any way?

I looked at https://software.intel.com/en-us/node/528519 (the linking examples) but nothing seemed related to what I am trying to do.

Thanks a lot,

Daniel

0 Kudos

Accepted Solutions
Highlighted
39 Views

Hi Daniel,

There is no an easy way to do that. Probably one can write some sort of script and collect required objects by analyzing U-symbols and finding objects with corresponding T-symbols.

Though, if dynamic library with the same property (i.e. it contains only needed functions from MKL) suites you -- please take a look at MKL custom dll builder ($MKLROOT/tools/builder or https://software.intel.com/en-us/node/528363).

View solution in original post

0 Kudos
3 Replies
Highlighted
40 Views

Hi Daniel,

There is no an easy way to do that. Probably one can write some sort of script and collect required objects by analyzing U-symbols and finding objects with corresponding T-symbols.

Though, if dynamic library with the same property (i.e. it contains only needed functions from MKL) suites you -- please take a look at MKL custom dll builder ($MKLROOT/tools/builder or https://software.intel.com/en-us/node/528363).

View solution in original post

0 Kudos
Highlighted
New Contributor I
39 Views

Hi Evarist,

thanks for your reply. The analysis of U and T symbols is exactly what we are doing right now. We definitely need a static library, a dynamic one will not do. So it looks like we are stuck with more or less manual selection of the object files.

Daniel

0 Kudos
Highlighted
39 Views

Just one additional idea -- "-Map" linker option may help you a little (put it in custom dll builder or your initial application and parse the output for required objects)...
 

0 Kudos