Presentation is loading. Please wait.

Presentation is loading. Please wait.

Intro to Scientific Libraries Intro to Scientific Libraries Blue Waters Undergraduate Petascale Education Program May 29 – June 10 2011.

Similar presentations


Presentation on theme: "Intro to Scientific Libraries Intro to Scientific Libraries Blue Waters Undergraduate Petascale Education Program May 29 – June 10 2011."— Presentation transcript:

1 Intro to Scientific Libraries Intro to Scientific Libraries Blue Waters Undergraduate Petascale Education Program May 29 – June 10 2011

2 Scientific Libraries BWUPEP2011, UIUC, May 29 - June 10 2011 2 Matrix Multiplication How would/did you program it? How about parallelizing it? -Hint: N 2 operations that look like “ab+cd” that all can be done independently What is the most efficient way?

3 Answers to the previous questions How would/did you program it? How about parallelizing it? Supercomputing in Plain English: Apps & Par Types BWUPEP2011, UIUC, May 29 - June 10 2011 3 Lazy answer #1: You don’t need to do either! What is the most efficient way? Lazy answer #2: It depends.

4 Explanation of Lazy Answer #1 Solution Quality: Don’t reinvent the wheel Supercomputing in Plain English: Apps & Par Types BWUPEP2011, UIUC, May 29 - June 10 2011 4 The solution of a large number of very smart people over many years Your solution

5 Scientific Libraries Loose Definition – A collection of mathematical optimized for various data types, computer architectures, numeric types, and scientific fields of study. Common example: Lapack- linear algebra library Supercomputing in Plain English: Apps & Par Types BWUPEP2011, UIUC, May 29 - June 10 2011 5

6 How to identify your matrix General Matrix – Nothing too special going on with it Banded Matrix – A lines of data going diagonally down the matrix. Tri-diagonal matrix- A 3-width banded matrix Symmetric matrix- Supercomputing in Plain English: Apps & Par Types BWUPEP2011, UIUC, May 29 - June 10 2011 6

7 The Sparse Matrix A larger matrix that is mostly empty. A good rule of thumb is approximately 90% - 95% empty. The opposite of a sparse matrix is a dense matrix. Supercomputing in Plain English: Apps & Par Types BWUPEP2011, UIUC, May 29 - June 10 2011 7

8 BLAS Basic Linear Algebra System Fundamental level of linear algebra libraries Various highly optimized implementations by vendors Many other libraries built on top of BLAS Create your own optimized implementation using ATLAS Three levels: Level 1- Vector-vector operations - Level 2- Matrix-vector operations - Level 3- Matrix-matrix operations – Supercomputing in Plain English: Apps & Par Types BWUPEP2011, UIUC, May 29 - June 10 2011 8

9 ATLAS Automatically Tuned Linear Algebra Software Performs a series of timed tests upon installation. These tests are used to tune the libraries for the individual system. Substantially faster on many systems. Supercomputing in Plain English: Apps & Par Types BWUPEP2011, UIUC, May 29 - June 10 2011 9

10 Atlas Performance Supercomputing in Plain English: Apps & Par Types BWUPEP2011, UIUC, May 29 - June 10 2011 10

11 Lapack Written on top of Basic Linear Algebra Subprograms (BLAS) Incorporates/retools EISPACK (eigenvalues) and LINPACK (least squares) Optimized for most modern shared memory architectures Supercomputing in Plain English: Apps & Par Types BWUPEP2011, UIUC, May 29 - June 10 2011 11 Eigenvalue = Eigenvector

12 Why LAPACK? Widely available. Lots of documentation and examples. Easy to use. Mostly preinstalled and tuned on most computers. Many versions are tuned for shared memory architectures. Since it is built on top of your BLAS installation, it’ll perform at least as well as BLAS. Supercomputing in Plain English: Apps & Par Types BWUPEP2011, UIUC, May 29 - June 10 2011 12

13 Beginner’s Guide to LAPACK First step: Install LAPACK -May involve installing BLAS first (Optional activity!) Supercomputing in Plain English: Apps & Par Types BWUPEP2011, UIUC, May 29 - June 10 2011 13 #1 RULE – Documentation is your friend!!

14 Beginner’s Guide to LAPACK Second step- Look up what you want to do. -Handy naming scheme: Supercomputing in Plain English: Apps & Par Types BWUPEP2011, UIUC, May 29 - June 10 2011 14 GEGeneral Matrix DIDiagonal Matrix GBGeneral Band Matrix GTTridiagonal Matrix HBHermitian Band matrix SYSymmetric matrix TRFFactorize TRSSolve TRIInvert RFSError bounds SReal DDouble CComplex ZComplex Double Data type + Matrix Type + Problem Not all subroutines have handy naming scheme. USE DOCUMENTATION

15 EXAMPLES Simple LAPACK call- DGEMM A bunch of calls repeated 1000 times Bonus demo-Difficult part of libraries! Supercomputing in Plain English: Apps & Par Types BWUPEP2011, UIUC, May 29 - June 10 2011 15

16 Leading dimensions? Supercomputing in Plain English: Apps & Par Types BWUPEP2011, UIUC, May 29 - June 10 2011 16 You have this: You want to perform an operation on this: LDA = M This occurs the most LDA = 3 M=2 N=2

17 General “ Don’t ”s Don’t invert a matrix if it can be avoided. It is computationally very expensive. Figure out a way around it. Don’t write your own solvers. If it is a common mathematical operation, someone else most likely spent a lot of time and effort solving for the most efficient method. Don’t attempt to use a library without consulting the documentation and attempting a few example problems. Don’t attempt to program a solution (especially with libraries) if you don’t understand the problem’s mathematics/science! Supercomputing in Plain English: Apps & Par Types BWUPEP2011, UIUC, May 29 - June 10 2011 17

18 Preview: Next Week DOE ACTs collection: 2 nd lazy answer- How do we decide what to use to optimize efficiency? Supercomputing in Plain English: Apps & Par Types BWUPEP2011, UIUC, May 29 - June 10 2011 18 ScaLAPACK


Download ppt "Intro to Scientific Libraries Intro to Scientific Libraries Blue Waters Undergraduate Petascale Education Program May 29 – June 10 2011."

Similar presentations


Ads by Google