1 Intel Mathematics Kernel Library (MKL) Quickstart COLA Lab, Department of Mathematics, Nat’l Taiwan University 2010/05/11.

Slides:



Advertisements
Similar presentations
Yafeng Yin, Lei Zhou, Hong Man 07/21/2010
Advertisements

Computational Physics Linear Algebra Dr. Guy Tel-Zur Sunset in Caruaru by Jaime JaimeJunior. publicdomainpictures.netVersion , 14:00.
Chapter 28 – Part II Matrix Operations. Gaussian elimination Gaussian elimination LU factorization LU factorization Gaussian elimination with partial.
Lecture 19: Parallel Algorithms
Chapter 2 Solutions of Systems of Linear Equations / Matrix Inversion
§ 3.4 Matrix Solutions to Linear Systems.
Algebraic, transcendental (i.e., involving trigonometric and exponential functions), ordinary differential equations, or partial differential equations...
Advanced Computational Software Scientific Libraries: Part 2 Blue Waters Undergraduate Petascale Education Program May 29 – June
MATH 685/ CSI 700/ OR 682 Lecture Notes
1 Parallel Algorithms II Topics: matrix and graph algorithms.
Solving Linear Systems (Numerical Recipes, Chap 2)
Chapter 2, Linear Systems, Mainly LU Decomposition.
1cs542g-term Notes  Assignment 1 will be out later today (look on the web)
1cs542g-term Notes  Assignment 1 is out (questions?)
Some useful linear algebra. Linearly independent vectors span(V): span of vector space V is all linear combinations of vectors v i, i.e.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 14 Elimination Methods.
Introduction to Parallel Computing Intel Math Kernel Library Huan-Ting Yen, Department of Mathematics, National Taiwan University 2011/07/22.
ECIV 520 Structural Analysis II Review of Matrix Algebra.
Ordinary least squares regression (OLS)
CE 311 K - Introduction to Computer Methods Daene C. McKinney
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Solving Scalar Linear Systems Iterative approach Lecture 15 MA/CS 471 Fall 2003.
1 Using the PETSc Parallel Software library in Developing MPP Software for Calculating Exact Cumulative Reaction Probabilities for Large Systems (M. Minkoff.
Sobolev Showcase Computational Mathematics and Imaging Lab.
By: David McQuilling and Jesus Caban Numerical Linear Algebra.
Problem Solving with NetSolve Michelle Miller, Keith Moore,
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.
Lecture 8 Matrix Inverse and LU Decomposition
Lecture 7 - Systems of Equations CVEN 302 June 17, 2002.
Intel Math Kernel Library Wei-Ren Chang, Department of Mathematics, National Taiwan University 2009/03/10.
Chapter 5 MATRIX ALGEBRA: DETEMINANT, REVERSE, EIGENVALUES.
MATH 685/ CSI 700/ OR 682 Lecture Notes Lecture 4. Least squares.
Lesson 3 CSPP58001.
Chapter 1: Brief Overview of MATLAB MATLAB for Scientist and Engineers Using Symbolic Toolbox.
PARALLELIZATION OF MULTIPLE BACKSOLVES James Stanley April 25, 2002 Project #2.
Linear Algebra Diyako Ghaderyan 1 Contents:  Linear Equations in Linear Algebra  Matrix Algebra  Determinants  Vector Spaces  Eigenvalues.
Linear Algebra Libraries: BLAS, LAPACK, ScaLAPACK, PLASMA, MAGMA
Linear Algebra Diyako Ghaderyan 1 Contents:  Linear Equations in Linear Algebra  Matrix Algebra  Determinants  Vector Spaces  Eigenvalues.
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.
Gaoal of Chapter 2 To develop direct or iterative methods to solve linear systems Useful Words upper/lower triangular; back/forward substitution; coefficient;
Parallel Programming & Cluster Computing Linear Algebra Henry Neeman, University of Oklahoma Paul Gray, University of Northern Iowa SC08 Education Program’s.
Linear Algebra Libraries: BLAS, LAPACK, ScaLAPACK, PLASMA, MAGMA Shirley Moore CPS5401 Fall 2013 svmoore.pbworks.com November 12, 2012.
Intro to Scientific Libraries Intro to Scientific Libraries Blue Waters Undergraduate Petascale Education Program May 29 – June
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.
SimTK 1.0 Workshop Downloads Jack Middleton March 20, 2008.
1 SYSTEM OF LINEAR EQUATIONS BASE OF VECTOR SPACE.
Computational Physics (Lecture 7) PHY4061. Eigen Value Problems.
TEMPLATE DESIGN © H. Che 2, E. D’Azevedo 1, M. Sekachev 3, K. Wong 3 1 Oak Ridge National Laboratory, 2 Chinese University.
Introduction The central problems of Linear Algebra are to study the properties of matrices and to investigate the solutions of systems of linear equations.
Introduction The central problems of Linear Algebra are to study the properties of matrices and to investigate the solutions of systems of linear equations.
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
A computational loop k k Integration Newton Iteration
Linear Systems, Mainly LU Decomposition
INTRODUCTION TO BASIC MATLAB
Nathan Grabaskas: Batched LA and Parallel Communication Optimization
MATLAB EXAMPLES Matrix Solution Methods
Numerical Analysis Lecture14.
Numerical Analysis Lecture10.
Eigenvalues and Eigenvectors
Matrix Eigensystem Tutorial For Parallel Computation
Lecture 13 Simultaneous Linear Equations – Gaussian Elimination (2) Partial Pivoting Dr .Qi Ying.
A computational loop k k Integration Newton Iteration
Chapter 2, Linear Systems, Mainly LU Decomposition
Ax = b Methods for Solution of the System of Equations:
Presentation transcript:

1 Intel Mathematics Kernel Library (MKL) Quickstart COLA Lab, Department of Mathematics, Nat’l Taiwan University 2010/05/11

2 Intel MKL Quickstart Credits  Wei-Ren Chang 張為仁 (slides and codes, 2009/03/10)  Lien-Chi Lai 賴鍊奇 (slides, 2010/05/11)

3 Intel MKL Quickstart A Brief Introduction

4 Intel MKL Quickstart Intel MKL: Intel Math Kernel Library Introduction  Availability: Windows, Linux  Functionality  Dense and Sparse Linear Algebra: BLAS, LAPACK  Sparse Solvers: Direct and Iterative Solvers  Fast Fourier Transforms  Cluster Support: ScaLAPACK, Cluster FFT  Features and Benefits  Automatic parallelization  Standard APIs in C and Fortran

5 Intel MKL Quickstart User Guide  MKL User Guide  Installation  Development Environment Configuration  Performance and Memory Management  Language-specific Usage Options  Default documents directory  /opt/intel/mkl/ /doc/userguide.pdf User Guide

6 Intel MKL Quickstart Reference Manual  MKL Reference Manual  The routines and functions description  APIs in C and Fortran  Interfaces and calling syntax  Default documents directory  /opt/intel/mkl/ /doc/mklman.pdf Reference Manual

7 Intel MKL Quickstart Some Examples

8 Intel MKL Quickstart Examples  Brief examples to  Compute Inner product (sequential)  Compute the LU factorization of a matrix  Solve linear system  Solve eigen system  Compute Inner product (parallel) Examples

9 Intel MKL Quickstart Directories containing the source codes  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) File names

