Listing Libraries on a Link Line

To link with Intel MKL, specify paths and libraries on the link line as shown below.


The syntax below is for dynamic linking. For static linking, replace each library name preceded with "-l" with the path to the library file. For example, replace -lmkl_core with $MKLPATH/libmkl_core.a, where $MKLPATH is the appropriate user-defined environment variable.

<files to link>  

-L<MKL path>-I<MKL include>
[-I<MKL include>/{ia32|intel64|{ilp64|lp64}}]


[<cluster components>]




[-liomp5] [-lpthread] [-lm] [-ldl] [-ltbb -lstdc++]

In the case of static linking,enclose the cluster components, interface, threading, and computational libraries in grouping symbols (for example, -Wl,--start-group $MKLPATH/libmkl_cdft_core.a $MKLPATH/libmkl_blacs_intelmpi_ilp64.a $MKLPATH/libmkl_intel_ilp64.a $MKLPATH/libmkl_intel_thread.a $MKLPATH/libmkl_core.a -Wl,--end-group).

The order of listing libraries on the link line is essential, except for the libraries enclosed in the grouping symbols above.

For more complete information about compiler optimizations, see our Optimization Notice.
Select sticky button color: 
Orange (only for download buttons)