X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/kahina_paper1.git/blobdiff_plain/19499f903293ae4b6d3313414aef5a790c81cb34..96a949ea31a5f5a9aa66c6fbdb87faa473ad9ee5:/paper.tex

diff --git a/paper.tex b/paper.tex
index 0d2bbd6..9d26e36 100644
--- a/paper.tex
+++ b/paper.tex
@@ -429,65 +429,65 @@ polynomials of 48000.
 %to $1,000,000$).
 
 
-\section {A CUDA parallel Ehrlich-Aberth method}
-In the following, we describe the parallel implementation of Ehrlich-Aberth method on GPU 
-for solving high degree polynomials (up to $1,000,000$). First, the hardware and software of the GPUs are presented. Then, the CUDA parallel Ehrlich-Aberth method is presented.
-
-\subsection{Background on the GPU architecture}
-A GPU is viewed as an accelerator for the data-parallel and
-intensive arithmetic computations. It draws its computing power
-from the parallel nature of its hardware and software
-architectures. A GPU is composed of hundreds of Streaming
-Processors (SPs) organized in several blocks called Streaming
-Multiprocessors (SMs). It also has a memory hierarchy. It has a
-private read-write local memory per SP, fast shared memory and
-read-only constant and texture caches per SM and a read-write
-global memory shared by all its SPs~\cite{NVIDIA10}.
-
-On a CPU equipped with a GPU, all the data-parallel and intensive
-functions of an application running on the CPU are off-loaded onto
-the GPU in order to accelerate their computations. A similar
-data-parallel function is executed on a GPU as a kernel by
-thousands or even millions of parallel threads, grouped together
-as a grid of thread blocks. Therefore, each SM of the GPU executes
-one or more thread blocks in SIMD fashion (Single  Instruction,
-Multiple Data) and in turn each SP of a GPU SM runs one or more
-threads within a block in SIMT fashion (Single Instruction,
-Multiple threads). Indeed at any given clock cycle, the threads
-execute the same instruction of a kernel, but each of them
-operates on different data.
- GPUs only work on data filled in their
-global memories and the final results of their kernel executions
-must be communicated to their CPUs. Hence, the data must be
-transferred in and out of the GPU. However, the speed of memory
-copy between the GPU and the CPU is slower than the memory
-bandwidths of the GPU memories and, thus, it dramatically affects
-the performances of GPU computations. Accordingly, it is necessary
-to limit as much as possible, data transfers between the GPU and its CPU during the
-computations.
-\subsection{Background on the CUDA Programming Model}
-
-The CUDA programming model is similar in style to a single program
-multiple-data (SPMD) software model. The GPU is viewed as a
-coprocessor that executes data-parallel kernel functions. CUDA
-provides three key abstractions, a hierarchy of thread groups,
-shared memories, and barrier synchronization. Threads have a three
-level hierarchy. A grid is a set of thread blocks that execute a
-kernel function. Each grid consists of blocks of threads. Each
-block is composed of hundreds of threads. Threads within one block
-can share data using shared memory and can be synchronized at a
-barrier. All threads within a block are executed concurrently on a
-multithreaded architecture.The programmer specifies the number of
-threads per block, and the number of blocks per grid. A thread in
-the CUDA programming language is much lighter weight than a thread
-in traditional operating systems. A thread in CUDA typically
-processes one data element at a time. The CUDA programming model
-has two shared read-write memory spaces, the shared memory space
-and the global memory space. The shared memory is local to a block
-and the global memory space is accessible by all blocks. CUDA also
-provides two read-only memory spaces, the constant space and the
-texture space, which reside in external DRAM, and are accessed via
-read-only caches.
+%% \section {A CUDA parallel Ehrlich-Aberth method}
+%% In the following, we describe the parallel implementation of Ehrlich-Aberth method on GPU 
+%% for solving high degree polynomials (up to $1,000,000$). First, the hardware and software of the GPUs are presented. Then, the CUDA parallel Ehrlich-Aberth method is presented.
+
+%% \subsection{Background on the GPU architecture}
+%% A GPU is viewed as an accelerator for the data-parallel and
+%% intensive arithmetic computations. It draws its computing power
+%% from the parallel nature of its hardware and software
+%% architectures. A GPU is composed of hundreds of Streaming
+%% Processors (SPs) organized in several blocks called Streaming
+%% Multiprocessors (SMs). It also has a memory hierarchy. It has a
+%% private read-write local memory per SP, fast shared memory and
+%% read-only constant and texture caches per SM and a read-write
+%% global memory shared by all its SPs~\cite{NVIDIA10}.
+
+%% On a CPU equipped with a GPU, all the data-parallel and intensive
+%% functions of an application running on the CPU are off-loaded onto
+%% the GPU in order to accelerate their computations. A similar
+%% data-parallel function is executed on a GPU as a kernel by
+%% thousands or even millions of parallel threads, grouped together
+%% as a grid of thread blocks. Therefore, each SM of the GPU executes
+%% one or more thread blocks in SIMD fashion (Single  Instruction,
+%% Multiple Data) and in turn each SP of a GPU SM runs one or more
+%% threads within a block in SIMT fashion (Single Instruction,
+%% Multiple threads). Indeed at any given clock cycle, the threads
+%% execute the same instruction of a kernel, but each of them
+%% operates on different data.
+%%  GPUs only work on data filled in their
+%% global memories and the final results of their kernel executions
+%% must be communicated to their CPUs. Hence, the data must be
+%% transferred in and out of the GPU. However, the speed of memory
+%% copy between the GPU and the CPU is slower than the memory
+%% bandwidths of the GPU memories and, thus, it dramatically affects
+%% the performances of GPU computations. Accordingly, it is necessary
+%% to limit as much as possible, data transfers between the GPU and its CPU during the
+%% computations.
+%% \subsection{Background on the CUDA Programming Model}
+
+%% The CUDA programming model is similar in style to a single program
+%% multiple-data (SPMD) software model. The GPU is viewed as a
+%% coprocessor that executes data-parallel kernel functions. CUDA
+%% provides three key abstractions, a hierarchy of thread groups,
+%% shared memories, and barrier synchronization. Threads have a three
+%% level hierarchy. A grid is a set of thread blocks that execute a
+%% kernel function. Each grid consists of blocks of threads. Each
+%% block is composed of hundreds of threads. Threads within one block
+%% can share data using shared memory and can be synchronized at a
+%% barrier. All threads within a block are executed concurrently on a
+%% multithreaded architecture.The programmer specifies the number of
+%% threads per block, and the number of blocks per grid. A thread in
+%% the CUDA programming language is much lighter weight than a thread
+%% in traditional operating systems. A thread in CUDA typically
+%% processes one data element at a time. The CUDA programming model
+%% has two shared read-write memory spaces, the shared memory space
+%% and the global memory space. The shared memory is local to a block
+%% and the global memory space is accessible by all blocks. CUDA also
+%% provides two read-only memory spaces, the constant space and the
+%% texture space, which reside in external DRAM, and are accessed via
+%% read-only caches.
 
 \section{ Implementation of Ehrlich-Aberth method on GPU}
 \label{sec5}