10 Intel MKL Quickstart Inner product (sequential) Examples 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) Inner product

11 Intel MKL Quickstart Input parameters Inner product dot_result = ddot(n,vec_a,inca,vec_b,incb)  n: The length of two vectors.  inca: Specifies the increment for the elements of vec_a  incb: Specifies the increment for the elements of vec_b  vec_a: The fitsr vector  vec_b: The second vector Input parameters

12 Intel MKL Quickstart Output parameters Inner product  dot_result: The final result Output parameters

13 Intel MKL Quickstart Inner product (parallel) Examples  Makefile clips 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 Inner product (parallel)

14 Intel MKL Quickstart LU factorization Examples  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) LU factorization

15 Intel MKL Quickstart Input parameters LU factorization call dgetrf(m,n,a,lda,ipiv,info)  a: The matrix.  m: The number of rows in the matrix a  n: The number of columns in the matrix a  lda: The fitsr dimension of a Input parameters

16 Intel MKL Quickstart Output parameters LU factorization call dgetrf(m,n,a,lda,ipiv,info)  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 is interchanged with row ipiv(i)  info:  info=0, the execution is successful  info=-i, the i-th parameter had an illegal value  info= i, uii is 0. The factorization has been completed, but U is exactly singular Output parameters

17 Intel MKL Quickstart Linear System (Fortran) Examples  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,ths,ldb,info) Linear System

18 Intel MKL Quickstart Input parameters Linear System call dgesv(n,nrhs,a,lda,ipiv,ths,ldb,info)  n: The number of linear equations, that is, the order of the matrix a  rhs: Right-hand side  lda: The leading dimension of matrix a  nrhs: The number of right-hand sides Input parameters

19 Intel MKL Quickstart Output parameters Linear System call dgesv(n,nrhs,a,lda,ipiv,ths,ldb,info)  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:  info=0, the execution is successful  info=-i, the i-th parameter had an illegal value  info= i, U(i,i) is 0. The factorization has been completed, but U is exactly singular, so the solution could not be computed Output parameters

20 Intel MKL Quickstart Eigensystem (symmetric) Examples  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) Eigensystem

21 Intel MKL Quickstart Input parameters Eigensystem call dsyev(jobz,uplo,dim,a,lda,eigval,work,lwork,info)  jobz: If jobz='N', then only eigenvalues are computed  jobz: If jobz='V', then eigenvalues are eigenvectors are computed  uplo: If uplo='U', a stores the upper triangular part of a  uplo: If uplo='L', a stores the lower triangular part of a  lda: The first dimension of a  work: a workspace array, its dimension max(1,lwork)  lwork: The dimension of the array work Input parameters

22 Intel MKL Quickstart Output parameters call dsyev(jobz,uplo,dim,a,lda,eigval,work,lwork,info)  wigval: contains the eigenvalues of the matrix a in ascending order  info:  info=0, the execution is successful  info=-i, the i-th parameter had an illegal value  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 Output parametersEigensystem

23 Intel MKL Quickstart References

24 Intel MKL Quickstart Reference  Intel® Math Kernel Library Reference Manual (mklman.pdf)  Intel® Math Kernel Library for the Linux OS User’s Guide (userguide.pdf)  Reference