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

Slides:



Advertisements
Similar presentations
Chapter 9 Approximating Eigenvalues
Advertisements

Computational Physics Linear Algebra Dr. Guy Tel-Zur Sunset in Caruaru by Jaime JaimeJunior. publicdomainpictures.netVersion , 14:00.
Introduction to MATLAB for Biomedical Engineering BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Lesson 2: Element-wise vs. matrix operations.
Chapter 2 Solutions of Systems of Linear Equations / Matrix Inversion
Scientific Computing QR Factorization Part 2 – Algorithm to Find Eigenvalues.
Linear Algebra Applications in Matlab ME 303. Special Characters and Matlab Functions.
Algebraic, transcendental (i.e., involving trigonometric and exponential functions), ordinary differential equations, or partial differential equations...
Numerical Analysis 1 EE, NCKU Tien-Hao Chang (Darby Chang)
MATH 685/ CSI 700/ OR 682 Lecture Notes
Scientific Computing Linear Systems – Gaussian Elimination.
Solving Linear Systems (Numerical Recipes, Chap 2)
LU Factorization LU-factorization Matrix factorization Forward substitution Back substitution.
SOLVING SYSTEMS OF LINEAR EQUATIONS. Overview A matrix consists of a rectangular array of elements represented by a single symbol (example: [A]). An individual.
Lecture 9: Introduction to Matrix Inversion Gaussian Elimination Sections 2.4, 2.5, 2.6 Sections 2.2.3, 2.3.
Chapter 2, Linear Systems, Mainly LU Decomposition.
By Hrishikesh Gadre Session II Department of Mechanical Engineering Louisiana State University Engineering Equation Solver Tutorials.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 12 System of Linear Equations.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 17 Solution of Systems of Equations.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 14 Elimination Methods.
ECIV 520 Structural Analysis II Review of Matrix Algebra.
Ordinary least squares regression (OLS)
ECIV 301 Programming & Graphics Numerical Methods for Engineers REVIEW II.
MOHAMMAD IMRAN DEPARTMENT OF APPLIED SCIENCES JAHANGIRABAD EDUCATIONAL GROUP OF INSTITUTES.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion.
Arithmetic Operations on Matrices. 1. Definition of Matrix 2. Column, Row and Square Matrix 3. Addition and Subtraction of Matrices 4. Multiplying Row.
CE 311 K - Introduction to Computer Methods Daene C. McKinney
Scientific Computing Linear Systems – LU Factorization.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Presentation on Matrices and some special matrices In partial fulfillment of the subject Vector calculus and linear algebra ( ) Submitted by: Agarwal.
Chapter 3: The Fundamentals: Algorithms, the Integers, and Matrices
1 Intel Mathematics Kernel Library (MKL) Quickstart COLA Lab, Department of Mathematics, Nat’l Taiwan University 2010/05/11.
MATLAB Tutorials Session I Introduction to MATLAB Rajeev Madazhy Dept of Mechanical Engineering LSU.
ΑΡΙΘΜΗΤΙΚΕΣ ΜΕΘΟΔΟΙ ΜΟΝΤΕΛΟΠΟΙΗΣΗΣ 4. Αριθμητική Επίλυση Συστημάτων Γραμμικών Εξισώσεων Gaussian elimination Gauss - Jordan 1.
By: David McQuilling and Jesus Caban Numerical Linear Algebra.
CMPS 1371 Introduction to Computing for Engineers MATRICES.
Lecture 28: Mathematical Insight and Engineering.
Computing Eigen Information for Small Matrices The eigen equation can be rearranged as follows: Ax = x  Ax = I n x  Ax - I n x = 0  (A - I n )x = 0.
 6.2 Pivoting Strategies 1/17 Chapter 6 Direct Methods for Solving Linear Systems -- Pivoting Strategies Example: Solve the linear system using 4-digit.
