1 / 23

Intel Math Kernel Library

Intel Math Kernel Library. Wei- Ren Chang , Department of Mathematics, National Taiwan University 2009/03/10. A brief introduction. Introduction. MKL offers highly optimized, thread-safe math routines for science, engineering, and financial applications that

kaylee
Télécharger la présentation

Intel Math Kernel Library

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Intel Math Kernel Library Wei-Ren Chang, Department of Mathematics, National Taiwan University2009/03/10

  2. A brief introduction

  3. Introduction MKL offers highly optimized, thread-safe math routines for science, engineering, and financial applications that require maximum performance.

  4. Some information

  5. Intel MKL Reference Manual Reference information covers routine functionality, parameter descriptions, interfaces and calling syntax as well as return values. To get this information, see Intel MKL Reference Manual first. (/opt/intel/mkl/10.0.3.020/doc/mklman.pdf)

  6. user guide user guide focuses on the usage Information needed to call Intel MKL routines from user's applications running on the Linux* OS. Linux usage of Intel MKL has its particular features, which are described in this guide, along with those that do not depend upon a particular OS. (/opt/intel/mkl/10.0.3.020/doc/userguide.pdf)

  7. Some examples

  8. Examples There are five brief examples: • Compute inner product.(sequential) • Compute the LU factorization of a matrix. • Solve linear system. • Solve eigensystem. • Compute inner product.(parallel)

  9. The file names of the examples • mkl_blas_f95 (mkl_blas_c) • mkl_lapack95_f95 (mkl_lapack95_c) • mkl_linearsym_f95 (mkl_linearsym_c) • mkl_eigensym_f95 (mkl_eigensym_c) • mkl_blas_f95_p (mkl_blas_c_p) There are more examples in the Folder: /opt/intel/mkl/10.0.3.020/examples

  10. Inner product (sequential) do ii = 1,n vec_a(ii) = 1.25*ii vec_b(ii) = 0.75*ii end do dot_result = ddot(n,vec_a,inca,vec_b,incb) Introduction to MATLAB

  11. Input parameters n : The length of two vectors. (Here n = 5) inca : Specifies the increment for the elements of vec_a. (Here inca = 1) incb: Specifies the increment for the elements of vec_b. (Here incb = 1) vec_a : The first vector. vec_b: The second vector. Introduction to MATLAB

  12. Output parameters dot_result: The final result. Introduction to MATLAB

  13. Inner product (parallel) You have to reedit the makefile: FC=mpif90 MKL_INCLUDE =/opt/intel/mkl/10.0.3.020/include MKL_PATH =/opt/intel/mkl/10.0.3.020/lib/em64t EXE=blas_f95.exe blas_f: $(FC) -o $(EXE) blas_f.f90 -I$(MKL_INCLUDE) -L$(MKL_PATH) -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lguide -lpthread Introduction to MATLAB

  14. LU factorization ! Define the matrix a(1,1) = 1 a(1,2) = 3 a(2,1) = 2 a(2,2) = 1 ! Compute LU factorization call dgetrf(m,n,a,lda,ipiv,info) Introduction to MATLAB

  15. Input parameters a : The matrix. m : The number of rows in the matrix a. n : The number of columns in the matrix a. lda : The first dimension of a. (Here lda = 2) Introduction to MATLAB

  16. Output parameters a : overwritten by L and U. The unit diagonal elements of L are skipped. ipiv: An array, dimension at least max(1,min(m, n)). The pivot indices: row i was interchanged with row ipiv(i). info : If info=0, the execution is successful. If info = -i, the i-th parameter had an illegal value. If info = i, uii is 0. The factorization has been completed, but U is exactly singular. Introduction to MATLAB

  17. Linear System (fortran) ! Define the matrix a(1,1) = 1 a(1,2) = 3 a(2,1) = 2 a(2,2) = 1 ! Define the right-hand side rhs(1) = 1.0 rhs(2) = 1.0 ! Solve the linear system call dgesv(n,nrhs,a,lda,ipiv,rhs,ldb,info) Introduction to MATLAB

  18. Input parameters n : The number of linear equations, that is, the order of the matrix A. (Here n = 2) rhs : Right-hand side. lda: The leading dimension of matrix A . (Here lda = 2) nrhs : The number of right-hand sides. (Here nrhs = 1) Introduction to MATLAB

  19. Output parameters ipiv: An array, dimension at least max(1,min(m, n)). The pivot indices: row i was interchanged with row ipiv(i). rhs: Overwritten by the solution matrix A info : If info=0, the execution is successful. If info = -i, the i-th parameter had an illegal value If info = i, U(i, i) is exactly zero. The factorization has been completed, but the factor U is exactly singular so the solution could not be computed. Introduction to MATLAB

  20. Eigensystem (symmetric) ! Define the matrixdsyev a(1,1) = 1.0 a(1,2) = 2.0 a(2,1) = 2.0 a(2,2) = 3.0 ! Call MKL function Call dsyev(jobz,uplo,dim,a,lda,eigval,work,lwork,info) Introduction to MATLAB

  21. Input parameters jobz: If jobz = 'N', then only eigenvaluesare computed. If jobz = 'V', then eigenvalues and eigenvectors are computed. uplo: If uplo = 'U', a stores the upper triangular part of A. If uplo = 'L', a stores the lower triangular part of A. lda : The first dimension of A. (Here lda = 2) work : a workspace array, its dimension max(1, lwork). lwork : The dimension of the array work. (lwork >= 2*lda+1) Introduction to MATLAB

  22. Output parameters wigval: contains the eigenvalues of the matrix A in ascending order. info : If info=0, the execution is successful. If info = -i, the i-th parameter had an illegal value. If info = i, then the algorithm failed to converge; i indicates the number of elements of an intermediate tridiagonalform which did not converge to zero. Introduction to MATLAB

  23. Reference Intel® Math Kernel Library Reference Manual Intel® Math Kernel Library for the Linux* OS User’s Guide Introduction to MATLAB

More Related