Recently need to use MKL in Ubuntu, the installation and configuration of linking are a bit difficult for me. So I just leave some notes that I have tested for future reference, most words are directly copied from internet.
|*******************************
|** Part 1. Installation ************
|*******************************
001. Go to website software.intel.com
002. Click on “Free non-commercial” under “Tools & Downloads”
003. Download “Intel® C++ Composer XE 2011 for Linux” and “Intel® Math Kernel Library (Intel® MKL) for Linux”, your email-box will receive letter, which contains the series number for installation.
004. Unpack those two package files, then in each main folder, run:
[bash]
sudo ./install.sh
[/bash]
005. Choose default setting with series number. Then installed files should be in /opt/intel/
006. Edit the .bashrc file in your user’s home folder, add following codes. Those two path are supposed to be your file location, it make change a little. And “ia32″ is the parameter of platform, you can choose what you want following the instruction in file iccvars.sh and mklvars.sh.
[bash]
source /opt/intel/compilerpro-12.0.1.107/bin/iccvars.sh ia32
source /opt/intel/mkl/bin/mklvars.sh ia32
[/bash]
007. Save and close .bashrc file, run:
[bash]
source ~/.bashrc
[/bash]
008. test path:
[bash]
which icc
[/bash]
|*******************************
|** Part 2. Linking in Program ******
|*******************************
009. Add MKL 10.x header file INCLUDE path in your compiler command line, your makefile or configure file. (default: /opt/intel/mkl/10.x.x.xxx/include)
010. Add MKL 10.x library path in your compiler command line, your makefile or configure file. (default: /opt/intel/mkl/10.x.x.xxx/lib/32)
011. Specify the corresponding libraries in your compiler command line, your makefile or configure file.
With static link, they are as follows:
[bash]
-Wl,–start-group
/opt/intel/mkl/10.0.xxx/lib/32/libmkl_intel.a
/opt/intel/mkl/10.0.xxx/lib/32/libmkl_intel_thread.a
/opt/intel/mkl/10.0.xxx/lib/32/libmkl_core.a
Wl,–end-group
/opt/intel/mkl/10.0.xxx/lib/32/libiomp5md.so -lpthread -lm
[/bash]
With dynamic link,
[bash]
-L/opt/intel/mkl/10.0.xxx/lib/32/
-lmkl_intel.so -lmkl_intel_thread.so -lmkl_core.so [-liomp5md]
[-lpthread] [-lm]
[/bash]
the path maybe slightly different due to different installation, just take a look in the install folder.
Note 1: In case of using static linking, the interface layer, threading layer, and computation layer libraries must be enclosed in grouping symbols (<-Wl,--start-group, -Wl,--end-group).
Note 2: Specifying MKL library path in the link command line is required. For example, -L/opt/intel/mkl/10.x.xxx/lib/32, so that the linker can search for real archive libraries.
Note 3: The order of listing libraries in the link line is essential, except for the libraries enclosed in the grouping symbols.
012. Set MKL library path to LD_LIBRARY_PATH environment variable before running application, e.g.,
[bash]
export LD_LIBRARY_PATH=/opt/intel/mkl/10.x.x.xxx/lib/32:$LD_LIBRARY_PATH
[/bash]
References Source:
http://software.intel.com/en-us/articles/performance-tools-for-software-developers-for-easily-migrating-from-mkl-9x-to-10x/
http://www.sciencenet.cn/m/user_content.aspx?id=362146