Lecture 8 Matrix Inverse and LU Decomposition
MATH 685/ CSI 700/ OR 682 Lecture Notes Lecture 4. Least squares.
Lesson 3 CSPP58001.
A string is an array of characters Strings have many uses in MATLAB Display text output Specify formatting for plots Input arguments for some functions.
PARALLELIZATION OF MULTIPLE BACKSOLVES James Stanley April 25, 2002 Project #2.
3.6 Solving Systems Using Matrices You can use a matrix to represent and solve a system of equations without writing the variables. A matrix is a rectangular.
Linear Algebra Libraries: BLAS, LAPACK, ScaLAPACK, PLASMA, MAGMA
Copyright © Cengage Learning. All rights reserved. 2 SYSTEMS OF LINEAR EQUATIONS AND MATRICES Warm Up Read pp up to and including the box labeled.
1 Chapter 7 Numerical Methods for the Solution of Systems of Equations.
Lecture 6 - Single Variable Problems & Systems of Equations CVEN 302 June 14, 2002.
1. Systems of Linear Equations and Matrices (8 Lectures) 1.1 Introduction to Systems of Linear Equations 1.2 Gaussian Elimination 1.3 Matrices and Matrix.
Linear Systems Dinesh A.
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
Linear Algebra Libraries: BLAS, LAPACK, ScaLAPACK, PLASMA, MAGMA Shirley Moore CPS5401 Fall 2013 svmoore.pbworks.com November 12, 2012.
Unit #1 Linear Systems Fall Dr. Jehad Al Dallal.
Matrices. Variety of engineering problems lead to the need to solve systems of linear equations matrixcolumn vectors.
Computational Physics (Lecture 7) PHY4061. Eigen Value Problems.
Numerical Computation Lecture 6: Linear Systems – part II United International College.
05/23/11 Evaluation and Benchmarking of Highly Scalable Parallel Numerical Libraries Christos Theodosiou User and Application Support.
Chapter 2, Linear Systems, Mainly LU Decomposition
Computer Application in Engineering Design
Linear Systems, Mainly LU Decomposition
INTRODUCTION TO BASIC MATLAB
MATLAB EXAMPLES Matrix Solution Methods
CSCI N207 Data Analysis Using Spreadsheet
Numerical Analysis Lecture14.
Numerical Analysis Lecture10.
Presented By Farheen Sultana Ist Year I SEM
Maths for Signals and Systems Linear Algebra in Engineering Lecture 18, Friday 18th November 2016 DR TANIA STATHAKI READER (ASSOCIATE PROFFESOR) IN SIGNAL.
Lecture 8 Matrix Inverse and LU Decomposition
Chapter 2, Linear Systems, Mainly LU Decomposition
Ax = b Methods for Solution of the System of Equations:
Presentation transcript:

Intel Math Kernel Library Wei-Ren Chang, Department of Mathematics, National Taiwan University 2009/03/10

Introduction to MKL2 A brief introduction

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

Some information4

Intel MKL Reference Manual Some information5 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/ /doc/mklman.pdf)

user guide Some information6 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/ /doc/userguide.pdf)

Some examples7

Examples Some examples8 There are five brief examples: 1. Compute inner product.(sequential) 2. Compute the LU factorization of a matrix. 3. Solve linear system. 4. Solve eigensystem. 5. Compute inner product.(parallel)

The file names of the examples Some examples9 1. mkl_blas_f95 (mkl_blas_c) 2. mkl_lapack95_f95 (mkl_lapack95_c) 3. mkl_linearsym_f95 (mkl_linearsym_c) 4. mkl_eigensym_f95 (mkl_eigensym_c) 5. mkl_blas_f95_p (mkl_blas_c_p) There are more examples in the Folder: /opt/intel/mkl/ /examples

Inner product (sequential) Vectors and PlanesIntroduction to MATLAB10 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)

Input parameters Vectors and PlanesIntroduction to MATLAB11 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.

Output parameters Vectors and PlanesIntroduction to MATLAB12 dot_result: The final result.

Inner product (parallel) Vectors and PlanesIntroduction to MATLAB13 You have to reedit the makefile: FC=mpif90 MKL_INCLUDE =/opt/intel/mkl/ /include MKL_PATH =/opt/intel/mkl/ /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

LU factorization Vectors and PlanesIntroduction to MATLAB14 ! 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)

Input parameters Vectors and PlanesIntroduction to MATLAB15 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)

Output parameters Vectors and PlanesIntroduction to MATLAB16 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.

Linear System (fortran) Vectors and PlanesIntroduction to MATLAB17 ! 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)

Input parameters Vectors and PlanesIntroduction to MATLAB18 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)

Output parameters Vectors and PlanesIntroduction to MATLAB19 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.

Eigensystem (symmetric) Vectors and PlanesIntroduction to MATLAB20 ! 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)

Input parameters Vectors and PlanesIntroduction to MATLAB21 jobz : If jobz = 'N', then only eigenvalues are 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)

Output parameters Vectors and PlanesIntroduction to MATLAB22 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 tridiagonal form which did not converge to zero.

Reference Vectors and PlanesIntroduction to MATLAB23 Intel® Math Kernel Library Reference Manual Intel® Math Kernel Library for the Linux* OS User’s Guide