Seungwoo Lee KISTI Supercomputing Center Moasys Corp. Intel® Math Kernel Library 1.
Intel® Math Kernel Library 10.3 Windows -
Transcript of Intel® Math Kernel Library 10.3 Windows -
Intel® Math Kernel Library 10.3
Windows
2012 3 26
MKL
Copyright © 1998-2012 XLsoft Corporation. All Rights Reserved. 2
Windows* Linux* Mac OS*
Intel CVF Microsoft Intel GNU Intel GNU
.lib .dll .a .so .a .dylib
Fortran77 Fortran95/99 C/C++
BLAS ✔ ✔ CBLAS
Sparse BLAS Level 1 ✔ ✔ CBLAS
Sparse BLAS Level 2&3 ✔ ✔ ✔
LAPACK ✔ ✔ ✔
ScaLAPACK ✔
PARDISO ✔ ✔ ✔
DSS & ISS ✔ ✔ ✔
VML / VSL ✔ ✔ ✔
FFT / Cluster FFT ✔ ✔
PDEs ✔ ✔
Optimization (TR) Solvers ✔ ✔ ✔
SSL ✔ ✔ ✔
Copyright © 1998-2012 XLsoft Corporation. All Rights Reserved. 3
¥Composer XE 2011 SP1¥bin ¥ipsxe-comp-vars.bat intel64 vs2010
¥Inspector XE 2011¥ inspxe-vars.bat
¥VTune Amplifier XE 2011¥ amplxe-vars.bat
¥compilervars.bat intel64 vs2010
¥tbb¥bin¥tbbvars.bat intel64 vs2010
¥mkl¥bin¥mklvars.bat intel64 vs2010 MKLROOT=¥Composer XE 2011 SP1¥mkl PATH=¥Composer XE 2011 SP1¥redist¥intel64¥mkl
¥Composer XE 2011 SP1¥redist¥intel64¥compiler LIB= ¥Intel¥Composer XE 2011 SP1¥mkl¥lib¥intel64
¥Intel¥Composer XE 2011 SP1¥compiler¥lib¥intel64 INCLUDE= ¥Intel¥Composer XE 2011 SP1¥mkl¥include
¥ipp¥bin¥ippvars.bat intel64 vs2010 ¥compilervars_arch.bat intel64 vs2010
Windows [ ] ®
® 64 Visual Studio 2010
Fortran 95
Copyright © 1998-2012 XLsoft Corporation. All Rights Reserved. 4
< >¥mkl¥bin¥mklvars.bat
> mklvars.bat ia32 mod
INCLUDE= ¥Intel¥Composer XE 2011 SP1¥mkl¥include ¥Intel¥Composer XE 2011 SP1¥mkl¥include¥ia32
> mklvars.bat intel64 mod lp64
INCLUDE= ¥Intel¥Composer XE 2011 SP1¥mkl¥include ¥Intel¥Composer XE 2011 SP1¥mkl¥include¥intel64¥lp64
> mklvars.bat intel64 mod ilp64
INCLUDE= ¥Intel¥Composer XE 2011 SP1¥mkl¥include ¥Intel¥Composer XE 2011 SP1¥mkl¥include¥intel64¥ilp64
mod
Copyright © 1998-2012 XLsoft Corporation. All Rights Reserved. 5
http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor
< >¥Documentation¥en_US¥mkl¥mkl_link_line_advisor.htm
Copyright © 1998-2012 XLsoft Corporation. All Rights Reserved. 6
Single Dynamic Library (SDL) interface
SDL
CPU
CPU CPU CPU CPU
“mkl_rt.lib”
Copyright © 1998-2012 XLsoft Corporation. All Rights Reserved. 7
• cdecl / stdcall
• Integer LP64 / ILP64
• Sequential
• Thread
•
Windows
IA-32 mkl_intel_c.lib mkl_sequential.lib mkl_core.lib
IA-32 mkl_intel_c_dll.lib mkl_intel_thread_dll.lib mkl_core_dll.lib libiomp5md.lib
Intel64 mkl_intel_lp64.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib
Intel64 mkl_intel_ilp64_dll.lib mkl_sequential_dll.lib mkl_core_dll.lib
IA-32 / Intel64 SDL
mkl_rt.lib
MKL
• OpenMP
MKL Windows
Copyright © 1998-2012 XLsoft Corporation. All Rights Reserved. 8
IA-32 IA-32 Intel64 Intel64
mkl_intel_c.lib
cdecl
mkl_intel_c_dll.lib
cdecl
mkl_intel_lp64.lib
LP64
mkl_intel_lp64_dll.lib
LP64
mkl_intel_s.lib
stdcall
mkl_intel_s_dll.lib
stdcall
mkl_intel_ilp64.lib
ILP64
mkl_intel_ilp64_dll.lib
ILP64
mkl_rt.lib SDL mkl_rt.lib SDL
mkl_intel_thread.lib
mkl_intel_thread_dll.lib
mkl_intel_thread.lib
mkl_intel_thread_dll.lib
mkl_sequential.lib
mkl_sequential_dll.lib
mkl_sequential.lib
mkl_sequential_dll.lib
mkl_core.lib mkl_core_dll.lib mkl_core.lib mkl_core_dll.lib
libiomp5md.lib libiomp5md.lib libiomp5md.lib libiomp5md.lib
※ MKL C:
Copyright © 1998-2012 XLsoft Corporation. All Rights Reserved. 9
1 Windows IA-32 ®
2 Windows Intel64 ®
4 Windows ®
3 Windows ® SDL
> icl myprog.c mkl_intel_c.lib mkl_sequential.lib mkl_core.lib
> icl myprog.c mkl_intel_lp64_dll.lib mkl_intel_thread_dll.lib
mkl_core_dll.lib libiomp5md.lib
> ifort myprog.f mkl_intel_c.lib mkl_sequential.lib mkl_core.lib
> ifort myprog.f mkl_intel_lp64_dll.lib mkl_intel_thread_dll.lib
mkl_core_dll.lib libiomp5md.lib
> icc myprog.c mkl_rt.lib
> ifort myprog.f mkl_rt.lib
> icc myprog.c /Qmkl:parallel /MT
> ifort myprog.f /Qmkl:parallel /MT
Visual Studio
Copyright © 1998-2012 XLsoft Corporation. All Rights Reserved. 10
MKL
MKL
MKL
[ ]
VS2005/2008 ® C++ Composer XE
Copyright © 1998-2012 XLsoft Corporation. All Rights Reserved. 11
Visual Studio 2005/2008 ® C++ Composer XE
[]
[ ]
[C/C++]‐[ ]‐[ ] /MT /MD
VS2010 ® C++ Composer XE
Copyright © 1998-2012 XLsoft Corporation. All Rights Reserved. 12
Visual Studio 2010 ® C++ Composer XE
[ ] (R)
MKL
[ ]
[C/C++]‐[ ]‐[ ] /MT/MD
VS ® Visual Fortran Composer XE
Copyright © 1998-2012 XLsoft Corporation. All Rights Reserved. 13
® Visual Fortran Composer XE
[ ] (R)
MKL
[ ]
[Fortran]‐[ ]‐[ ]
MKL
Copyright © 1998-2012 XLsoft Corporation. All Rights Reserved. 14
C:¥Program Files (x86)¥Intel¥Composer XE 2011 SP1¥redist¥intel64¥mkl
< >¥redist¥ia32¥mkl¥*.dll
< >¥redist¥intel64¥mkl¥*.dll
MKL
※ < >¥Documentation¥ja_JP¥mkl¥redist.txt
MKL
Copyright © 1998-2012 XLsoft Corporation. All Rights Reserved. 15
< >¥redist¥ia32¥compiler¥libiomp5md.dll
< >¥redist¥intel64¥compiler¥libiomp5md.dll
OpenMP libiomp5md.dll
MKL
libiomp5md.dll
※ URL
http://software.intel.com/en-us/articles/redistributable-libraries-for-the-intel-c-and-visual-fortran-composer-xe-for-windows/
Copyright © 1998-2012 XLsoft Corporation. All Rights Reserved. 16
MKL
MKL [ ] ‐ [ ] ‐[ ]
MKL OpenMP
MKL
MKL
MKL /MT
MKL_DYNAMIC=TRUE
MKL_DYNAMIC=FALSE
mkl_set_dynamic()
Copyright © 1998-2012 XLsoft Corporation. All Rights Reserved. 17
OMP_NUM_THREADS MKL_NUM_THREADS MKL_DOMAIN_NUM_THREADS
omp_set_num_threads() ; mkl_set_num_threads() ; mkl_domain_set_num_threads() ;
※
MKL > OpenMP
mkl_domain_set_... > mkl_set_... >
1. mkl_domain_set_num_threads(); 2. MKL_DOMAIN_NUM_THREADS 3. mkl_set_num_threads(); 4. MKL_NUM_THREADS 5. omp_set_num_threads(); 6. OMP_NUM_THREADS
Windows
mkl_domain_set_num_threads ( 2, MKL_BLAS );
MKL_DOMAIN_NUM_THREADS="MKL_ALL=1, MKL_BLAS=4"
mkl_set_num_threads(2);
MKL_NUM_THREADS=4
omp_set_num_threads(2);
OMP_NUM_THREADS=4
Tips
Copyright © 1998-2012 XLsoft Corporation. All Rights Reserved. 18
16
mkl_malloc
mkl_malloc( sizeof(double)*workspace, 16 );
mkl_free( darray );
HT
HT
set KMP_AFFINITY=granularity=fine,compact,1,0
/FTZ /DAZ
MKL
Copyright © 1998-2012 XLsoft Corporation. All Rights Reserved. 19
MKL
→
mkl_mem_stat()
mkl_free_buffers()
MKL_DISABLE_FAST_MM mkl_disable_fast_mm()
MKL
Copyright © 1998-2012 XLsoft Corporation. All Rights Reserved. 20
< >¥mkl¥examples¥
MKL
Make
C:¥Program Files (x86)¥Intel¥Composer XE 2011 SP1¥mkl¥examples