Getting Started with the Intel® Math Kernel Library 8.1.1 for Linux*  

Document Number: 310704-001US

Contents

Overview
Before You Start
    High-Level Directory Structure
    Detailed Directory Structure
Configuring Intel® Math Kernel Library (Intel® MKL)
Linking Your Application with Intel MKL
Threading
Disclaimer and Legal Information

Overview

The guide is intended to help start using the Intel® Math Kernel Library (Intel® MKL) for Linux* by describing the necessary steps you need to perform after the installation of the product and providing a simple usage scenario. The procedures guide you through the steps of how to link your application to the library, how to configure the library, and other essential steps.

It is assumed that you use this document after the installation of Intel MKL is complete on your machine.

If you have not installed the product, use Intel MKL Installation Guide (file Install.txt) for assistance.

Before You Start

Once you complete the installation of Intel MKL, it is useful to perform a basic verification task that confirms proper installation and configuration of the library. 

  1. Check that the directory you chose for installation has been created. The default installation directory is /opt/intel/mkl/8.1.1.
  2. Update build scripts so that they point to the desired version of Intel MKL if you choose to keep multiple versions installed on your computer. Note that you can have several versions of Intel MKL installed on your computer, but you will be required to remove beta versions of this software.
  3. Check that the following three files are placed in the tools/environment directory:
    mklvars32.sh
    mklvarsem64t.sh
    mklvars64.sh

    You can use these files to set environmental variables INCLUDE and LD_LIBRARY_PATH in the current user shell.

High-Level Directory Structure

Below is shown a high-level structure for Intel MKL after installation.

mkl/8.1.1 Main directory
mkl/8.1.1/doc Documentation directory
  mklEULA.txt Intel MKL license
  Doc_Index.htm Index of Intel MKL documentation
  fftw2xmkl_notes.htm FFTW 2.x Interface Support Technical User Notes
  fftw3xmkl_notes.htm FFTW 3.x Interface Support Technical User Notes
  Getting_Started.htm Getting Started with Intel MKL (this document)
  Install.txt Installation Guide
  Readme.txt Initial User Information
  redist.txt List of redistributable files
  Release_Notes.htm Release Notes
  Release_Notes.txt Release Notes (text format)
  mklman.pdf Intel MKL Reference Manual
  mklman80_j.pdf Intel MKL Reference Manual in Japanese
  mklqref/index.htm MKL Quick Reference
  mklsupport.txt Information on package number for customer support reference
  mkluse.htm Technical User notes for Intel MKL
  vmlnotes.htm General discussion of VML
  vslnotes.pdf General discussion of VSL
mkl/8.1.1/examples Source and data for examples
mkl/8.1.1/include Contains INCLUDE files for both library routines and test and example programs
mkl/8.1.1/interfaces/blas95 Contains f95 wrappers for BLAS and makefile to build the library
mkl/8.1.1/interfaces/lapack95 Contains f95 wrappers for LAPACK and makefile to build the library
mkl/8.1.1/interfaces/lfftw2xc Contains wrappers for FFTW version 2.x (C interface) to call Intel MKL DFTI
mkl/8.1.1/interfaces/lfftw2xf Contains wrappers for FFTW version 2.x (Fortran interface) to call Intel MKL DFTI
mkl/8.1.1/interfaces/lfftw3xc Contains wrappers for FFTW version 3.x (C interface) to call Intel MKL DFTI
mkl/8.1.1/tests Source and data for tests
mkl/8.1.1/lib/32 Contains static libraries and shared objects for IA-32 applications
mkl/8.1.1/lib/em64t Contains static libraries and shared objects for applications running on processors with Intel® EM64T
mkl/8.1.1/lib/64 Contains static libraries and shared objects for Intel® Itanium®2 processor
mkl/8.1.1/tools/builder Contains tools for creating custom dynamically linkable libraries
mkl/8.1.1/tools/environment Contains shell scripts to set environmental variables in the user shell
mkl/8.1.1/tools/support Contains a utility for reporting the package ID and license key information to Intel® Premier Support

Detailed Directory Structure

Intel® MKL separates IA-32 versions of the library, Intel® Extended Memory 64 Technology (Intel® EM64T), and versions for Intel® Itanium® 2 processor:

Intel® MKL consists of two parts:

The high level libraries are optimized without regard to the processor and can be used effectively on processors from Intel® Pentium® processor through Intel® Pentium® 4 processor. Processor-specific kernels containing BLAS, Sparse BLAS, cblas, GMP, FFTs, DFTs, VSL, VML, and interval arithmetic routines are optimized for each specific processor.

