5 <strong>Intel</strong>® M<strong>at</strong>h Kernel Library User’s GuideNOTE. The syntax below is provided for dynamic linking. For st<strong>at</strong>iclinking, replace each library name preceded with "-l" with the p<strong>at</strong>h to thelibrary file, for example, replace -lmkl_core with$MKLPATH/libmkl_core.a, where $MKLPATH is the appropri<strong>at</strong>euser-defined environment variable. See specific examples in the LinkingExamples section.-L -I[-lmkl_lapack95] [-lmkl_blas95][cluster components][{-lmkl_{intel, intel_ilp64, intel_lp64, intel_sp2dp, gf, gf_ilp64, gf_lp64}][-lmkl_{intel_thread, sequential}][{-lmkl_solver, -lmkl_solver_lp64, -lmkl_solver_ilp64}]{{[-lmkl_lapack] -lmkl_{ia32, em64t, ipf}},-lmkl_core}}[{-lguide, -liomp5}] [-lpthread] [-lm]See Selecting Libraries to Link for details of this syntax usage <strong>and</strong> specificrecommend<strong>at</strong>ions on which libraries to link depending on your <strong>Intel</strong> MKL usage scenario.See also• section “Fortran 90 Interfaces <strong>and</strong> Wrappers to LAPACK <strong>and</strong> BLAS” in chapter 7 forinform<strong>at</strong>ion on the libraries th<strong>at</strong> you should build prior to linking• chapter Working with <strong>Intel</strong>® M<strong>at</strong>h Kernel Library Cluster Software on lining withcluster components.To link with <strong>Intel</strong> MKL, you can choose pure layered model or default model, which isbackward comp<strong>at</strong>ible on link line (except cluster components). The syntax aboveincorport<strong>at</strong>es both models.For the pure layered model, you need to choose one library from the Interface layer, onelibrary from the Threading layer, the <strong>Comput<strong>at</strong>ional</strong> layer library (no choice here), <strong>and</strong> addrun-time libraries. In case of the default model, you need not change the link line withrespect to the one used with <strong>Intel</strong> MKL 9.x (see the Dummy Libraries section in chapter 3for details).Figure 5-1 compares linking for <strong>Intel</strong> MKL 10.0, which uses layers, <strong>and</strong> <strong>Intel</strong> MKL 9.x.5-4
Linking Your Applic<strong>at</strong>ion with <strong>Intel</strong>® M<strong>at</strong>h Kernel Library 5Figure 5-1Linking with Layered <strong>Intel</strong> MKLIn case of employing the pure layered model for st<strong>at</strong>ic linking, the interface layer, threadinglayer, <strong>and</strong> comput<strong>at</strong>ion layer libraries must be enclosed in grouping symbols (for example,-Wl,--start-group $MKLPATH/libmkl_intel_ilp64.a$MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a -Wl,--end-group). Seespecific examples in the Linking Examples section.In case you use dummy libraries,• The p<strong>at</strong>h to <strong>Intel</strong> MKL libraries must be added to the list of p<strong>at</strong>hs th<strong>at</strong> the linker willsearch for archive libraries (for example, as -L)• No interface layer or threading layer libraries should be included in the link line• No grouping symbols must be employed.The order of listing libraries in the link line is essential, except for the libraries enclosed inthe grouping symbols.5-5