<!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>Parallel Algorithm for Natural Neighbor Interpolation</article-title>
      </title-group>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>Bulashevich Institute of Geophysics</institution>
          ,
          <addr-line>Yekaterinburg</addr-line>
          ,
          <country country="RU">Russia</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Ural Federal University</institution>
          ,
          <addr-line>Yekaterinburg</addr-line>
          ,
          <country country="RU">Russia</country>
        </aff>
      </contrib-group>
      <fpage>78</fpage>
      <lpage>83</lpage>
      <abstract>
        <p>This paper describes parallelization technique for Natural Neighbor interpolation algorithm. It is based on Green-Sibson Voronoi tesselation method and works without use of Delaunay triangulation. Obtained results show that algorithm is e cient enough to be used for sequential interpolation of multilayer data.</p>
      </abstract>
      <kwd-group>
        <kwd>interpolation</kwd>
        <kwd>natural neighbor</kwd>
        <kwd>parallel algorithm physics</kwd>
        <kwd>CUDA</kwd>
        <kwd>OpenMP</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>Alexander Tsidaev</p>
    </sec>
    <sec id="sec-2">
      <title>Introduction</title>
      <p>Interpolation is very important part of many scienti c processes, which rely on
measured data. Obtaining of such a data is always complicated with di erent
factors: usually it is lack of resources and physical impossibility to perform
measurements in some point. Also, most of the interpretation methods work with
regular grids while real data is usually measured as a set with irregular structure.</p>
      <p>This is why the interpolation is frequently needed to convert measured sets
to some convenient initial models, which will be then interpreted.</p>
      <p>
        Particularly, author experiences the need of fast interpolation schemes during