In addition, threading software is supplied as:

The information below shows detailed directory structure of the library.

lib/32 Contains all libraries for 32-bit applications
  libmkl_ia32.a Optimized kernels (BLAS, cblas, Sparse BLAS, GMP, FFTs, DFTs, VML, VSL, interval arithmetic) for 32-bit applications
  libmkl_lapack.a LAPACK routines and drivers
  libmkl_solver.a Sparse solver routines
  libguide.a Threading library for static linking
  libmkl.so Library dispatcher for dynamic load of processor specific kernel
  libmkl_lapack32.so LAPACK routines and drivers, single precision data types
  libmkl_lapack64.so LAPACK routines and drivers, double precision data types
  libmkl_def.so Default kernel (Intel® Pentium®, Pentium® Pro, and Pentium® II processors)
  libmkl_p3.so Intel® Pentium® III processor kernel
  libmkl_p4.so Pentium® 4 processor kernel
  libmkl_p4p.so Kernel for Intel® Pentium® 4 processor with Streaming SIMD Extensions 3 (SSE3)
  libmkl_p4m.so Kernel for processors based on the Intel® Core™ microarchitecture
  libvml.so Library dispatcher for dynamic load of processor specific VML kernels
  libmkl_vml_def.so VML part of default kernel (Pentium®, Pentium® Pro, Pentium® II processors)
  libmkl_vml_p3.so VML part of Pentium® III processor kernel
  libmkl_vml_p4.so VML part of Pentium® 4 processor kernel
  libmkl_vml_p4p.so VML for Pentium® 4 processor with Streaming SIMD Extensions 3 (SSE3)
  libmkl_vml_p4m.so VML for processors based on the Intel® Core™ microarchitecture
  libmkl_ias.so Interval arithmetic routines
  libguide.so Threading library for dynamic linking
 
  A number of interface libraries are generated additionally as a result of respective makefiles operation in interfaces folder. See the list at the end of the section.
 
lib/em64t Contains all libraries for Intel® EM64T applications
  libmkl_em64t.a Optimized kernels for Intel® EM64T
  libmkl_lapack.a LAPACK routines and drivers
  libmkl_solver.a Sparse solver routines
  libguide.a Threading library for static linking
  libmkl.so Library dispatcher for dynamic load of processor specific kernel
  libmkl_lapack32.so LAPACK routines and drivers, single precision data types
  libmkl_lapack64.so LAPACK routines and drivers, double precision data types
  libmkl_def.so Default kernel
  libmkl_p4n.so Kernel for Intel® Xeon® processor with Intel® EM64T
  libmkl_mc.so Kernel for processors based on the Intel® Core™ microarchitecture
  libvml.so Library dispatcher for dynamic load of processor specific VML kernels
  libmkl_vml_def.so VML part of default kernel
  libmkl_vml_p4n.so VML for Intel® Xeon® processor with Intel® EM64T
  libmkl_vml_mc.so VML for processors based on the Intel® Core™ microarchitecture
  libmkl_ias.so Interval arithmetic routines
  libguide.so Threading library for dynamic linking
 
  A number of interface libraries are generated additionally as a result of respective makefiles operation in interfaces folder. See the list at the end of the section.
 
lib/64 Contains all libraries for Itanium® 2-based applications
  libmkl_ipf.a Processor kernels for Intel® Itanium® 2 processor
  libmkl_lapack.a LAPACK routines and drivers
  libmkl_solver.a Sparse solver routines
  libguide.a Threading library for static linking
  libmkl_lapack32.so LAPACK routines and drivers, single precision data types
  libmkl_lapack64.so LAPACK routines and drivers, double precision data types
  libguide.so Threading library for dynamic linking
  libmkl.so Library dispatcher for dynamic load of processor specific kernel
  libmkl_i2p.so Itanium® 2 processor kernel
  libmkl_vml_i2p.so Itanium® 2 processor VML kernel
  libmkl_ias.so Interval arithmetic routines
  libvml.so Library dispatcher for dynamic load of processor specific VML kernel

