Docsity

6 Questions on Supercomputers for Sequential and Parallel Computers | CS 6300, Assignments of Computer Science

Toggle sidebar
bg1
Homework 3
Page 1
Supercompilers
Homework 3
Due February 9, 2009
30 Points
1. Apply the codegen algorithm to the following code. Make sure you show the complete
dependence graph and show what happens at each recursive call.
DO K = 1, 100
DO J = 1, 100
S
1 B( 1, J, K ) = A( 1, J-1, K )
DO I = 1, 100
S
2 A( I+1, J, K ) = b(I, 100-J, K) + C
ENDDO
ENDDO
ENDDO
2. In each of the following examples, suppose you are testing for dependence of statement S
upon itself. Which subscript positions are separable? Which are coupled? Which
dependence test would be applied to each position by the dependence testing procedure?
a. DO K = 1, 100
DO J = 1, 100
DO I = 1, 100
S A(I+1,J+1,K+1) = A(I,J,1) + C
ENDDO
ENDDO
ENDDO
b. DO K = 1, 100
DO J = 1, 100
DO I = 1, 100
S A(I+1, J+K+1, K+1) = A(I, J, K) + C
ENDDO
ENDDO
ENDDO
c. DO K = 1, 100
DO J = 1, 100
DO I = 1, 100
S A(I+1, J+K+1, I) = A(I, J, 2) + C
ENDDO
ENDDO
ENDDO
pf2

Partial preview of the text

Download 6 Questions on Supercomputers for Sequential and Parallel Computers | CS 6300 and more Assignments Computer Science in PDF only on Docsity!

Homework 3 Page 1

Supercompilers

Homework 3

Due February 9, 2009

30 Points

1. Apply the codegen algorithm to the following code. Make sure you show the complete

dependence graph and show what happens at each recursive call.

DO K = 1, 100

DO J = 1, 100

S 1 B( 1, J, K ) = A( 1, J-1, K )

DO I = 1, 100

S 2 A( I+1, J, K ) = b(I, 100-J, K) + C ENDDO ENDDO ENDDO

2. In each of the following examples, suppose you are testing for dependence of statement S

upon itself. Which subscript positions are separable? Which are coupled? Which

dependence test would be applied to each position by the dependence testing procedure?

a. DO K = 1, 100

DO J = 1, 100

DO I = 1, 100

S A(I+1,J+1,K+1) = A(I,J,1) + C

ENDDO

ENDDO

ENDDO

b. DO K = 1, 100

DO J = 1, 100

DO I = 1, 100

S A(I+1, J+K+1, K+1) = A(I, J, K) + C

ENDDO

ENDDO

ENDDO

c. DO K = 1, 100

DO J = 1, 100

DO I = 1, 100

S A(I+1, J+K+1, I) = A(I, J, 2) + C

ENDDO

ENDDO

ENDDO

Homework 3 Page 2

3. In the following example, compute the entire set of direction vectors for all potential

dependences in the loop. Be specific about the type of dependence in each case.

Describe the tests that would be used by the dependence tester on this example.

DO K = 1, 100

DO J = 1, 100

DO I = 1, 100

S 1 A(I+1,J+4,K+1) = B(I,J,K) + C

S 2 B(I+J,5,K+1) = A(2,K,K) + D

ENDDO

ENDDO

ENDDO

4. For the following examples, construct valid breaking conditions.

a. DO I = 1, 100

S A(I+IX) = A(I) + C

ENDDO

b. DO K = 1, 100

DO J = 1, 100

DO I = 1, 100

S A(I+1,J+1,K+1) = A(I,JX,K) + C

ENDDO

ENDDO

ENDDO

c. DO K = 1, 100

DO J = 1, 100

DO I = 1, 100

S A(I+1,J+K+JX) = A(I,J) + C

ENDDO

ENDDO

ENDDO

5. Given the code segment below:

DO I = 1, 100

A(3*I) = …

… = A(2*I+1)

ENDDO

a. What is the dependence equation and inequalities for the two array references for

detecting true, loop-independent dependences between them? Do they have a

solution?

b. What is the dependence equation and inequalities for the two array references for

detecting true, loop-dependent dependences between them?

c. Perform the GCD test on the equation in b and state the significance of your test.

6. Is there a dependence in the following loop nest? Explain your answer including the

dependence test you use.

DO J = 1, 100

DO I = 1, 100

A(I,I) = A(I-1, I-J)

ENDDO

ENDDO