Developer Guide

Contents

Linking on Intel(R) 64 Architecture Systems

The following examples illustrate linking that uses Intel(R) compilers.
Most
examples use the
.f
Fortran source file. C/C++ users should instead specify a
.cpp
(C++) or
.c
(C) file and replace
ifort
with
icc
.
In these examples,
MKLPATH=$MKLROOT/lib
/intel64
_lin
,
MKLINCLUDE=$MKLROOT/include
.
If you successfully completed the Scripts to Set Environment Variables Setting Environment Variables step of the Getting Started process, you can omit
-I$MKLINCLUDE
in all the examples and omit
-L$MKLPATH
in the examples for dynamic linking.
  • Static linking of
    myprog.f
    and
    OpenMP* threaded
    Intel® MKL
    supporting the LP64 interface:
    ifort myprog.f
    -L$MKLPATH -I$MKLINCLUDE
    -Wl,--start-group
    $MKLPATH/lib
    mkl_intel_lp64.
    a
    $MKLPATH/lib
    mkl_intel_thread.
    a
    $MKLPATH/lib
    mkl_core.
    a
    -Wl,--end-group
    -l
    iomp5
    -lpthread -lm
  • Dynamic linking of
    myprog.f
    and
    OpenMP* threaded
    Intel® MKL
    supporting the LP64 interface:
    ifort myprog.f
    -L$MKLPATH -I$MKLINCLUDE
    -l
    mkl_intel_lp64
    -l
    mkl_intel_thread
    -l
    mkl_core
    -l
    iomp5
    -lpthread -lm
  • Static linking of
    myprog.f
    and sequential version of
    Intel® MKL
    supporting the LP64 interface:
    ifort myprog.f
    -L$MKLPATH -I$MKLINCLUDE
    -Wl,--start-group
    $MKLPATH/lib
    mkl_intel_lp64.
    a
    $MKLPATH/lib
    mkl_sequential.
    a
    $MKLPATH/lib
    mkl_core.
    a
    -Wl,--end-group
    -lpthread -lm
  • Dynamic linking of
    myprog.f
    and sequential version of
    Intel® MKL
    supporting the LP64 interface:
    ifort myprog.f
    -L$MKLPATH -I$MKLINCLUDE
    -l
    mkl_intel_lp64
    -l
    mkl_sequential
    -l
    mkl_core
    -lpthread -lm
  • Static linking of
    myprog.f
    and
    OpenMP* threaded
    Intel® MKL
    supporting the ILP64 interface:
    ifort myprog.f
    -L$MKLPATH -I$MKLINCLUDE
    -Wl,--start-group
    $MKLPATH/lib
    mkl_intel_ilp64.
    a
    $MKLPATH/lib
    mkl_intel_thread.
    a
    $MKLPATH/lib
    mkl_core.
    a
    -Wl,--end-group
    -
    liomp5
    -lpthread -lm
  • Dynamic linking of
    myprog.f
    and
    OpenMP* threaded
    Intel® MKL
    supporting the ILP64 interface:
    ifort myprog.f
    -L$MKLPATH -I$MKLINCLUDE
    -l
    mkl_intel_ilp64
    -l
    mkl_intel_thread
    -l
    mkl_core
    -l
    iomp5
    -lpthread -lm
  • Dynamic linking of user code
    myprog.f
    and
    OpenMP* threaded
    or sequential
    Intel® MKL
    (Call appropriate functions or set environment variables to choose threaded or sequential mode and to set the interface):
    ifort myprog.f -lmkl_rt
  • Static linking of
    myprog.f
    , Fortran 95 LAPACK interface, and
    OpenMP* threaded
    Intel® MKL
    supporting the LP64 interface:
    ifort myprog.f
    -L$MKLPATH -I$MKLINCLUDE -I$MKLINCLUDE/intel64/lp64
    -l
    mkl_lapack95_lp64
    -Wl,--start-group
    $MKLPATH/lib
    mkl_intel_lp64.
    a
    $MKLPATH/lib
    mkl_intel_thread.
    a
    $MKLPATH/lib
    mkl_core.
    a
    -Wl,--end-group
    -
    liomp5
    -lpthread -lm
  • Static linking of
    myprog.f
    , Fortran 95 BLAS interface, and
    OpenMP* threaded
    Intel® MKL
    supporting the LP64 interface:
    ifort myprog.f
    -L$MKLPATH -I$MKLINCLUDE -I$MKLINCLUDE/intel64/lp64
    -l
    mkl_blas95_lp64
    -Wl,--start-group
    $MKLPATH/lib
    mkl_intel_lp64.
    a
    $MKLPATH/lib
    mkl_intel_thread.
    a
    $MKLPATH/lib
    mkl_core.
    a
    -Wl,--end-group
    -
    liomp5
    -lpthread -lm
  • Static linking of
    myprog.c
    and
    Intel® MKL
    threaded with Intel® Threading Building Blocks (Intel® TBB), provided that the
    LIBRARY_PATH
    environment variable contains the path to Intel TBB library:
    icc myprog.c -L$MKLPATH -I$MKLINCLUDE -Wl,--start-group $MKLPATH/libmkl_intel_lp64.a $MKLPATH/libmkl_tbb_thread.a $MKLPATH/libmkl_core.a -Wl,--end-group -ltbb -lstdc++ -lpthread -lm
  • Dynamic linking of
    myprog.c
    and
    Intel® MKL
    threaded with Intel TBB, provided that the
    LIBRARY_PATH
    environment variable contains the path to Intel TBB library:
    icc myprog.c -L$MKLPATH -I$MKLINCLUDE-lmkl_intel_lp64 -lmkl_tbb_thread -lmkl_core -ltbb -lstdc++ -lpthread -lm

Product and Performance Information

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804