CS 575 Supercomputing
Vectors and Loops
(Complement Ch 8 - Loop Optimization)
22 October 03

Dr. Kris Stewart (stewart@rohan.sdsu.edu)
San Diego State University

Why so much emphasis on loops?

Key Concepts:

Uniform, independent operations with good memory accessing patterns using unit stride.

Vector-vector add:
Yn+1 = YN + h * F(xN,YN)
SAXPY operation is fundamental computational in solving Ordinary Differential Equations (Y' = A Y) as well as Linear Equations (A x = b) .

Matrix-vector multiply (as a SAXPY):
b = A x = x1 A*1 + x2 A*2 + x3 A*3 + ... + xn A*N
where A*2 refers to the Column 2 of the matrix A.

Matrix-matrix multiply: C = A B

Guiding principal is that once you have moved data from memory to the cache or the registers of the CPU, your program should be organized to accomplish as many of the operations involving the data as possible.

Fig. A-3 Vector processor registers

© O'Reilly Publishers (Used with permission)

Fig. A-4 A vector processor at work

© O'Reilly Publishers (Used with permission)

CS 575 Ch 8 Loop Opt