Documente Academic
Documente Profesional
Documente Cultură
Dense Matrix
Sparse Matrix
Sparse Matrices
! Non-zeros encode connectivity
! Finite-Element Meshes, Hyperlinks, Social Networks,
Structured Mesh
Unstructured Mesh
General Graph
Sparse Solvers
! Solve sparse linear system (A*x = b) ! Variety of direct and iterative methods
Direct Solvers
! Sparse matrix factorization
! Try to reduce fill-in of factors ! Use sophisticated reordering schemes
Iterative Solvers
! Sequence of approximate solutions
! Converge to exact solution
Comparison
Direct Solvers ! ! ! ! ! Robust Black-box operation Difficult to parallelize Memory consumption Limited scalability Iterative Solvers ! ! ! ! ! Breakdown issues Lots of parameters Amenable to parallelism Low memory footprint Scalable
r = b while x = r =
1 0 5 0
7 2 0 6
0 8 3 0
0 0 9 4
0 0 1
0 1 7
1 1 2
1 2 8
2 0 5
2 2 3
2 3 9
3 1 6
Matrix # entries
10
1 0 5 0
7 2 0 6
0 8 3 0
0 0 9 4
0 0 1
2 1 7
4 1 2
7 2 8
9 0 5 2 3 3 9 1 6 3 4
Matrix # entries
11
padding 1 2 5 6 7 8 3 4 * * 9 * # rows
1 0 5 0
7 2 0 6
0 8 3 0
0 0 9 4
0 1 0 1
1 2 1 3
* * 2 *
Matrix
column indices
values
12
1 0 5 0
7 2 0 6
0 8 3 0
0 0 9 4
* * 5 6
1 2 3 4
7 8 9 * # rows
Matrix
values
13
1 2 1 3
1 2 5 6
7 8 3 4
0 1
column indices
values
Matrix
Structured
Unstructured
15
16
Matrix
17
18
Matrix
19
20
Matrix
21
22
Matrix
23
Summary
! Iterative Solvers
! Measure accuracy through residual (b A*x) ! Stop when ||b A*x|| is small
! Sparse Formats
! Numerous Options ! Best format depends on matrix structure
! Next Lesson
! Implementing Sparse Matrix-Vector Multiplication
24
References
Implementing Sparse Matrix-Vector Multiplication on Throughput-Oriented Processors Nathan Bell and Michael Garland Proceedings of Supercomputing '09 Efficient Sparse Matrix-Vector Multiplication on CUDA Nathan Bell and Michael Garland NVIDIA Technical Report NVR-2008-004, December 2008 Iterative Methods for Sparse Linear Systems Yousef Saad http://www-users.cs.umn.edu/~saad/IterMethBook_2ndEd.pdf (online)
25