\usepackage{amsmath}\r
\usepackage{amsfonts}\r
\usepackage{amssymb}\r
+%%\usepackage{algorithm2e}\r
+\usepackage[ruled,vlined]{algorithm2e}\r
+%%\usepackage{algo}\r
+\r
+\usepackage{array,multirow,makecell}\r
+\setcellgapes{1pt}\r
+\makegapedcells\r
+\newcolumntype{R}[1]{>{\raggedleft\arraybackslash }b{#1}}\r
+\newcolumntype{L}[1]{>{\raggedright\arraybackslash }b{#1}}\r
+\newcolumntype{C}[1]{>{\centering\arraybackslash }b{#1}}\r
+\r
\author{ghidouche}\r
\title{Paper1_kahina}\r
\begin{document}\r
\section{Root finding problem}\r
-we consider a polynomial of degree \textit{n} having coefficients\r
-in the complex \textit{C} and zeros $\alpha\r
-_{i},\textit{i=1,...,n}$. \\\r
+We consider a polynomial of degree \textit{n} having coefficients\r
+in the complex \textit{C} and zeros $\alpha_{i},\textit{i=1,...,n}$. \\\r
\begin{center}\r
\begin{equation}\r
{\Large p(x)=\sum{a_{i}x^{i}}=a_{n}\prod(x-\alpha_{i}),a_{0} a_{n}\neq 0}\r
read-only caches\r
\r
\subsection{A parallel implementation of the Aberth's method }\r
-\subsection{A CUDA implementation of the Aberth's method }\r
-\subsection{A GPU implementation of the Aberth's method }\r
-\subsubsection{the step to parallelize}\r
-\subsubsection{the kernel corresponding }\r
-\subsubsection{Comparison between sequential algorithm and GPU algorithm }\r
+%%\subsection{A CUDA implementation of the Aberth's method }\r
+%%\subsection{A GPU implementation of the Aberth's method }\r
+\r
+\r
+\r
+\subsubsection{A sequential Aberth algorithm}\r
+The means steps of Aberth's method can expressed as an algorithm\r
+like:\r
+ \r
+\begin{algorithm}[H]\r
+\LinesNumbered\r
+\caption{Algorithm to find root polynomial with Aberth method}\r
+\r
+\KwIn{$Z^{0}$(Initial root's vector),$\varepsilon$ (error\r
+tolerance threshold),P(Polynomial to solve)}\r
+\r
+\KwOut {Z(The solution root's vector)}\r
+\r
+\BlankLine\r
+\r
+Initialization of the parameter of the polynomial to solve\;\r
+Initialization of the solution vector $Z^{0}$\;\r
+\r
+\While {$\Delta z_{max}\succ \epsilon$}{\r
+ Let $\Delta z_{max}=0$\;\r
+\For{$j \gets 0 $ \KwTo $n$}{\r
+$ZPrec\left[j\right]=Z\left[j\right]$\;\r
+$Z\left[j\right]=H\left(j,Z\right)$\;\r
+}\r
+\r
+\For{$i \gets 0 $ \KwTo $n-1$}{\r
+$c=\frac{\left|Z\left[i\right]-ZPrec\left[i\right]\right|}{Z\left[i\right]}$\;\r
+\If{$c\succ\Delta z_{max}$ }{\r
+$\Delta z_{max}$=c\;}\r
+}\r
+}\r
+\end{algorithm}\r
+~\\ \r
+~\\ \r
+In this sequential algorithm one thread CPU execute all steps, let see the step 3 the execution of the iterative function , 2 instructions are needed, the first instruction \textit{save} the solution vector for the previous iteration, the second instruction \textit{update} or compute a new values of the roots.\r
+We have two manner to execute the iterative function, taking a Jacobi iteration who need all the previous value $z^{(k)}_{i}$ to compute the new value $z^{(k+1)}_{i}$we have:\r
+\r
+\begin{equation}\r
+H(i,z^{k+1})=\frac{p(z^{(k)}_{i})}{p'(z^{(k)}_{i})-p(z^{(k)}_{i})\sum^{n}_{j=1 j\neq i}\frac{1}{z^{(k)}_{i}-z^{(k)}_{j}}}, i=1,...,n.\r
+\end{equation}\r
+\r
+Or with the Gauss-seidel iteration, we have:\r
+\begin{equation}\r
+H(i,z^{k+1})=\frac{p(z^{(k)}_{i})}{p'(z^{(k)}_{i})-p(z^{(k)}_{i})\sum^{i-1}_{j=1}\frac{1}{z^{(k)}_{i}-z^{(k)}_{j}}+\sum^{n}_{j=i+1}\frac{1}{z^{(k)}_{i}-z^{(k)}_{j}}}, i=1,...,n.\r
+\end{equation}\r
+\r
+In formula(16) the iteration function use the $z^{k+1}_{i}$ computed in the current iteration to compute the rest of the roots, which take him to converge more quickly compare to the jacobi iteration (it's well now that the Gauss-seidel iteration converge more quickly because they used the most fresh computed root, so we used Gauss-seidel iteration.)\r
+\r
+The steps 4 of the Aberth's method compute the convergence of the roots, using(9) formula.\r
+Both steps 3 and 4 use 1 thread to compute N roots on CPU, which is faster and hard, it make the algorithm faster and hard for the large polynomial's roots finding.\r
+\r
+\paragraph{The execution time}\r
+Let $T_{i}(N)$: the time to compute one new root's value of the step 3,$T_{i}$ depend on the polynomial's degrees N, when N increase $T_{i}$ increase to.We need $N.T_{i}(N)$ to compute all the new root's value in one iteration on the step 3.\r
+\r
+Let $T_{j}$: the time to compute one root's convergence value of the step 4, we need $N.T_{j}$ to compute all the root's convergence value in one iteration on the step 4.\r
+\r
+The execution time for both steps 3 and 4 can see like:\r
+\begin{equation}\r
+T_{exe}=N(T_{i}(N)+T_{j})+O(n).\r
+\end{equation}\r
+Let Nbr\_iter the number of iteration necessary to compute all the roots,so the total execution time $Total\_time_{exe}$ can give like:\r
+\r
+\begin{equation}\r
+Total\_time_{exe}=\left[N\left(T_{i}(N)+T_{j}\right)+O(n)\right].Nbr\_iter.\r
+\end{equation}\r
+The execution time increase with the increasing of the polynomial's root, which take necessary to parallelize this step to reduce the execution time. In the following paper you explain how we parrallelize this step using GPU architecture with CUDA platform.\r
+\r
+\subsubsection{Parallelize the steps on GPU }\r
+On the CPU Aberth algorithm both steps 3 and 4 contain the loop \verb=for= , it use one thread to execute all the instruction in the loop N times.Here we explain how the GPU architecture can compute this loop and reduce the execution time.\r
+The GPU architecture affect the execution of this loop to a groups of parallel threads organized as a grid of blocks each block contain a number of threads. All threads within a block are executed concurrently in parallel. the instruction are executed as a kernel.\r
+\r
+Let nbr\_thread be the number of threads executed in parallel, so you can easily transform the (18)formula like this: \r
+\r
+\begin{equation}\r
+Total\_time_{exe}=\left[\frac{N}{nbr\_thread}\left(T_{i}(N)+T_{j}\right)+O(n)\right].Nbr\_iter.\r
+\end{equation}\r
+\r
+In theory, the $Total\_time_{exe}$ on GPU is speed up nbr\_thread times as a $Total\_time_{exe}$ on CPU. We show more details in the experiment part. \r
+~\\\r
+~\\\r
+In CUDA platform, All the instruction of the loop \verb=for= are executed by the GPU as a kernel form. A kernel is a procedure written in CUDA and defined by a heading \verb=__global__=, which means that it is to be executed by the GPU.the following algorithm see the Aberth algorithm on GPU:\r
+\r
+\begin{algorithm}[H]\r
+\LinesNumbered\r
+\caption{Algorithm to find root polynomial with Aberth method}\r
+\r
+\KwIn{$Z^{0}$(Initial root's vector),$\varepsilon$ (error\r
+tolerance threshold),P(Polynomial to solve)}\r
+\r
+\KwOut {Z(The solution root's vector)}\r
+\r
+\BlankLine\r
+\r
+Initialization of the parameter of the polynomial to solve\;\r
+Initialization of the solution vector $Z^{0}$\;\r
+Allocate and fill the data in the global memory GPU\;\r
+\r
+\While {$\Delta z_{max}\succ \epsilon$}{\r
+ Let $\Delta z_{max}=0$\;\r
+$ kernel\_save(d\_Z^{k-1})$\;\r
+$ kernel\_update(d\_z^{k})$\;\r
+$kernel\_testConverge (d_?z_{max},d_Z^{k},d_Z^{k-1})$\;\r
+}\r
+\end{algorithm}\r
+~\\ \r
+\r
+After the initialization step, all data of the root finding problem to be solved must be copied from the CPU memory to the GPU global memory, because the GPUs only work on the data filled in their memories. Next, all the data-parallel arithmetic operations inside the main loop \verb=(do ... while(...))= are executed as kernels by the GPU. The first kernel \textit{save} in line( 6, Algorithm 2) consist to save the vector of polynomial's root found at the previous time step on GPU memory, in order to test the convergence of the root at each iteration in line (8, Algorithme2).\r
+\r
+The second kernel executes the iterative function and update Z(k),as formula (), we notice that the kernel update are called in two forms, separated with the value of R which determines the radius beyond which we apply the logarithm formula like this: \r
+\r
+\begin{algorithm}[H]\r
+\LinesNumbered\r
+\caption{A global Algorithm for the iterative function}\r
+\r
+\eIf{$(\left|Z^{(k)}\right|<= R)$}{\r
+$kernel\_update(d\_z^{k})$\;}\r
+{\r
+$kernel\_update\_Log(d\_z^{k})$\;\r
+}\r
+\end{algorithm}\r
+\r
+The first form execute the formula(8) if all the module's $( |Z(k)|<= R)$, else the kernel execute the formulas(13,14).the radius R was computed like:\r
+\r
+$$R = \exp( \log(DBL\_MAX) / (2*(double)P.degrePolynome) )$$\r
+\r
+The last kernel verify the convergence of the root after each update of $Z^{(k)}$, as formula(), we used the function of the CUBLAS Library (CUDA Basic Linear Algebra Subroutines) to implement this kernel. \r
+\r
+The kernels terminates its computations when all the root are converged. Finally, the solution of the root finding problem is copied back from the GPU global memory to the CPU memory. We use the communication functions of CUDA for the memory allocations in the GPU \verb=(cudaMalloc())= and the data transfers from the CPU memory to the GPU memory \verb=(cudaMemcpyHostToDevice)=\r
+or from the GPU memory to the CPU memory \verb=(cudaMemcpyDeviceToHost))=. \r
+\r
+\r
+\r
+\r
+\subsection{Experimental study}\r
+\r
+\subsubsection{Definition of the polynomial used}\r
+We use a polynomial of the following form for which the\r
+roots are distributed on 2 distinct circles:\r
+\begin{equation}\r
+ \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})\r
+\end{equation}\r
+\r
+This form makes it possible to associate roots having two\r
+different modules and thus to work on a polynomial constitute\r
+of four non zero terms.\r
+\\\r
+ An other form of the polynomial to obtain more non zero terms is:\r
+\begin{equation}\r
+ \forall \alpha_{i} \in C,\forall n_{i}\in N^{*}; P(z)= \sum^{i=1}_{p}(z^{n^{i}}-\alpha_{i})\r
+\end{equation}\r
+\r
+with this formula, we can have until 2p non zero terms.\r
+\r
+\subsubsection{The study condition} \r
+In order to have representative average values, for each\r
+point of our curves we measured the roots finding of 10\r
+different polynomials.\r
+\r
+The our experiences results concern two parameters which are\r
+the polynomial degree and the execution time of our program\r
+to converge on the solution. The polynomial degree allows us\r
+to validate that our algorithm is powerful with high degree\r
+polynomials. The execution time remains the\r
+element-key which justifies our work of parallelization.\r
+ For our tests we used a CPU Intel(R) Xeon(R) CPU\r
+E5620@2.40GHz and a GPU Tesla C2070 (with 6 Go of ram)\r
+\r
+\subsubsection{Comparative study}\r
+We initially carried out the convergence of Aberth algorithm with various sizes of polynomial, in second we evaluate the influence of the size of the threads per block....\r
+\r
+\paragraph{The convergence of Aberth algorithm}\r
+\r
+\begin{table}[!h]\r
+ \centering\r
+ \begin{tabular} {|R{2cm}|L{2.5cm}|L{2.5cm}|L{1.5cm}|L{1.5cm}|}\r
+ \hline Polynomial's degrees & $T_{exe}$ on CPU & $T_{exe}$ on GPU & CPU iteration & GPU iteration\\\r
+ \hline 5000 & 1.90 & 0.40 & 18 & 17\\\r
+ \hline 50000 & 172.723 & 3.92 & 21 & 18\\\r
+ \hline 500000 & -- & 497.109 & -- & 24\\\r
+ \hline 1000000 & -- & 1524,51 & -- & 24\\\r
+ \hline \r
+ \end{tabular}\r
+ \caption{the convergence of Aberth algorithm}\r
+ \label{tab:theConvergenceOfAberthAlgorithm}\r
+\end{table}\r
+ \r
+\paragraph{The impact of the thread's number into the convergence of Aberth algorithm}\r
+\r
+\begin{table}[!h]\r
+ \centering\r
+ \begin{tabular} {|R{2.5cm}|L{2.5cm}|L{2.5cm}|}\r
+ \hline Tread's numbers & Execution time &Number of iteration\\\r
+ \hline 1024 & 523 & 27\\\r
+ \hline 512 & 449.426 & 24\\\r
+ \hline 256 & 440.805 & 24\\\r
+ \hline 128 & 456.175 & 22\\\r
+ \hline 64 & 472.862 & 23\\\r
+ \hline 32 & 830.152 & 24\\\r
+ \hline 8 & 2632.78 & 23 \\\r
+ \hline\r
+ \end{tabular}\r
+ \caption{The impact of the thread's number into the convergence of Aberth algorithm}\r
+ \label{tab:Theimpactofthethread'snumberintotheconvergenceofAberthalgorithm}\r
+ \r
+\end{table}\r
+\r
+\paragraph{A comparative study between Aberth and Durand\-kerner algorithm}\r
+\begin{table}[htbp]\r
+ \centering\r
+ \begin{tabular} {|R{2cm}|L{2.5cm}|L{2.5cm}|L{1.5cm}|L{1.5cm}|}\r
+ \hline Polynomial's degrees & Aberth $T_{exe}$ & D-Kerner $T_{exe}$ & Aberth iteration & D-Kerner iteration\\\r
+ \hline 5000 & 0.40 & 3.42 & 17 & 138 \\\r
+ \hline 50000 & 3.92 & 385.266 & 17 & 823\\\r
+ \hline 500000 & 497.109 & 4677.36 & 24 & 214\\\r
+ \hline \r
+ \end{tabular}\r
+ \caption{Aberth algorith compare to Durand-Kerner algorithm}\r
+ \label{tab:AberthAlgorithCompareToDurandKernerAlgorithm}\r
+\end{table}\r
+\r
+\r
\bibliographystyle{plain}\r
\bibliography{biblio}\r
%% \begin{thebibliography}{2}\r