(1.1) x(i) = a(i)*x(i-1) + b(i)*x(i-2), (i = 1, 2, ..., n)to be solved for x(2), x(3), ....., x(n), given the values of x(0) and x(1), and the coefficient a(i) and b(i). At first sight, the parallelism in (1.1) is not obvious. But if we reformulate the equation in matrix-vector notation. Write
| x(1) | | x(i) |
y(1) = | |, ..., y(i) = | |, (i=2, 3, ..., n)
| x(0) | | x(i-1) |
Then (1.1) can be written
| a(i) b(i) |
y(i) = M(i)*y(i-1), M(i) = | |, (i = 2, 3, ....., n)
| 1 0 |
therefore
| x(n) | | x(1) |
| | = y(n) = M(n) M(n-1) ... M(2)*| |
| x(n-1) | | x(0) |
Code the algorithm for data parallel computation (say, by pairwise or
fan-in multiplication) for sufficient large n,
say n=8k (8192).
You need to discuss in detail in your project on the implementation
data structure as well as any optimization techniques.
The coefficients a(i),b(i) can be assumed properly.
real A(M,N),b(N), x(M)
CMF$ ALIGN b(I) WITH A(1,I)
:
x = sum(spread(b,dim=1,ncopies=N)*A,dim=2)
real A(N,M), b(M), x(M)
CMF$ LAYOUT(:serial, :news)
:
DO 20 L = 1, M
x(L) = sum(a(L,:)*b)
20 CONTINUE
call CMF_random(A, 10)
Generate suitable sets of random numbers, each with a different sample
size n. For each set, compute basic statistics (like mean, variance,
chi-squares, and other moments) with a high level of parallelization
(i.e., make use of the extended intrinsic sum function on CM).
See
[CMEGS]
for an example program, paris/random.fcm for
filling arrays with random entries, for another sample random
subroutine.