19.08.2015 Views

Using MKL, the Intel Math Kernel Library (v11.0.0.079) - ICHEC

Using MKL, the Intel Math Kernel Library (v11.0.0.079) - ICHEC

Using MKL, the Intel Math Kernel Library (v11.0.0.079) - ICHEC

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Static/Dynamic Linking<strong>Intel</strong> <strong>MKL</strong> supports both linking models static ordynamic. Each of <strong>the</strong>m has <strong>the</strong>ir pros and cons. Staticlinking resolves all symbolic references at link time. Thebehaviour of statically built executables is predictable,because <strong>the</strong>re are no run-time dependencies. The maindisadvantage is that having to relink new versions of <strong>the</strong>library to your application may be error-prone and timeconsuming,because you have to relink <strong>the</strong> entireapplication. Moreover, static linking results in largeexecutables and uses memory less efficiently. If severalexecutables are linked with <strong>the</strong> same library, each of <strong>the</strong>mmust load it into memory independently. This matters mostfor executables having data sizes that are small andcomparable with <strong>the</strong> size of <strong>the</strong> executable.Dynamic linking postpones <strong>the</strong> resolution of someundefined symbolic references until run time. Dynamicallybuilt executables contain those symbols along with a list oflibraries that provide definitions of <strong>the</strong> symbols. When <strong>the</strong>executable is loaded, <strong>the</strong> final linking is done before <strong>the</strong>application runs. If several dynamically built executablesreference <strong>the</strong> same library, it is loaded into memory onlyonce and <strong>the</strong> executables share it, <strong>the</strong>reby saving memory.Dynamic linking enables you to separately update <strong>the</strong>libraries on which applications depend and does notrequire relinking <strong>the</strong> applications. The developmentadvantages of dynamic linking are achieved at some costto performance, because every unresolved symbol has tobe looked up in a dedicated table and resolved at runtime.Linking SyntaxDynamic Case -L$<strong>MKL</strong>PATH -I$<strong>MKL</strong>INCLUDE[-lmkl_blas{95_ilp64|95_lp64}][-lmkl_lapack{95_ilp64|95_lp64}][ ]-lmkl_{intel_ilp64|intel_lp64|intel_sp2dp|gf_ilp64|gf_lp64}-lmkl_{intel_thread|gnu_thread|pgi_thread|sequential}-lmkl_core[-liomp5] [-lpthread] [-lm] [-ldl]Static Case -L$<strong>MKL</strong>PATH -I$<strong>MKL</strong>INCLUDE[$<strong>MKL</strong>PATH/libmkl_blas{95_ilp64|95_lp64}.a][$<strong>MKL</strong>PATH/libmkl_lapack{95_ilp64|95_lp64}.a]-Wl,--start-group[ ]$<strong>MKL</strong>PATH/libmkl_{intel_ilp64|intel_lp64|intel_sp2dp|gf_ilp64|gf_lp64}.a$<strong>MKL</strong>PATH/libmkl_{intel_thread|gnu_thread|pgi_thread|sequential}.a$<strong>MKL</strong>PATH/libmkl_core.a-Wl,--end-group[-liomp5] [-lpthread] [-lm] [-ldl]Notes: {a,b,c} only one of <strong>the</strong> libraries should be chosen, [a] optional. On stokes and stoney$<strong>MKL</strong>PATH=$<strong>MKL</strong>ROOT/lib/intel64$<strong>MKL</strong>INCLUDE=$<strong>MKL</strong>ROOT/include5

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!