<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Research of parallel algorithms for solving three-diagonal systems of linear algebraic equations on a graphical computing device using various types of memory</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>X S Pogorelskih</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>L V Loganova</string-name>
          <email>lloganova@yandex.ru</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Samara National Research University</institution>
          ,
          <addr-line>Moskovskoe Shosse, 34А, Samara, Russia, 443086</addr-line>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2019</year>
      </pub-date>
      <fpage>227</fpage>
      <lpage>232</lpage>
      <abstract>
        <p>In this paper, we research and compare different implementations of cyclic reduction and sweep algorithms on a graphics processing unit (GPU) using different types of device memory. As a result of the work, it was found that the algorithm of the run should be used to solve the set of the tridiagonal linear system. However, the best results are shown by a parallel version of the cyclic reduction algorithm with partial use of shared memory, when solving a single linear system on the GPU.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        The applicability of systems of linear equations of tridiagonal form is very extensive[
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. Tridiagonal
matrices have an extremely important role in difference methods of solving problems of mathematical
physics [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. In addition, many linear algebra problems, such as solving equations and finding
eigenvalues, are solved through transformations of matrices of general form to tridiagonal ones [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ].
These matrices also play an important role in the theory of orthogonal polynomials [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ].
      </p>
      <p>
        There are many algorithms and their parallel versions for solving tridiagonal systems of linear
equations. The need for parallelization naturally occurs when the size or number of systems to be
solved is very large. Most methods are based on simple arithmetic operations performed many times.
Therefore, the implementation of parallel versions of algorithms on the GPU is a reasonable solution
[
        <xref ref-type="bibr" rid="ref5">5</xref>
        ].
      </p>
    </sec>
    <sec id="sec-2">
      <title>2. Problem Statement and Methodology</title>
      <p>This article investigates parallel algorithms for solving systems of linear equations of tridiagonal form.</p>
      <p>
        The traditional matrix algorithm and the cyclic reduction method are usually used to solve systems
of linear algebraic equations of tridiagonal form [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ].
      </p>
      <p>
        The advantage of the cyclic reduction method is a high degree of parallelism [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ]. However, it also
requires a large amount of computation. When implemented on a central processing unit using MPI
technology, the method requires a lot of forwarding. This significantly slows down the program [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ].
However, in CUDA technology shipments are not required. Therefore, the method attracts the
attention of researchers to implement on the graphics card. In addition, it allows parallelization for a
single system [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ].
      </p>
      <p>The traditional matrix algorithm Parallels for one system worse than the parallel cyclic reduction
algorithm. However, there are a large number of tasks that require the solution of a set of systems. The
traditional matrix algorithm is suitable for such problems. It gives a gain in acceleration due to low
computational complexity.</p>
      <p>In this paper, we investigate which algorithm for solving tridiagonal-type systems spends less time
on computation. To solve this problem, we compare the he implementation of the traditional matrix
algorithm, and the serial and parallel versions of the cyclic reduction algorithm using different
combinations of global and shared GPU memory. Parallelization of methods is carried out using the
CUDA model. Experimental research is conducted on the supercomputer "Sergey Korolev".</p>
    </sec>
    <sec id="sec-3">
      <title>3. Experimental research</title>
      <p>This work began with the implementation and research of the traditional matrix algorithm. This
method is one of the most famous and popular for solving tridiagonal systems of linear arithmetic
equations.</p>
      <p>The first version of the algorithm was implemented on the CPU for further comparison in
acceleration. Then an implementation of a parallel traditional matrix algorithm on the GPU using only
global memory was created. The next task was to implement this method using shared memory. Since
the memory size is small, the necessary factors were loaded in portions into the shared memory
immediately before use. Then, after all the necessary operations, the coefficients were replaced by the
next portion. To store data in shared memory, arrays of auxiliary coefficients  and  and the sought
vector  of size 2 ∙  and arrays of initial coefficients  ,  ,  and  of size  . All
calculations were performed in shared memory.</p>
      <p>The experiments were carried out for a set of systems with matrices of size  = 4095. This size
was chosen to compare the results with the experimental versions of the cyclic reduction algorithm
implemented for the size of matrices  = 2 − 1, where  ∈ ℕ.</p>
      <p>The number of equation systems varied from 5000 to 20000. If the number of systems is less than
5000, working with memory on the GPU takes much longer than the calculations themselves.</p>
      <p>The obtained accelerations of parallel versions of algorithms relative to the serial version on the
CPU are given in table 1.</p>
      <p>This result shows that the time it takes to copy data from global memory to shared memory and
vice versa is justified by the high speed of calculations performed in shared memory.</p>
      <p>The next step is the implementation of the sequential cyclic reduction algorithm (SERICR). This
algorithm makes it impossible to carry out parallel calculations for one system, but is parallelized for a
set of systems.
significant information are gray.</p>
      <p>
        R. Hockney [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ] considered in detail the cyclic reduction. It notes that this algorithm is suitable for
any number of equations. However, for simplicity, the author gives the number of equations 
1, где  – where q is an integer. For convenience, he introduced the designation  ′ = 2

= 
= 2
We present a routing diagram of this algorithm for  ′ = 8 in figure 1 (a). Cells that contain
  = −
  = −
 2(  −+11) ;
 2
 2( −+11) ;
 2 +2


( )
=     −2 −1 ;
right parts for reduction levels  = 1,  − 1 with step ℎ = 1 from  = 0 to  =  ( ) are considered.
Reduction coefficients of level  = 0 are assumed to be 
  . First, we find the auxiliary coefficients:

(0)
=   , 

(0)
=   ,  
(0)
=   и  
(0)
=
the previous reduction level, we obtain:
      </p>
      <p>Then, based on the obtained   and   and the values of the coefficients of the left and right parts of





( )</p>
      <p>=   
( )

 ( )
=  
=  
varying in increments ℎ2 = 2( −1) from  = 2
( −1) to  =  ′ − 2
( −1), we consider:
 = 0,  − 1 we find the vector of solutions  . It is assumed that  0 =   ′ = 0. For  =  , 1, for  ,
  =

.</p>
      <p>However, the resulting memory savings are not sufficient to use this algorithm on big data. The
solution in this situation is to store only two levels of reduction and recalculate the coefficients when
they are needed.</p>
      <p>The
was implemented on the central and graphics processor devices.
enough memory to store the coefficients of all levels of reduction. When implemented on the GPU
recalculation was necessary. On the graphics card, the algorithm was implemented using only global
memory and shared memory.
of systems varied from 5000 to 25000. The obtained accelerations are shown in table 2.</p>
      <p>The experiments were carried out for a set of systems with matrices of size 
= 4095. The number</p>
      <p>The experiments were carried out for a system of equations with matrices of size 
memory does not give a significant benefit.</p>
      <p>Thus, when solving a set of systems of linear algebraic equations, the best result is shown by the
traditional matrix algorithm on a GPU with full load in the shared memory. Its running time is on
average 6 times shorter than the running time of the cyclic reduction algorithm. However, when
solving one system with a large matrix, it is more expedient to use a parallel cyclic reduction
algorithm with partial loading into shared memory. Its implementation requires 7 times less time for
calculations than the implementation of the traditional matrix algorithm.</p>
    </sec>
    <sec id="sec-4">
      <title>4. Conclusion</title>
      <p>As a result of this work, it was obtained that the use of shared memory for the traditional matrix
algorithm gives an increase in acceleration by 47%. This is because data loaded into shared memory is
reused.</p>
      <p>For the cyclic reduction algorithm, it is advisable to load into the shared memory only those
coefficients that are used twice in the calculations. At the same time, the acceleration is increased by
2%.</p>
      <p>When solving a set of systems of linear algebraic equations, the best implementation of the
traditional matrix algorithm is 6 times faster than the best implementation of the cyclic reduction
algorithm. However, when solving a single system with a large matrix, the result is the opposite: the
cyclic reduction algorithm is 7 times faster.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <surname>Golovashkin</surname>
            <given-names>D L</given-names>
          </string-name>
          <year>2002</year>
          <article-title>Application of the method of counter runs for the synthesis of a parallel algorithm for solving grid equations of tridiagonal type</article-title>
          <source>Computer Optics</source>
          <volume>24</volume>
          <fpage>33</fpage>
          -
          <lpage>39</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <surname>Yablokova</surname>
            <given-names>L V</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Golovashkin D L 2018</surname>
          </string-name>
          <article-title>Block algorithm for the joint difference solution of the d'Alembert and maxwell's equations</article-title>
          <source>CEUR Workshop Proceedings</source>
          <volume>2212</volume>
          <fpage>56</fpage>
          -
          <lpage>62</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <surname>Yablokova</surname>
            <given-names>L V</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Golovashkin D L 2018</surname>
          </string-name>
          <article-title>Block algorithms of a simultaneous difference solution of D'alembert's and Maxwell's equations</article-title>
          <source>Computer Optics</source>
          <volume>42</volume>
          (
          <issue>2</issue>
          )
          <fpage>320</fpage>
          -
          <lpage>327</lpage>
          DOI: 10.18287/
          <fpage>2412</fpage>
          -6179-2018-42-2-
          <fpage>320</fpage>
          -327
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <surname>Ilyin</surname>
            <given-names>V P</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kuznetsov</surname>
            <given-names>Yu</given-names>
          </string-name>
          <article-title>I 1985 Three-diagonal matrices and their applications (M.: Science</article-title>
          ) p
          <fpage>208</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <surname>Yablokova</surname>
            <given-names>L V</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Golovashkin D L 2017</surname>
          </string-name>
          <article-title>Application of the pyramid method in difference solution d'Alembert equations on graphic processor with the use of</article-title>
          <source>Matlab CEUR Workshop Proceedings</source>
          <volume>1902</volume>
          <fpage>68</fpage>
          -
          <lpage>70</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <surname>Golovashkin</surname>
            <given-names>D L</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Loganova L V 2012</surname>
          </string-name>
          <article-title>The solution to the difference equations finite difference schemes with cyclic boundary conditions on a two-dimensional grid areas using multiple graphics processing devices</article-title>
          <source>Computer Optics</source>
          <volume>36</volume>
          (
          <issue>4</issue>
          )
          <fpage>534</fpage>
          -
          <lpage>540</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <surname>Boreskov</surname>
            <given-names>A V</given-names>
          </string-name>
          <year>2011</year>
          <article-title>CUDA technology in the examples: an introduction to programming GPUs (M.:</article-title>
          DMK Press) p
          <fpage>232</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <surname>Kazennov A M 2010</surname>
          </string-name>
          <article-title>Basic concepts</article-title>
          of
          <source>CUDA technology Computer Research and Modeling</source>
          <volume>2</volume>
          (
          <issue>3</issue>
          )
          <fpage>295</fpage>
          -
          <lpage>308</lpage>
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <surname>Boreskov</surname>
            <given-names>A V</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kharlamov</surname>
            <given-names>A A</given-names>
          </string-name>
          <year>2016</year>
          <article-title>Basics of CUDA technology (Moscow:</article-title>
          DMK Press) p
          <fpage>230</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <surname>Shinkaruk</surname>
            <given-names>D N</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Shpolyansky</surname>
            <given-names>Yu A</given-names>
          </string-name>
          and
          <string-name>
            <surname>Kosyakov M S 2012</surname>
          </string-name>
          <article-title>Analysis of the effectiveness of the use of CUDA technology for solving systems of linear equations with three-diagonal matrices in options pricing problems Universities</article-title>
          .
          <source>Instrument making 10 6</source>
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <surname>Malyavko</surname>
            <given-names>A A</given-names>
          </string-name>
          <year>2015</year>
          <article-title>Parallel programming based on OpenMP, MPI, CUDA technologies: studies. manual (Novosibirsk: Publishing House of NSTU) p 116</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <surname>Yarmushkin</surname>
            <given-names>S V</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Golovashkin D L 2004</surname>
          </string-name>
          <article-title>Research of parallel algorithms for solving threediagonal systems of linear algebraic equations Bulletin of the Samara State Technical University</article-title>
          .
          <source>Physics and Mathematics 26 5</source>
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <surname>Hockney</surname>
            <given-names>R</given-names>
          </string-name>
          ,
          <article-title>Jesshope K 1986 Parallel computers. Architecture, programming and algorithms (M.: Radio and communication</article-title>
          ) p
          <fpage>392</fpage>
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>