Listing Libraries on a Link Line

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

Note iconNote

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}}]

[-lmkl_blas{95|95_ilp64|95_lp64}]
[-lmkl_lapack{95|95_ilp64|95_lp64}]

[ <cluster components> ]

-lmkl_{intel|intel_ilp64|intel_lp64|intel_sp2dp|gf|gf_ilp64|gf_lp64}

-lmkl_{intel_thread|gnu_thread|pgi_thread|sequential}

-lmkl_core

-liomp5 [-lpthread] [-lm]

In 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.

See Also


Submit feedback on this help topic