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

How do I know what libraries to link to?

blischke
Beginner
529 Views

I'm trying to evaluate the MKL 10.x math library in a code we use that currently uses LINPACK. I need to evaluate using CGETRF, CSPTRF, and the corresponding solvers, as replacements. I'm using the MS Visual C++ IDE with Intel Fortran.

How do I know what libraries I need to link in? I've decided I want the Static Linking, but I don't understand what the Pure Layered Vs Default models choice means. Mostly, I want to know what library files I need to link to. There are about 30 in C:\Program Files\Intel\MKL\10.0.5.025\ia64\lib (Yeah, 64 bit).

0 Kudos
3 Replies
TimP
Honored Contributor III
529 Views

First, you need to know which variety of 64-bit you want. ia64 means Itanium. em64t means x86-64 Xeon/AMD64.

If you go into the library and runfile *.a, you will see which are scripts (is that what you call default?) and which are actual libraries. The scripts show how to link with 3 "layered" libraries, for the case where you use 32-bit integer arguments and OpenMP threaded MKL functions. You can changeeither of those options by writing it out yourself with the appropriate substitutions. The lapack scripts, whichmay be what you are interested in,will likely be the duplicated with 1 or 2 other names.

For threaded support, if you are using an Intel compiler to drive the link, the -openmp or -parallel option will take care of the OpenMP and pthread support. If you are using gnu compilers with -fopenmp, you must use the libiomp library in place of libgomp, for compatibility with MKL. If using gnu compilers without -fopenmp, either libguide or libiomp, plus -lpthread, will do the job. In the current version (as of later this month), libguide goes away.

In each case, you can choose single or double precision, and dynamic linking with .so, which must be found at run time by LD_LIRARY_PATH, or static linking, which involves the start-group...end-group directives.

I believe there is also a wrapper library to make double precision BLAS calls with single precision function names.

Then there is support for blas95, etc. etc. So you need to do some of your own decision making.

0 Kudos
blischke
Beginner
529 Views

>> First, you need to know which variety of 64-bit you want. ia64 means Itanium. em64t means x86-64 Xeon/AMD64.

That helps, I need EM64T.

>> If you go into the library and runfile *.a, you will see which are scripts (is that what you call default?)

I don't know what is meant by "default". The userguide.pdf says in the Selecting Libraries to Link section "To link with Intel MKL, you can choose pure layered model or default model, which is backward compatible on link line (except cluster components).". When you say "run file *.a", I don't know what you mean by that. There are no files ending in *.a in the MKL directory tree. Are you talking Linux? I'm compiling on 32 bit Windows XP, and need to compile for 64 bit Windows XP on an Intel Xeon (and also be able to compile for 32 bit Windows XP, but the evaluation I need to make is for 64 bits). I should have mentioned that in the OP.

>> In each case, you can choose single or double precision, [...]

If I want to use single threaded, single precision, static linking versions of CGETRF, CSPTRF, CGETRS, and CSPTRS, what libraries do I need to link to? There are 46 libraries in the .em64tlib directory.

>> So you need to do some of your own decision making.

Part of the problem is I don't even understand what the questions are. The sutff about "layering" is foreign to me.

The code I'm working on is about 15 years old, written in Fortran 77, except that I'm using an allocatable complex array to run problems requiring over 2 GBytes of memory. With the larger size comes longer runtimes. The LAPACK functions above seem like they should be drop-in replacements for Linpack routines CSPCO, CGECO, CSPSL, and CGESL.

0 Kudos
Gennady_F_Intel
Moderator
529 Views

For Lapack functionality on em64t system you can use the following libraries for linking your application:

non-treaded version:

mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib

threaded version:

mkl_intel_lp64.lib mkl_intel_thread.lib mkl_core.lib libguide40.lib

--Gennady

0 Kudos
Reply