@@ -619,26 +619,43 @@ The first form executes formula \ref{eq:SimplePolynome} if the modulus
 of the current complex is less than the a certain value called the
 radius i.e. ($ |z^{k}_{i}|<= R$), else the kernel executes the EA.EL
 function Eq.~\ref{Log_H2}
-( with Eq.~\ref{deflncomplex}, Eq.~\ref{defexpcomplex}). The radius $R$ is evaluated as :
+(with Eq.~\ref{deflncomplex}, Eq.~\ref{defexpcomplex}). The radius $R$ is evaluated as :
 
 $$R = \exp( \log(DBL\_MAX) / (2*n) )$$ where $DBL\_MAX$ stands for the maximum representable double value.
 
-The last kernel verifies the convergence of the roots after each update of $Z^{(k)}$, according to formula. We used the functions of the CUBLAS Library (CUDA Basic Linear Algebra Subroutines) to implement this kernel. 
+The last kernel checks the convergence of the roots after each update
+of $Z^{(k)}$, according to formula Eq.~\ref{eq:Aberth-Conv-Cond}. We used the functions of the CUBLAS Library (CUDA Basic Linear Algebra Subroutines) to implement this kernel. 
+
+The kernel terminates its computations when all the roots have
+converged. It should be noticed that, as blocks of threads are
+scheduled automatically by the GPU, we have absolutely no control on
+the order of the blocks. Consequently, our algorithm is executed more
+or less in an asynchronous iteration model, where blocks of roots are
+updated in a non deterministic way. As the Durand-Kerner method has
+been proved to converge with asynchronous iterations, we think it is
+similar with the Ehrlich-Aberth method, but we did not try to prove
+this in that paper. Another consequence of that, is that several
+executions of our algorithm with the same polynomial do no give
+necessarily the same result (but roots have the same accuracy) and the
+same number of iterations (even if the variation is not very
+significant).
+
+
+
+
 
