Documente Academic
Documente Profesional
Documente Cultură
ABSTRACT
In this paper we introduce the design and implementation of two parallel algorithms for solving the general
tridiagonal linear system of equations using two new parallel algorithms: Parallel splitting Gauss Jordan and the general
parallel splitting Gauss Jordan algorithms. These algorithms are very easily distributed over different number of
processors. In addition our implementations are very efficient, generally a linear speed-up is obtained by increasing the
number of processors.
KEYWORDS: Parallel Algorithms, Numerical Analysis, Tridiagonal Linear System of Equations, Gauss Jordan
Algorithm
1. INTRODUCTION
During the past few years, there has been an increasing number of parallel algorithms using many kinds of parallel
computers to solve very large scientific problems. The main problems for designing parallel algorithms are:
1.
2.
How to reorder the problem by restricting the sequence of operations to increase the amount of parallelism.
In this paper we consider the design and implementation of two new parallel algorithms for solving tridiagonal
systems of equations arising from the numerical solution of partial differential equation using finite difference
approximation.
Direct techniques: Gauss-Jordan method, WZ factorization and QR algorithms are particularly suited to parallel
computers. In the past few years, there were some triers to solve the tridiagonal systems in parallel, see for example
Hatzopoulos [2], who made the DWZ algorithm, but there was a restriction on
who made some alternative decomposition for the tridiagonal systems of equations. In this paper we will discuss the
sequential Gauss-Jordan algorithm and the parallel version of it done by Evans, (see [1]) to solve a general tridiagonal
system, of equations and we will introduce two new parallel algorithms and show their advantages.
Ax = b
(1)
Where A is an n n tridiagonal matrix of coefficients, x and b are vectors of order n of unknowns and right hand
side respectively given by
www.tjprc.org
editor@tjprc.org
40
Osama El-Giar
b 1
a 2
c1
b 2
.
c2
.
.
.
.
.
.
b
cn
x1
x
2
.
.
.
x
n
d 1
d
2
.
.
.
d
n
(2)
g1 =
c1
b1
, h1 =
d1
b1
for i = 2, 3, ... , n
ci
, i
g i = b a g
i
i i 1
n , hi =
d i a i h i 1
b i a i g i 1
(3)
x n = hn , x i = hi g i x i +1 , i = n 1 , n 2 , ...,1
In the sequential Gauss-Jordan algorithm the steps are almost sequential and we can only calculate each gi and hi
in parallel see figure 1 for the sequential Gauss-Jordan with n = 5.
Two Parallel Numerical Algorithms for Solving Tridiagonal System of Linear Equations
Using Parallel Splitting Gauss Jordan and the General Parallel Splitting Gauss Jordan Methods
g1 =
c1
b1
h1 ,0 =
41
d1
b1
for i = 2 , 3 , ..., n
d i a i h i 1 ,0
ci
,i n,
h i ,0 =
g i =
b i a i g i 1
b i a i g i 1
for k = i - 1 , i - 2 , ..., 1
i 1
hk ,i k = hk ,i k 1 + ( 1 ) i k j = k g i hi ,o
and the solution can be obtained by
(4)
x i = hi ,n- i , i = n , n - 1 , ..., 1 .
The amount of parallelism is now increased and we need 5 sequential levels, for n = 5 and each level can be done
in parallel see figure 2, the computations proceeds as follows:
for sequential level 1 (i = 1)
Compute in parallel, g1 and h1,0.
for sequential level 2 (i = 2)
Compute in parallel, g2 and h2,0 and h1,1 = h1,0 g1h2,0.
for sequential level 3 (i = 3)
Compute in parallel, g3, h3,0 and
h2,1 = h2,0 g2h3,0
h1,2 = h1,1 + g1g2h3,0
for sequential level 4 (i = 4)
Compute in parallel, g4, h4,0 and
h3,1 = h3,0 g3h4,0
h2,2 = h2,1 + g2g3h4,0
h1,3 = h1,2 g1g2g3h4,0
for sequential level 5 (i = 5)
Compute in parallel, g5, h5,0 and
h4,1 = h4,0 g4h5,0
h3,2 = h3,1 + g3g4h5,0
h2,3 = h2,2 g2g3g4h5,0
h1,4 = h1,3 + g1g2g3g4h5,0
www.tjprc.org
editor@tjprc.org
42
Osama El-Giar
and the solution can be obtained in parallel at the same sequential step using
n n
n
systems and then each system can be treated independently and in parallel, but in this case we treat the first
2 2
2
n
and treat the second system at the same time
2
c n in the
2
th
a n in the
2
+1
th .
hence
xn
2
+1
and
xn
2
n
can be eliminated from the
2
n
+1 .
2
n
systems of equations, let n be even, and we have to
2
( )
n
th .
+1
(5)
th .
systems will be
b 1
a
2
c1
b2
.
c2
.
.
.
.
.
.
.
.
a
n
2
n
2
+ c
n
2
x1
x
2
.
.
.
x
n2
d 1
d
2
.
.
.
d
n2
(6)
43
Two Parallel Numerical Algorithms for Solving Tridiagonal System of Linear Equations
Using Parallel Splitting Gauss Jordan and the General Parallel Splitting Gauss Jordan Methods
x n = hn =
2
n
2
anhn
2
(7)
b n + c n a n g n 1
2
2
2
2
(b
n
+1
2
an
2
+1
an
2
cn
+1
bn
+2
cn
+2
+2
.
.
.
.
.
x n
2 +1
x
n +2
2
.
.
x n
b n
.
.
an
d n
2 +1
d
n +2
2
.
.
d n
(8)
which will be treated using the backward gauss-Jordan algorithm defined by:
gn =
an
,
bn
hn =
dn
bn
for i = n - 1 , n - 2 , ..., 2 + 1
ai
d c i hi +1
n
g i =
, i + 1 , hi = i
b i c i g i +1
2
b i c i g i +1
xn
+1
(9)
= h n , x i = hi - g i x i -1 , i =
2
+1
+ 2,
n
2
+ 3 , , n and
in this case
xn
2
+ 1
hn
2
+ 1
- cn
n
+ 1
2
an
(bn
+ 1
+ 1
+ 1
hn
2
) - cn
2
+ 2
(10)
+ 1
n
+ 2
2
( b n - an g n
( bn
2
2
+ 1
- cn
2
- 1
+ 1
)( d n
2
gn
2
+ 2
+ 1
- cn
2
+ 1
hn
2
)( d n - a n h n
2
+ 2
- 1
) - an
2
+ 1
) - cn ( d n
2
( d n - a n hn
+ 1
- cn
2
+ 1
hn
2
)
- 1
+ 2
(11)
editor@tjprc.org
44
Osama El-Giar
In parallel compute: g1, h1 using Gauss-Jordan algorithm and g8, h8 using backward Gauss-Jordan algorithm 9.
for sequential level 2 (i = 2)
In parallel compute: g2, h2 using Gauss-Jordan algorithm and g7, h7 using backward Gauss-Jordan algorithm 9.
for sequential level 3 (i = 3)
In parallel compute: g3, h3 using Gauss-Jordan algorithm and g6, h6 using backward Gauss-Jordan algorithm 9.
for sequential level 4 (i = 4)
In parallel compute:
using equation 11
n n
systems and then each system can be treated independently and in parallel, and at the same time the
2 2
n
) and the second system is using the
2
n
+ 1 defined by:
2
45
Two Parallel Numerical Algorithms for Solving Tridiagonal System of Linear Equations
Using Parallel Splitting Gauss Jordan and the General Parallel Splitting Gauss Jordan Methods
an
,
bn
gn =
for
g i
hn ,0 =
dn
bn
i = n - 1 , n - 2 , ...,
n
+1
2
for k = i + 1 , i + 2 , ..., n
k
k -i
hk ,k - i = hk ,k - i - 1 + (-1 ) j = i +1
g j h i ,0
x i=h
i ,i
+1
2
, i =
( b n an g n
2
( bn
2
+1
cn
2
2
+1
gn
2
)( d n
2
+2
+1
cn
2
+1
hn
)( d n a n h n
2
+ 2 ,0
1 ,0
n
n
+ 1 , + 2 , ..., n
2
2
(12)
d i - c i hi +1 ,0
ai
n
, i
=
+ 1 , hi ,o =
b i - c i g i +1
2
b i - c i g i +1
can be obtained by
) a n ( d n a n hn
2
+1
) cn ( d n
2
2
+1
cn
2
+1
1 ,0
hn
2
+ 2 ,0
(13)
editor@tjprc.org
46
Osama El-Giar
using algorithm 4.
using algorithm 4.
using algorithm 4.
and the solution can be obtained immediately in parallel at this step such that
xi = h
n
i , i ,
2
i = 1,2...
n
using
2
xi = h
i ,i +1 ,
2
i = n , n 1 , ...,
n
2
47
Two Parallel Numerical Algorithms for Solving Tridiagonal System of Linear Equations
Using Parallel Splitting Gauss Jordan and the General Parallel Splitting Gauss Jordan Methods
6. COMMENTS
1.
In this paper we consider a general tridiagonal system of equations with order n, and in the previous two sections
we considered n to be even, now we consider n to be odd, in this case, the only change in the parallel splitting
Gauss-Jordan algorithm and in the general parallel splitting Gauss-Jordan algorithm that we split the systems after
the n 1 and before the
2
n +1
in the parallel
( b n +1 - a n +1 g n-1 )( d n + 3 - c n + 3 h n + 5 ) - a n + 3 ( d n +1 - a n +1 h n-1 )
(14)
( b n +1 a n +1 g n 1 )( d n + 3 c n + 3 h n + 5 ) a n + 3 ( d n +1 a n +1 h n 1 )
2
,0
,0
(15)
( b n + 3 c n + 3 g n + 5 )( d n +1 a n +1 h n 1 ) c n +1 ( d n + 3 c n + 3 h n + 5 )
2
2.
( b n + 3 - c n + 3 g n + 5 )( d n +1 - a n +1 h n-1 ) - c n +1 ( d n + 3 - c n + 3 h n + 5 )
2
and
,0
xn
2
d n an hn
x n = hn =
2
b n an g n
2
www.tjprc.org
+1
,0
(16)
1
editor@tjprc.org
48
Osama El-Giar
and
xn
2
hn
+2
+2
xn
d n - a n hn
x n = hn =
2
and
xn
2
3.
hn
+2
- 1, 0
b n - an g n
,0
+1
(17)
- 1
+ 2 ,0
xn
2
+1
= hn
2
+1
dn
2
bn
2
and
xn
2
hn
+1
+1
c n hn
2
+1
cn g n
2
+2
(18)
+2
in this case:
dn
xn
2
+1
= hn
+1 ,0
+1
bn
2
and
xn
2
hn
2
c n hn
+1
+1
cn g n
2
+ 2 ,0
(19)
+2
1 ,0
xn = xn
2
0
0
(undefined) then
xn
2
- 1
hn
2
,
- 1
+1
=0
xn
2
- 2
hn
2
+ 2
xn = xn
2
+1
=0
Two Parallel Numerical Algorithms for Solving Tridiagonal System of Linear Equations
Using Parallel Splitting Gauss Jordan and the General Parallel Splitting Gauss Jordan Methods
xn
2
(undefined) then:
xn
- 1
+ 2
hn
2
hn
2
49
- 1, 0
+ 2, 0
1
2
5
4
4
2
3
5
1
4
3
2.
x1
x2
x
7
x
8
9
25
29
31
-6
- 5
6
(20)
i = 1, 2, , 8
Computational Steps
1.
2.
3.
4.
We get
5.
In parallel we get x4 = h4 = 4, x5 = h5 = 5.
6.
In parallel we get x3 = h3 = 3, x6 = h6 = 6
7.
In parallel we get x2 = h2 = 2, x7 = h7 = 7.
8.
In parallel we get x1 = h1 = 1, x8 = h8 = 8.
= 1.25.
Computational Steps
1.
2.
In parallel we get g2 = 0.8888889, g7 = 1.272727, h2,0 = 4.666667, h1,1 = .333333, h7,0 = 0.636364, h8,1 =
3.454546
3.
In parallel we get g3 = 0.521739, g6 = 0.39759, h3,0 = 5.086956 h6,0 = 4.012049, h2,1 = .144928, h1,2 = 1.463768,
www.tjprc.org
editor@tjprc.org
50
Osama El-Giar
4.
We get
= 1.25.
5.
6.
3.
Example 2: It is example 1 (with x4 = 0), so it has the same matrix of coefficients a with the right hand side
vector (6, 9, 9, 37, 19, 29, 6, 5)T, computational steps:
1.
2.
3.
4.
We get
5.
6.
In parallel we get x3 = h3 = 3, x6 = h6 = 6
7.
In parallel we get x2 = h2 = 2, x7 = h7 = 7
8.
In parallel we get x1 = h1 = 1, x8 = h8 = 8
4.
Example 2: It is example 1 (with x5 = 0) so it has the same matrix of coefficients A with the right hand side
vector (6, 9, 9, 12, 24, 44, 6, 5)T, and using the parallel splitting Gauss-Jordan algorithm Computational steps:
1.
2.
3.
4.
We get
5.
6.
In parallel we get x3 = h3 = 3, x6 = h6 = 6
7.
In parallel we get x2 = h2 = 2, x7 = h7 = 7
8.
In parallel we get x1 = h1 = 1, x8 = h8 = 8
= 0 and hence x5 = 0
7.2. Performance
The two new parallel algorithms: Parallel splitting Gauss Jordan and the general parallel splitting Gauss Jordan
algorithms are very easily distributed over different number of processors Also our implementations are very efficient,
generally a linear speed-up obtained by increasing the number of processors. In addition, we do not any restrictions on the
shape of the tridiagonal system of equation, or on n. In general for n n tridiagonal system, the parallel Gauss-Jordan
algorithm, needs n sequential steps using n + 1 processors, and has the advantage, that all solutions can be obtained
51
Two Parallel Numerical Algorithms for Solving Tridiagonal System of Linear Equations
Using Parallel Splitting Gauss Jordan and the General Parallel Splitting Gauss Jordan Methods
immediately at the same time (in science, you can deal with n objects at the same time). The parallel splitting Gauss-Jordan
algorithm needs n sequential steps, and has the advantage that it uses only
2
parallel pairs.
The general parallel splitting Gauss-Jordan algorithm has the advantages that it only needs
+ 2 sequential steps
using n processors, and also, all solutions can be obtained immediately at the same time. Also these Parallel algorithms can
easily be extended to solve the block tridiagonal system of equations see [1].
8. CONCLUSIONS
The two new parallel algorithms: Parallel splitting Gauss Jordan and the general parallel splitting Gauss Jordan
algorithms are very easily distributed over different number of processors Also our implementations are very efficient,
generally a linear speed-up obtained by increasing the number of processors. In addition, we do not any restrictions on the
shape of the tridiagonal system of equation, or on n. In general for n n tridiagonal system, the parallel Gauss-Jordan
algorithm, needs n sequential steps using n + 1 processors, and has the advantage, that all solutions can be obtained
immediately at the same time (in science, you can deal with n objects at the same time). The parallel splitting Gauss-Jordan
algorithm needs n sequential steps, and has the advantage that it uses only
2
parallel pairs.
The general parallel splitting Gauss-Jordan algorithm has the advantages that it only needs
+ 2 sequential steps
using n processors, and also, all solutions can be obtained immediately at the same time. Also these Parallel algorithms can
easily be extended to solve the block tridiagonal system of equations see [1].
REFERENCES
1.
J. Evans., "New parallel Algorithms for Partial Differential Equations," M. Feilmeier, J. Joubert. and U. Schendel,
editors, Int. Conf. Parallel Computing 83, pages 52-55. 1984.
2.
M. Hatzopoulos "Parallel linear system solvers for tridiagonal systems." J. F. Traub., editors, Complexity of
Sequential and Parallel Numerical Algorithms., pages 387-393, - 1979.
3.
Henk. A. vn der Vorst "Analysis of Parallel solution method for tridiagonal systems.", Reports of the Department
of Mathematics, Delft, pages 86-96,- 1986.
www.tjprc.org
editor@tjprc.org