The following interface libraries and modules are generated additionally as a result of respective makefiles operation in interfaces folder:

  libmkl_blas95.a Contains Fortran-95 wrappers for BLAS (BLAS95)
  libmkl_lapack95.a Contains Fortran-95 wrappers for LAPACK (LAPACK95)
  libfftw2xc_gnu.a Contains interfaces for FFTW version 2.x (C interface for GNU compiler) to call Intel MKL DFTI
  libfftw2xc_intel.a Contains interfaces for FFTW version 2.x (C interface for Intel® compiler) to call Intel MKL DFTI
  libfftw2xf_gnu.a Contains interfaces for FFTW version 2.x (Fortran interface for GNU compiler) to call Intel MKL DFTI
  libfftw2xf_intel.a Contains interfaces for FFTW version 2.x (Fortran interface for Intel compiler) to call Intel MKL DFTI
  libfftw3xc_gnu.a Contains interfaces for FFTW version 3.x (C interface for GNU compiler) to call Intel MKL DFTI
  libfftw3xc_intel.a Contains interfaces for FFTW version 3.x (C interface for Intel compiler) to call Intel MKL DFTI
  mkl95_blas.mod Contains Fortran-95 interface module for BLAS (BLAS95)
  mkl95_lapack.mod Contains Fortran-95 interface module for LAPACK (LAPACK95)
  mkl95_precision.mod Contains Fortran-95 definition of precision parameters for BLAS95 and LAPACK95.

Configuring Intel MKL

After the installation is complete, you can use files mklvars32.sh, mklvarsem64t.sh, and mklvars64.sh in the tools/environment directory to set the environment variables INCLUDE and LD_LIBRARY_PATH in the user shell.

If you want to further customize some Intel MKL features, you may use the configuration file mkl.cfg which contains several variables that can be changed. For more information on using the configuration file, refer to Intel MKL Technical User Notes document.

Linking Your Application with Intel MKL

To link with Intel MKL libraries, follow this general form:

<files to link>
-L<MKL path>
[-lmkl_solver] [-lmkl_lapack95] [-lmkl_blas95]
{[-lmkl_lapack] -lmkl_{ia32, em64t, ipf},[-lmkl_lapack{32,64}] -lmkl, -lvml}
-lguide -lpthread

Note that
libmkl_solver.a contains the sparse solver functions,
libmkl_lapack.a, or libmkl_lapack32.so and lib_mkl_lapack64.so have the LAPACK functions.
libmkl_ia32.a, libmkl_em64t.a, and libmkl_ipf.a have the BLAS, Sparse BLAS, GMP, FFT/DFT, VML, VSL, and interval arithmetic functions for IA-32, Intel® EM64T, and Intel Itanium processors respectively.
libmkl_lapack95.a and libmkl_blas95.a contain LAPACK95 and BLAS95 interfaces respectively. They are not included into the original distribution and should be built before using the interface (see Note for usage of Fortran-95 interfaces and wrappers to LAPACK and BLAS after this section for details on building the libraries).

The libmkl.so file contains the dynamically loaded versions of these objects except for VML/VSL, which are contained in libvml.so.

In all cases, appropriate libraries will be loaded at runtime. Below are some specific examples for linking on IA-32 systems with Intel® compilers:

ifort myprog.f -L$MKLPATH -lmkl_lapack -lmkl_ia32 -lguide -lpthread
        static linking of user code myprog.f, LAPACK, and kernels. Processor dispatcher will call the appropriate kernel for the system at runtime.
ifort myprog.f -L$MKLPATH -lmkl_lapack95 -lmkl_lapack -lmkl_ia32 -lguide -lpthread
        static linking of user code myprog.f, Fortran-95 LAPACK interface, and kernels. Processor dispatcher will call the appropriate kernel for the system at runtime.
ifort myprog.f -L$MKLPATH -lmkl_blas95 -lmkl_lapack -lmkl_ia32 -lguide -lpthread
        static linking of user code myprog.f, Fortran-95 BLAS interface, and kernels. Processor dispatcher will call the appropriate kernel for the system at runtime.
icc myprog.c -L$MKLPATH -lmkl_ia32 -lguide -lpthread -lm
        static linking of user code myprog.c, BLAS, Sparse BLAS, GMP, VML/VSL, interval arithmetic, and FFT/DFT. Processor dispatcher will call the appropriate kernel for the system at runtime.
ifort myprog.f -L$MKLPATH -lmkl_solver -lmkl_lapack -lmkl_ia32 -lguide -lpthread
        static linking of user code myprog.f, the sparse solver, and possibly other routines within Intel MKL (including the kernels needed to support the sparse solver).
icc myprog.c -L$MKLPATH -lmkl -lguide -lpthread
        dynamic linking of user code myprog.c, the BLAS or FFTs within Intel MKL.