-The kernels terminate it computations when all the roots converge. Finally, the solution of the root finding problem is copied back from GPU global memory to CPU memory. We use the communication functions of CUDA for the memory allocation in the GPU \verb=(cudaMalloc())= and for data transfers from the CPU memory to the GPU memory \verb=(cudaMemcpyHostToDevice)=
-or from GPU memory to CPU memory \verb=(cudaMemcpyDeviceToHost))=. 
 %%HIER END MY REVISIONS (SIDER)
 \section{Experimental study}
 \label{sec6}
 %\subsection{Definition of the used polynomials }
-We study two categories of polynomials : the sparse polynomials and the full polynomials.
-\paragraph{A sparse polynomial}:is a polynomial for which only some coefficients are not null. We use in the following polynomial for which the roots are distributed on 2 distinct circles :
+We study two categories of polynomials: sparse polynomials and the full polynomials.\\
+{\it A sparse polynomial} is a polynomial for which only some
+coefficients are not null. In this paper, we consider sparse polynomials for which the roots are distributed on 2 distinct circles:
 \begin{equation}
 	\forall \alpha_{1} \alpha_{2} \in C,\forall n_{1},n_{2} \in N^{*}; P(z)= (z^{n_{1}}-\alpha_{1})(z^{n_{2}}-\alpha_{2})
-\end{equation}
-
-
-\paragraph{A full polynomial}:is in contrast, a polynomial for which all the coefficients are not null. the second form used to obtain a full polynomial is:
+\end{equation}\noindent
+{\it A full polynomial} is, in contrast, a polynomial for which
+all the coefficients are not null. A full polynomial is defined by:
 %%\begin{equation}
 	%%\forall \alpha_{i} \in C,\forall n_{i}\in N^{*}; P(z)= \sum^{n}_{i=1}(z^{n^{i}}.a_{i})
 %%\end{equation}
@@ -646,23 +663,24 @@ We study two categories of polynomials : the sparse polynomials and the full pol
 \begin{equation}
      {\Large \forall a_{i} \in C, i\in N;  p(x)=\sum^{n}_{i=0} a_{i}.x^{i}} 
 \end{equation}
-With this form, we can have until \textit{n} non zero terms whereas the sparse ones have just two non zero terms.
+%With this form, we can have until \textit{n} non zero terms whereas the sparse ones have just two non zero terms.
 
 %\subsection{The study condition} 