conversion of seismic pro le data to 3D model on regular grids [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. Example is
presented on Fig. 1.
      </p>
      <p>
        Empirically it has been found, that the best results are obtained using
Natural Neighbor algorithm [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. But on relatively large grids (1M points and more)
this algorithm, which requires Voronoi diagram calculation for each point, works
with insu cient e cacy. I.e. in 3D layered models the interpolation should be
performed independently in a big set of layers (e.g. Fig. 1 consists of 801 layers:
80 km depth per 100 m). Even algorithms implemented in commercial software
(such as Golden Software Surfer) took hours and even days to complete
interpolation for all layers. So the e cient parallel natural neighbor algorithm is
required.
      </p>
      <p>
        Current paper presents the needed theory for the problem (Sections 2 and
3), algorithm itself (Section 4) and the result of the test in comparison with
non-optimized implementation (Section 5).
Let X be the 2-dimensional plane and fPj g 2 X be the set of the points (called
seeds, sites or generators). Voronoi tesselation [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] of the X is a set of regions
(polygons), each containing one seed and all points closer to that seed than to
any other (Fig. 2):
      </p>
      <p>Rk = fx 2 X j d(x; Pk)
d(x; Pj )g
(1)</p>
      <p>Here Rk - element of Voronoi diagram; d(x; a) is a distance between points
x and a and d(x; A) = inffd(x; a) j a 2 Ag.</p>
    </sec>
    <sec id="sec-3">
      <title>Natural Neighbor Algorithm</title>
      <p>
        Natural Neighbor algorithm had been developed in 1981 by Robin Sibson [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ].
Input data for the algorithm is a set of points f(xi; yi)giN=0 given with some
N
function f values, speci ed in these points: ff (xi; yi)gi=0. Algorithm idea is to
calculate Voronoi diagram for all initial points (xi; yi), and then to add each
interpolated point (x; y) into the tessellation with sequential diagram
recalculation. The value G(x; y), which is attributed to the interpolated point, depends
on how much of the area of initial diagram elements was \stolen" by the region
of new inserted point (Fig. 3).
      </p>
      <p>G(x; y) =</p>
      <p>N
X wif (xi; yi)
i=1
(2)
here f (xi; yi) is the measured value in point (xi; yi), wi = QRkk is ratio of \stolen"
area (see Fig. 3). Rk is the area of the initial Voronoi diagram element for point
Pk; Qk is the intersection area of Rk and newly constructed element for the point
(x; y).</p>
      <p>
        So the natural neighbor algorithm is basically the algorithm to insert an
additional point into existing Voronoi diagram. And it is well known that Voronoi
diagram is a dual graph of Delaunay triangulation. This is why most of methods
of the iterative Voronoi diagram construction are based on triangulation (e.g.
[
        <xref ref-type="bibr" rid="ref4">4</xref>
        ], [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]). This approach has many advantages in case when many incremental
steps should be performed sequentially. But in our case we always need to insert
only one new point and to calculate resulting weights wi then. After this the
obtained modi ed Voronoi diagram is no longer needed and we construct next
one for the next point. The weight wi calculation depends on geometrical features
of Voronoi diagram and could not be performed on its dual graph. This means
that natural neighbor method requires reconstruction of Voronoi from Delaunay
on each iteration step if implemented using the triangulation. In this research we
use an algorithm for incremental Voronoi diagram construction by P.J. Green
and R. Sibson [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] with natural neighbor weights calculation added. It does not
require costly conversion of Voronoi graph to Delaunay graph and back on any
step.
      </p>
    </sec>
    <sec id="sec-4">
      <title>4 Iterative Algorithm for Voronoi Diagram Construction</title>
      <p>As described in previous section, the natural neighbor algorithm requires
insertion of new point and recalculation of Voronoi diagram. To speed up the process
and make easier understanding of how the existing polygons shapes were
modi ed, it is better to implement incremental point insertion algorithm instead of
whole diagram recalculation.</p>
      <p>Let Pi be the initial points set with values f (Pi). Let Ri be the Voronoi
polygon for site Pi. We need to add new site P into the Voronoi diagram for Pi.
Let d(Pa; Pb) be the distance between points Pa and Pb. Then the algorithm can
be written as follows.</p>
      <p>Algorithm 1 Incremental Voronoi diagram construction step of Natural
Neighbor interpolation method
1: Select
. Get the closest to P point</p>
      <p>Pn : d(P; Pn) = m8iinfd(P; Pi)g
12: end while
13: return PN</p>
      <p>i=1 wif (xi; yi)
value can be calculated</p>
      <p>. All region edges were constructed and result
5</p>
    </sec>
    <sec id="sec-5">
      <title>Parallel Implementation and Test Results</title>
      <p>Parallelization idea is quite simple and follows from the non-obstructive nature
of Algorithm 1. Since the value in each interpolation point is calculated
independently and none of the initial data is modi ed during process, then any number
of point values can be calculated at the same time.</p>
      <p>Algorithm 1 was implemented in C++ for two parallel platforms: OpenMP
and CUDA. Initial interpolation point set consisted of 644 points. Interpolation
grid was a square of 1024x1024 points. All tests were performed on \Uran"
supercomputer (Krasovskii Institute of Mathematics and Mechanics, Yekaterinburg,
Russia).</p>
      <p>As it is seen from the Table 1, OpenMP parallelization showed unsatisfactory
results. This may be connected with the fact that no attempts to perform manual
optimizations were implemented and only the main loop was parallelized. Also
it is important to note that other Intel-based optimization techniques, such as
vectorization, are not applicable for current algorithm at all (because of
branching and di erent length of loops for di erent regions) - and so there is no chance
to get additional speed up by introducing SIMD instructions.</p>
      <p>
        Acceleration obtained with GPU usage is quite acceptable, speed up factor is
around one order of magnitude for current grid size and 4 GPUs. Our previous
research showed that calculation time can have almost linear dependency versus
number of GPU [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. But in current case increase of involved GPUs does not
entail corresponding linear increase of acceleration factor. This may be caused by
complex program structure, which cannot be e ciently parallelized, and
overhead connected with need to copy all the data to all GPUs. Program complexity
caused the allocation of maximum allowed number of GPU registers, and this
signi cantly reduced number of blocks that can be executed in parallel.
Parallel algorithm for natural neighbor interpolation was presented in this paper.
Despite the obtained acceleration is enough for the current task of geophysical
modeling, it seems perspective to implement algorithm for di erent
parallelization platforms, such as MPI. Test example showed that even such complex
algorithms, which cannot be vectorized well, can still be e ciently parallelized.
And even MPI seems to be the most appropriate solution for parallel execution
of inhomogeneous blocks, GPU computations could be used as a much cheaper
alternative.
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Ladovsky</surname>
            <given-names>I.V.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Martyshko</surname>
            <given-names>P.S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Druzhinin</surname>
            <given-names>V.S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Byzov D.D.</surname>
          </string-name>
          ,
          <string-name>
            <surname>Tsidaev</surname>
            <given-names>A.G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kolmogorova</surname>
            <given-names>V.V.</given-names>
          </string-name>
          :
          <article-title>Methods and results of crust and upper mantle volume density modeling for deep structure of the Middle Urals region</article-title>
          .
          <source>Ural Geophysical Messenger</source>
          .
          <volume>2</volume>
          (
          <issue>22</issue>
          ).
          <volume>31</volume>
          {
          <issue>45</issue>
          (
          <year>2013</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Sibson</surname>
            ,
            <given-names>R.:</given-names>
          </string-name>
          <article-title>A brief description of natural neighbor interpolation (Chapter 2)</article-title>
          . In V. Barnett.
          <article-title>Interpreting Multivariate Data</article-title>
          . Chichester: John Wiley.
          <volume>21</volume>
          {
          <issue>36</issue>
          (
          <year>1981</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Voronoi</surname>
          </string-name>
          , G.:
          <article-title>Nouvelles applications des paramtres continus la thorie des formes quadratiques</article-title>
          .
          <source>Journal fr die Reine und Angewandte Mathematik</source>
          .
          <volume>133</volume>
          (
          <issue>133</issue>
          ):
          <volume>97</volume>
          {
          <fpage>178</fpage>
          (
          <year>1908</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Fan</surname>
            ,
            <given-names>Q.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Efrat</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Koltun</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Krishnan</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Venkatasubramanian</surname>
            ,
            <given-names>S.:</given-names>
          </string-name>
          <article-title>Hardwareassisted natural neighbor interpolation</article-title>
          . In C. Demetrescu,
          <string-name>
            <given-names>R.</given-names>
            <surname>Sedgewick</surname>
          </string-name>
          , R. Tamassia (Eds.),
          <source>Proceedings of the Seventh Workshop on Algorithm Engineering and Experiments and the Second Workshop on Analytic Algorithms and Combinatorics</source>
          .
          <volume>111</volume>
          {
          <issue>120</issue>
          (
          <year>2005</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Guibas</surname>
            ,
            <given-names>L.J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Knuth</surname>
            ,
            <given-names>D.E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sharir</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Randomized Incremental Construction of Delaunay and Voronoi Diagrams</article-title>
          .
          <source>Algorithmica</source>
          <volume>7</volume>
          . 381{
          <issue>413</issue>
          (
          <year>1992</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Green</surname>
            ,
            <given-names>P. J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sibson</surname>
          </string-name>
          , R.:
          <article-title>Computing Dirichlet Tessellations in the Plane</article-title>
          .
          <source>The Computer Journal</source>
          <volume>21</volume>
          (
          <issue>2</issue>
          ):
          <volume>168</volume>
          {
          <fpage>173</fpage>
          (
          <year>1978</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Tsidaev</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>CUDA Parallel Algorithms for Forward and Inverse Structural Gravity Problems</article-title>
          .
          <source>Proceedings of the 1st Ural Workshop on Parallel, Distributed, and Cloud Computing for Young Scientists</source>
          .
          <volume>50</volume>
          {
          <issue>56</issue>
          (
          <year>2015</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>