X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/kahina_paper1.git/blobdiff_plain/66cf7d3dc0285512215d112ffa0688b357dff7c6..ddb6a730b23d7e1c1788a99d6c9e36d8fff8da78:/Root.tex?ds=sidebyside diff --git a/Root.tex b/Root.tex index c845ba8..fd6cc0e 100644 --- a/Root.tex +++ b/Root.tex @@ -6,6 +6,14 @@ %%\usepackage{algorithm2e} \usepackage[ruled,vlined]{algorithm2e} %%\usepackage{algo} + +\usepackage{array,multirow,makecell} +\setcellgapes{1pt} +\makegapedcells +\newcolumntype{R}[1]{>{\raggedleft\arraybackslash }b{#1}} +\newcolumntype{L}[1]{>{\raggedright\arraybackslash }b{#1}} +\newcolumntype{C}[1]{>{\centering\arraybackslash }b{#1}} + \author{ghidouche} \title{Paper1_kahina} \begin{document} @@ -425,9 +433,9 @@ Let Nbr\_iter the number of iteration necessary to compute all the roots,so the \begin{equation} Total\_time_{exe}=\left[N\left(T_{i}(N)+T_{j}\right)+O(n)\right].Nbr\_iter. \end{equation} -The execution time increase with the increasing of the polynomial's root, which take necessary to parallilize this step to reduce the execution time. In the following paper you explain how we parrallelize this step using GPU architecture with CUDA platform. +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. -\subsubsection{Parralelize the steps on GPU } +\subsubsection{Parallelize the steps on GPU } 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. 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. @@ -440,7 +448,7 @@ Total\_time_{exe}=\left[\frac{N}{nbr\_thread}\left(T_{i}(N)+T_{j}\right)+O(n)\ri 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. ~\\ ~\\ -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 kernels created for the step 3 and 4 of the Aberth algorithm: +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: \begin{algorithm}[H] \LinesNumbered @@ -455,24 +463,132 @@ tolerance threshold),P(Polynomial to solve)} Initialization of the parameter of the polynomial to solve\; Initialization of the solution vector $Z^{0}$\; +Allocate and fill the data in the global memory GPU\; \While {$\Delta z_{max}\succ \epsilon$}{ Let $\Delta z_{max}=0$\; -$\prec DimGrid,DimBloc\succ kernel\_save(d\_Z^{k-1});$ -$\prec DimGrid,DimBloc \succ kernel\_update(d\_z^{k});$ - -$\prec DimGrid,DimBloc\succ kernel\_testConverge (d_?z_{max},d_Z^{k},d_Z^{k-1});$ +$ kernel\_save(d\_Z^{k-1})$\; +$ kernel\_update(d\_z^{k})$\; +$kernel\_testConverge (d_?z_{max},d_Z^{k},d_Z^{k-1})$\; } \end{algorithm} ~\\ +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). + +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: + +\begin{algorithm}[H] +\LinesNumbered +\caption{A global Algorithm for the iterative function} + +\eIf{$(\left|Z^{(k)}\right|<= R)$}{ +$kernel\_update(d\_z^{k})$\;} +{ +$kernel\_update\_Log(d\_z^{k})$\; +} +\end{algorithm} + +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 = \exp( \log(DBL\_MAX) / (2*(double)P.degrePolynome) )$$ +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. + +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)= +or from the GPU memory to the CPU memory \verb=(cudaMemcpyDeviceToHost))=. + + + + +\subsection{Experimental study} + +\subsubsection{Definition of the polynomial used} +We use a polynomial of the following form 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} + +This form makes it possible to associate roots having two +different modules and thus to work on a polynomial constitute +of four non zero terms. +\\ + An other form of the polynomial to obtain more non zero terms is: +\begin{equation} + \forall \alpha_{i} \in C,\forall n_{i}\in N^{*}; P(z)= \sum^{i=1}_{p}(z^{n^{i}}-\alpha_{i}) +\end{equation} -here we need to create two kernel for the step 3 \textit{Kernel\_save} is used to save vector $Z^{K-1}$ and \textit{kernel\_update} is used to update the $Z^{k}$ vector. In phase 4 a kernel is created to test the convergence of the method +with this formula, we can have until 2p non zero terms. + +\subsubsection{The study condition} +In order to have representative average values, for each +point of our curves we measured the roots finding of 10 +different polynomials. + +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 Tesla C2070 (with 6 Go of ram) + +\subsubsection{Comparative study} +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.... + +\paragraph{The convergence of Aberth algorithm} + +\begin{table}[!h] + \centering + \begin{tabular} {|R{2cm}|L{2.5cm}|L{2.5cm}|L{1.5cm}|L{1.5cm}|} + \hline Polynomial's degrees & $T_{exe}$ on CPU & $T_{exe}$ on GPU & CPU iteration & GPU iteration\\ + \hline 5000 & 1.90 & 0.40 & 18 & 17\\ + \hline 50000 & 172.723 & 3.92 & 21 & 18\\ + \hline 500000 & -- & 497.109 & -- & 24\\ + \hline 1000000 & -- & 1524,51 & -- & 24\\ + \hline + \end{tabular} + \caption{the convergence of Aberth algorithm} + \label{tab:theConvergenceOfAberthAlgorithm} +\end{table} + +\paragraph{The impact of the thread's number into the convergence of Aberth algorithm} + +\begin{table}[!h] + \centering + \begin{tabular} {|R{2.5cm}|L{2.5cm}|L{2.5cm}|} + \hline Tread's numbers & Execution time &Number of iteration\\ + \hline 1024 & 523 & 27\\ + \hline 512 & 449.426 & 24\\ + \hline 256 & 440.805 & 24\\ + \hline 128 & 456.175 & 22\\ + \hline 64 & 472.862 & 23\\ + \hline 32 & 830.152 & 24\\ + \hline 8 & 2632.78 & 23 \\ + \hline + \end{tabular} + \caption{The impact of the thread's number into the convergence of Aberth algorithm} + \label{tab:Theimpactofthethread'snumberintotheconvergenceofAberthalgorithm} + +\end{table} + +\paragraph{A comparative study between Aberth and Durand\-kerner algorithm} +\begin{table}[htbp] + \centering + \begin{tabular} {|R{2cm}|L{2.5cm}|L{2.5cm}|L{1.5cm}|L{1.5cm}|} + \hline Polynomial's degrees & Aberth $T_{exe}$ & D-Kerner $T_{exe}$ & Aberth iteration & D-Kerner iteration\\ + \hline 5000 & 0.40 & 3.42 & 17 & 138 \\ + \hline 50000 & 3.92 & 385.266 & 17 & 823\\ + \hline 500000 & 497.109 & 4677.36 & 24 & 214\\ + \hline + \end{tabular} + \caption{Aberth algorith compare to Durand-Kerner algorithm} + \label{tab:AberthAlgorithCompareToDurandKernerAlgorithm} +\end{table} -\subsubsection{the kernel corresponding } -\subsubsection{Comparison between sequential algorithm and GPU algorithm } \bibliographystyle{plain} \bibliography{biblio} %% \begin{thebibliography}{2}