-The our experiences results concern two parameters which are
-the polynomial degree and the execution time of our program
-to converge on the solution. The polynomial degree allows us
-to validate that our algorithm is powerful with high degree
-polynomials. The execution time remains the
-element-key which justifies our work of parallelization.
-	For our tests we used a CPU Intel(R) Xeon(R) CPU
-E5620@2.40GHz and a GPU K40 (with 6 Go of ram).
+%Two parameters are studied are
+%the polynomial degree and the execution time of our program
+%to converge on the solution. The polynomial degree allows us
+%to validate that our algorithm is powerful with high degree
+%polynomials. The execution time remains the
+%element-key which justifies our work of parallelization.
+For our tests, a CPU Intel(R) Xeon(R) CPU
+E5620@2.40GHz and a GPU K40 (with 6 Go of ram) is used. 
 
 
 %\subsection{Comparative study}
-In this section, we discuss the performance Ehrlich-Aberth method  of root finding polynomials implemented on CPUs and on GPUs.
+%First, performances of the Ehrlich-Aberth method  of root finding polynomials
+%implemented on CPUs and on GPUs are studied.
 
-We performed a set of experiments on the sequential and the parallel algorithms, for both sparse and full polynomials and different sizes. We took into account the execution time, the  polynomial size and the number of threads per block performed by sum or each experiment on CPUs and on GPUs.
+We performed a set of experiments on the sequential and the parallel algorithms, for both sparse and full polynomials and different sizes. We took into account the execution times, the  polynomial size and the number of threads per block performed by sum or each experiment on CPUs and on GPUs.
 
 All experimental results obtained from the simulations are made in double precision data, for a convergence tolerance of the methods set to $10^{-7}$. Since we were more interested in the comparison of the performance behaviors of Ehrlich-Aberth and Durand-Kerner methods on CPUs versus on GPUs. The initialization values of the vector solution of the Ehrlich-Aberth method are given in section 2.2. 
 \subsection{The execution time in seconds of Ehrlich-Aberth algorithm on CPU OpenMP (1 core, 4 cores) vs. on a Tesla GPU}
@@ -730,14 +748,19 @@ This figure show the execution time of the both algorithm EA and DK with sparse
 
 %\subsubsection{The execution time of Ehrlich-Aberth algorithm on OpenMP(1 core, 4 cores) vs. on a Tesla GPU}
 
+\section{Conclusion and perspective}
+\label{sec7}
+In this paper we have presented the parallel implementation Ehrlich-Aberth method on GPU and on CPU (openMP) for the problem of finding roots polynomial. Moreover, we have improved the classical Ehrlich-Aberth method witch suffer of overflow problems, the exp.log solution applying to the iterative function to resolve high degree polynomial.
 
+Then, we have described the parallel implementation of the Ehrlich-Aberth algorithm on GPU. 
+We have performed some experiments on Ehrlich-Aberth algorithm in CPU and GPU from the both sparse and full polynomial. These experiments lead us to conclude that the iterative methods using data-parallel operations are more efficient on the GPU than on the CPU. Moreover, the experiment showed that Ehrlich-Aberth algorithm on GPU converge from the both sparse and full polynomials with precision of $10^{-7}$ and the execution time very faster than the CPU version. 
+The experiences showed that the improvement brought to Ehrlich-Aberth allows to resolve very large degree polynomial exceed 100,000.
+Finally, we have compared Ehrlich-Aberth algorithm to Durand-Kerner algorithm, we have conclude that Ehrlich-Aberth converges more quickly than Durand-Kerner in execution time, it is due in fact that Ehrlich-Aberth has cubic one convergence While Durand-Kerner is quadratic. In counterpart, the execution time per iteration are very low for Durand-Kerner algorithm compare to the Ehrlich-Aberth algorithm, consequently, it need lot of iterations to converge. We have to notice that Durand-Kerner does not converge for full polynomial which exceed 5000 degrees while Ehrlich-Aberth was able to solve full polynomial of degree 500,000.
 
+In future work, we plan to perform some experiments using several GPU with a cluster of GPU. So it is interesting to implement algorithms using at least two forms of parallelism on GPU and CPU.
 
 
 
-\section{Conclusion and perspective}
-
-\label{sec7}
 \bibliography{mybibfile}
 
 \end{document}