Note: If you link libguide statically (discouraged) and

If you use dynamic linking (libguide.so) of Intel MKL (recommended), make sure the LD_LIBRARY_PATH is defined so that exactly this version of libguide is found and used at runtime.

For more information on linking and running applications with Intel MKL, refer to Intel MKL Technical User Notes document (mkluse.htm).

For linking examples, see the Intel MKL support website at http://www.intel.com/support/performancetools/libraries/mkl/.

 

Note for usage of Fortran-95 interfaces and wrappers to LAPACK and BLAS

Fortran-95 interfaces and wrappers are delivered as sources. The simplest way to use them is building corresponding libraries and linking them as user's libraries. To do this, the user is supposed to have administrator rights. Provided the product directory is open for writing, the procedure is simple: go to the respective directory mkl/8.1.1/interfaces/blas95 or mkl/8.1.1/interfaces/lapack95 and type one of the corresponding commands:

make PLAT=lnx32 lib       - for IA32
make PLAT=lnx32e lib     - for Intel® EM64T
make PLAT=lnx64 lib       - for Intel® Itanium® 2 processor platform.

As a result, the required library and a respective .mod file will be built and installed in the standard catalog of the release. The .mod files can also be obtained from files of interfaces ifort -c mkl_lapack.f90 or ifort -c mkl_blas.f90. These files are in the include directory.
If you do not have administrator rights, do the following:

  1. copy the whole directory (mkl/8.1.1/interfaces/blas95 or mkl/8.1.1/interfaces/lapack95) into user defined directory <user_dir>
  2. copy the corresponding file (mkl_blas.f90 or mkl_lapack.f90) from mkl/8.1.1/include into user defined directory <user_dir>/blas95 or <user_dir>/lapack95 respectively
  3. run one of the above commands in <user_dir>/blas95 or <user_dir>/lapack95 with an additional variable, for instance:
    make PLAT=lnx32 INTERFACE=mkl_blas.f90 lib
    make PLAT=lnx32 INTERFACE=mkl_lapack.f90 lib.

Now the required library and the .mod file will be built and installed in the <user_dir>/blas95 or <user_dir>/lapack95 directory respectively.

By default using ifort compiler is assumed. You may change it with an additional parameter of make FC=<compiler>, for instance:
make PLAT=lnx64 FC=<compiler> lib

An advanced user can use interfaces without building the libraries.

To delete library from the building directory, use the following commands:
make PLAT=lnx32 clean       - for IA32
make PLAT=lnx32e clean     - for Intel® EM64T
make PLAT=lnx64 clean       - for Intel® Itanium® 2 processor platform.

 

Threading

Intel® MKL is threaded in a number of places and uses OpenMP* threading software.

The OpenMP* software responds to the environmental variable OMP_NUM_THREADS which sets the number of threads to use. The number of threads can be set in the shell the program is running in.

If the variable OMP_NUM_THREADS is not set, Intel® MKL software will run on the number of threads equal to 1 (except for the sparse solver where the default number of threads is the number of processors in the system). It is recommended that you always set OMP_NUM_THREADS to the number of processors you wish to use in your application.

To change the number of threads, enter:

export OMP_NUM_THREADS=<number of threads to use>

in the command shell in which the program is going to run.


For more information on technical details of Intel MKL, see Intel MKL Technical User Notes (mkluse.htm) document.


Disclaimer and Legal Information

The information in this manual is subject to change without notice and Intel Corporation assumes no responsibility or liability for any errors or inaccuracies that may appear in this document or any software that may be provided in association with this document. This document and the software described in it are furnished under license and may only be used or copied in accordance with the terms of the license. No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted by this document. The information in this document is provided in connection with Intel products and should not be construed as a commitment by Intel Corporation.

EXCEPT AS PROVIDED IN INTEL'S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER, AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. Intel products are not intended for use in medical, life saving, life sustaining, critical control or safety systems, or in nuclear facility applications.

Designers must not rely on the absence or characteristics of any features or instructions marked "reserved" or "undefined." Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them.

The software described in this document may contain software defects which may cause the product to deviate from published specifications. Current characterized software defects are available on request.

Intel, the Intel logo, Intel SpeedStep, Intel NetBurst, Intel NetStructure, MMX, Intel386, Intel486, Celeron, Intel Centrino, Intel Xeon, Intel XScale, Itanium, Pentium, Pentium II Xeon, Pentium III Xeon, Pentium M, and VTune are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.

Copyright © 2005-2006, Intel Corporation.