X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/kahina_paper2.git/blobdiff_plain/77a92aa9f3abb73d75905e7108af76f5bba87567..51b76e69e76be0dbd2c81b750b2e09869faef33d:/paper.tex?ds=inline diff --git a/paper.tex b/paper.tex index 4f0138e..f40cdc2 100644 --- a/paper.tex +++ b/paper.tex @@ -316,6 +316,19 @@ % argument is your BibTeX string definitions and bibliography database(s) %\bibliography{IEEEabrv,../bib/paper} %\bibliographystyle{elsarticle-num} + + + + + +\usepackage[textsize=footnotesize]{todonotes} +\newcommand{\LZK}[2][inline]{% + \todo[color=red!10,#1]{\sffamily\textbf{LZK:} #2}\xspace} + + + + + \begin{document} % % paper title @@ -324,8 +337,8 @@ % not capitalized unless they are the first or last word of the title. % Linebreaks \\ can be used within to get better formatting as desired. % Do not put math or special symbols in the title. -\title{A parallel implementation of Ehrlich-Aberth algorithm for root finding of polynomials -on Multi-GPU with OpenMP/MPI} +\title{Two parallel implementations of Ehrlich-Aberth algorithm for root finding of polynomials +on multiple GPUs with OpenMP and MPI} % author names and affiliations @@ -385,7 +398,9 @@ Fax: (888) 555--1212}} % As a general rule, do not put math, special symbols or citations % in the abstract \begin{abstract} -The abstract goes here. +Finding roots of polynomials is a well-known important but not so very easy problem to solve especially for high degrees. \LZK{il manque quelque chose dans cette phrase. Proposition: Finding roots of polynomials is a very important part of solving real-life problems but it is not an easy task for polynomials of high degrees.} +In this paper, we present two different parallel approaches to achieve this gaol for sparse and fully defined polynomials of up to 1.4 billion degree. Our two approaches are based on the well known parallel paradigms of OpenMP and MPI but combined with the novel CUDA GPU technology. Our results show a quasi-linear speedup using up to 4 GPU devices to solve four times faster a polynomial root finding problem. To our knowledge, this is the first paper to present this technology mix to solve such a highly demanding problem in parallel programming. + \end{abstract} % no keywords @@ -409,7 +424,7 @@ The abstract goes here. Polynomials are mathematical algebraic structures that play an important role in science and engineering by capturing physical phenomena and by expressing any outcome as a function of some unknown variables. Formally speaking, a polynomial $p(x)$ of degree \textit{n} having $n$ coefficients in the complex plane \textit{C} is : %%\begin{center} \begin{equation} - {\Large p(x)=\sum_{i=0}^{n}{a_{i}x^{i}}}. + {\Large p(x)=\sum_{i=0}^{n-1}{a_{i}x^{i}}}. \end{equation} %%\end{center} @@ -490,11 +505,11 @@ bandwidth than the shared memory, the global memory accesses should be minimized We introduced three paradigms of parallel programming. Our objective consists in implementing a root finding polynomial algorithm on multiple GPUs. To this end, it is primordial to know how to manage CUDA contexts of different GPUs. A direct method for controlling the various GPUs is to use as many threads or processes as GPU devices. We can choose the GPU index based on the identifier of OpenMP thread or the rank of the MPI process. Both approaches will be investigated. \section{The EA algorithm on a single GPU} -\subsection{the EA method} +\subsection{The EA method} A cubically convergent iteration method to find zeros of polynomials was proposed by O. Aberth~\cite{Aberth73}. The -Ehrlich-Aberth method contains 4 main steps, presented in what +Ehrlich-Aberth (EA is short) method contains 4 main steps, presented in what follows. %The Aberth method is a purely algebraic derivation. @@ -714,9 +729,9 @@ $num\_gpus$ OpenMP threads are created using \verb=omp_set_num_threads();=funct %\caption{The MPI-CUDA architecture } %\label{fig:03} %\end{figure} -Our parallel implementation of the Ehrlich-Aberth method to find root of polynomials using a CUDA-MPI approach, splits input data of the polynomial to solve among MPI processes. In Algorithm \ref{alg2-cuda-mpi}, input data are the polynomial to solve $P$, the solution vector $Z$, the previous solution vector $ZPrev$, and the value of errors of stop condition $\Delta z$. Let $p$ denote the number of MPI processes on and $n$ the degree of the polynomial to be solved. The algorithm performs a simple data partitioning by creating $p$ portions, of at most $⌈n/p⌉$ roots to find per MPI process, for each $Z$ and $ZPrec$. Consequently, each MPI process of rank $k$ will have its own solution vector $Z_{k}$ and $ZPrec$, the error related to the stop condition $\Delta z_{k}$, enabling each MPI process to compute $⌈n/p⌉$ roots. +Our parallel implementation of EA to find root of polynomials using a CUDA-MPI approach is a data parallel approach. It splits input data of the polynomial to solve among MPI processes. In Algorithm \ref{alg2-cuda-mpi}, input data are the polynomial to solve $P$, the solution vector $Z$, the previous solution vector $ZPrev$, and the value of errors of stop condition $\Delta z$. Let $p$ denote the number of MPI processes on and $n$ the degree of the polynomial to be solved. The algorithm performs a simple data partitioning by creating $p$ portions, of at most $⌈n/p⌉$ roots to find per MPI process, for each $Z$ and $ZPrec$. Consequently, each MPI process of rank $k$ will have its own solution vector $Z_{k}$ and $ZPrec$, the error related to the stop condition $\Delta z_{k}$, enabling each MPI process to compute $⌈n/p⌉$ roots. -Since a GPU works only on data already allocated in its memory, all local input data, $Z_{k}$, $ZPrec$ and $\Delta z_{k}$, must be transferred from CPU memories to the corresponding GPU memories. Afterwards, the same EA algorithm (Algorithm \ref{alg1-cuda}) is run by all processes but on different sub-polynomial roots $ p(x)_{k}=\sum_{i=1}^{n} a_{i}x^{i}, k=1,...,p$. Each MPI process executes the loop \verb=(While(...)...do)= containing the CUDA kernels. Then each MPI process computes only its own portion of the roots indicated with variable \textit{index} initialized in (line 5, Algorithm \ref{alg2-cuda-mpi}), used as an input variable in the $kernel\_update$ (line 10, Algorithm \ref{alg2-cuda-mpi}). After each iteration, MPI processes synchronize using \verb=MPI_Allreduce= function, in order to compute the maximum error related to the stop condition; the reduction on $\Delta z_{k}$ by each MPI process on (line, Algorithm\ref{alg2-cuda-mpi}), and copy the values of new computed roots from GPU memories to CPU memories, then communicate their results to other processes,using \verb=MPI_Alltoall=. If the stop condition is not verified ($error > \epsilon$) then processes stay withing the loop \verb= while(...)...do= until all the roots sufficiently converge. +Since a GPU works only on data already allocated in its memory, all local input data, $Z_{k}$, $ZPrec$ and $\Delta z_{k}$, must be transferred from CPU memories to the corresponding GPU memories. Afterwards, the same EA algorithm (Algorithm \ref{alg1-cuda}) is run by all processes but on different polynomial subset of roots $ p(x)_{k}=\sum_{i=1}^{n} a_{i}x^{i}, k=1,...,p$. Each MPI process executes the loop \verb=(While(...)...do)= containing the CUDA kernels but each MPI process computes only its own portion of the roots according to the rule ``''owner computes``''. The local range of roots is indicated with the \textit{index} variable initialized at (line 5, Algorithm \ref{alg2-cuda-mpi}), and passed as an input variable to $kernel\_update$ (line 10, Algorithm \ref{alg2-cuda-mpi}). After each iteration, MPI processes synchronize (\verb=MPI_Allreduce= function) by a reduction on $\Delta z_{k}$ in order to compute the maximum error related to the stop condition. Finally, processes copy the values of new computed roots from GPU memories to CPU memories, then communicate their results to other processes with \verb=MPI_Alltoall= broadcast. If the stop condition is not verified ($error > \epsilon$) then processes stay withing the loop \verb= while(...)...do= until all the roots sufficiently converge. \begin{enumerate} \begin{algorithm}[htpb] @@ -751,7 +766,7 @@ Since a GPU works only on data already allocated in its memory, all local input \end{enumerate} ~\\ -\section{experiments} +\section{Experiments} We study two categories of polynomials: sparse polynomials and 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} @@ -766,23 +781,22 @@ We study two categories of polynomials: sparse polynomials and full polynomials. {\Large \forall a_{i} \in C, i\in N; p(x)=\sum^{n}_{i=0} a_{i}.x^{i}} \end{equation} For our tests, a CPU Intel(R) Xeon(R) CPU E5620@2.40GHz and a GPU K40 (with 6 Go of ram) are used. +%SIDER : Une meilleure présentation de l'architecture est à faire ici. -We performed a set of experiments on single GPU and Multi-GPU using (OpenMP/MPI) to find roots polynomials with EA algorithm, for both sparse and full polynomials of different sizes. We took into account the execution times and the polynomial size performed by sum or each experiment. -All experimental results obtained from the simulations are made in -double precision data, the convergence threshold of the methods is set -to $10^{-7}$. +In order to evaluate both the MGPU and Multi-GPU approaches, we performed a set of experiments on a single GPU and multiple GPUs using OpenMP or MPI by EA algorithm, for both sparse and full polynomials of different sizes. +All experimental results obtained are made in double precision data, the convergence threshold of the methods is 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 methods are given in %Section~\ref{sec:vec_initialization}. -\subsection{Test with Multi-GPU (CUDA OpenMP) approach} +\subsection{Evaluating the M-GPU (CUDA-OpenMP) approach} -In this part we performed a set of experiments on Multi-GPU (CUDA OpenMP) approach for full and sparse polynomials of different degrees, compare it with Single GPU (CUDA). - \subsubsection{Execution times in seconds of the Ehrlich-Aberth method for solving sparse polynomials on GPUs using shared memory paradigm with OpenMP} +We report here the results of the set of experiments with M-GPU approach for full and sparse polynomials of different degrees, and we compare it with a Single GPU execution. +\subsubsection{Execution times in seconds of the EA method for solving sparse polynomials on GPUs using shared memory paradigm with OpenMP} - In this experiments we report the execution time of the EA algorithm, on single GPU and Multi-GPU with (2,3,4) GPUs, for different sparse polynomial degrees ranging from 100,000 to 1,400,000 +In this experiments we report the execution time of the EA algorithm, on single GPU and Multi-GPU with (2,3,4) GPUs, for different sparse polynomial degrees ranging from 100,000 to 1,400,000. \begin{figure}[htbp] \centering @@ -791,23 +805,23 @@ In this part we performed a set of experiments on Multi-GPU (CUDA OpenMP) appro \label{fig:01} \end{figure} -This figure~\ref{fig:01} shows that (CUDA OpenMP) Multi-GPU approach reduce the execution time up to the scale 100 whereas single GPU is of scale 1000 for polynomial who exceed 1,000,000. It shows the advantage to use OpenMP parallel paradigm to connect the performances of several GPUs and solve a polynomial of high degrees. +This figure~\ref{fig:01} shows that the (CUDA-OpenMP) Multi-GPU approach reduces the execution time by a factor up to 100 w.r.t the single GPU apparaoch and a by a factor of 1000 for polynomials exceeding degree 1,000,000. It shows the advantage to use the OpenMP parallel paradigm to gather the capabilities of several GPUs and solve polynomials of very high degrees. \subsubsection{Execution times in seconds of the Ehrlich-Aberth method for solving full polynomials on GPUs using shared memory paradigm with OpenMP} -This experiments shows the execution time of the EA algorithm, on single GPU (CUDA) and Multi-GPU (CUDA OpenMP) approach for full polynomials of degrees ranging from 100,000 to 1,400,000 +The experiments shows the execution time of the EA algorithm, on a single GPU and on multiple GPUs using the CUDA OpenMP approach for full polynomials of degrees ranging from 100,000 to 1,400,000. \begin{figure}[htbp] \centering \includegraphics[angle=-90,width=0.5\textwidth]{Full_omp} -\caption{Execution times in seconds of the Ehrlich-Aberth method for solving full polynomials on GPUs using shared memory paradigm with OpenMP} +\caption{Execution times in seconds of the Ehrlich-Aberth method for solving full polynomials on multiple GPUs using shared memory paradigm with OpenMP} \label{fig:03} \end{figure} -The second test with full polynomial shows a very important saving of time, for a polynomial of degrees 1,4M (CUDA OpenMP) approach with 4 GPUs compute and solve it 4 times as fast as single GPU. We notice that curves are positioned one below the other one, more the number of used GPUs increases more the execution time decreases. +Results with full polynomials show very important savings in execution time. For a polynomial of degree 1,4 million, the CUDA-OpenMP approach with 4 GPUs solves it 4 times as fast as single GPU, thus achieving a quasi-linear speedup. -\subsection{Test with Multi-GPU (CUDA MPI) approach} -In this part we perform a set of experiment to compare Multi-GPU (CUDA MPI) approach with single GPU, for solving full and sparse polynomials of degrees ranging from 100,000 to 1,400,000. +\subsection{Evaluting the Multi-GPU (CUDA-MPI) approach} +In this part we perform a set of experiments to compare Multi-GPU (CUDA MPI) approach with single GPU, for solving full and sparse polynomials of degrees ranging from 100,000 to 1,400,000. \subsubsection{Execution times in seconds of the Ehrlich-Aberth method for solving sparse polynomials on GPUs using distributed memory paradigm with MPI} @@ -818,7 +832,8 @@ In this part we perform a set of experiment to compare Multi-GPU (CUDA MPI) appr \label{fig:02} \end{figure} ~\\ -This figure shows 4 curves of execution time of EA algorithm, a curve with single GPU, 3 curves with Multi-GPUs (2, 3, 4) GPUs. We see clearly that the curve with single GPU is above the other curves, which shows consumption in execution time compared to the Multi-GPU. We can see the approach Multi-GPU (CUDA MPI) reduces the execution time up to the scale 100 for polynomial of degrees more than 1,000,000 whereas single GPU is of the scale 1000. +This figure shows 4 curves of execution time of EA algorithm, a curve with single GPU, 3 curves with multiple GPUs (2, 3, 4). We can clearly see that the curve with single GPU is above the other curves, which shows consumption in execution time compared to the Multi-GPU. We can see also that the CUDA-MPI approach reduces the execution time by a factor of 100 for polynomials of degree more than 1,000,000 whereas a single GPU is of the scale 1000. +%%SIDER : Je n'ai pas reformuler car je n'ai pas compris la phrase, merci de l'ecrire ici en fran\cais. \\ \subsubsection{Execution times in seconds of the Ehrlich-Aberth method for solving full polynomials on GPUs using distributed memory paradigm with MPI} @@ -828,10 +843,14 @@ This figure shows 4 curves of execution time of EA algorithm, a curve with singl \caption{Execution times in seconds of the Ehrlich-Aberth method for full polynomials on GPUs using distributed memory paradigm with MPI} \label{fig:04} \end{figure} +%SIDER : Corriger le point de la courbe 3-GPUs qui correpsond à un degré de 600000 + +Figure \ref{fig:04} shows the execution time of the algorithm on single GPU and on multipe GPUs with (2, 3, 4) GPUs for full polynomials. With the CUDA-MPI approach, we notice that the three curves are distinct from each other, more we use GPUs more the execution time decreases. On the other hand the curve with a single GPU is well above the other curves. + +This is due to the use of MPI parallel paradigm that divides the problem computations and assigns portions to each GPU. But unlike the single GPU which carries all the computations on a single GPU, data communications are introduced, consequently engendering more execution time. But experiments show that execution time is still highly reduced. + -this figure shows the execution time of the algorithm EA, on single GPU and Multi-GPUS with (2, 3, 4) GPUs for full polynomials. With (CUDA-MPI) approach we notice that the three curves are distinct from each other, more we use GPUs more the execution time decreases, on the other hand the curve with single GPU is well above the other curves. -This is due to the use of parallelization MPI paradigm that divides the polynomial into sub polynomials assigned to each GPU. unlike the single GPU which solves all the polynomial on a single GPU, consequently it engenders more execution time. %\begin{figure}[htbp] %\centering @@ -959,13 +978,13 @@ This is due to the use of parallelization MPI paradigm that divides the polynomi \section{Conclusion} -In this paper, we have presented a parallel implementation of Ehrlich-Aberth algorithm for solving full and sparse polynomials, on single GPU with CUDA and on Multi-GPUs using two parallel paradigm, shared memory with OpenMP, distributed memory with MPI.(CUDA-OpenMP) approach and (CUDA-MPI) approach, -We have performed many experiments with the Ehrlich-Aberth method in single GPU, Multi-GPU with (CUDA-OpenMP) approach, Multi-GPU with (CUDA-MPI) approach for sparse and full polynomials. the experiments show that, using parallel programming model like (OpenMP, MPI) can efficiently manage multiple graphics cards to work together to solve the same problem and accelerate parallel applications, like (CUDA MPI) approach with 4 GPUs can solve a polynomial of 1,000,000 4 speed up than on single GPU. +In this paper, we have presented a parallel implementation of Ehrlich-Aberth algorithm for solving full and sparse polynomials, on single GPU with CUDA and on multiple GPUs using two parallel paradigms : shared memory with OpenMP and distributed memory with MPI. These architectures were addressed by a CUDA-OpenMP approach and CUDA-MPI approach, respectively. +The experiments show that, using parallel programming model like (OpenMP, MPI), we can efficiently manage multiple graphics cards to work together to solve the same problem and accelerate the parallel execution with 4 GPUs and solve a polynomial of degree 1,000,000, four times faster than on single GPU, that is a quasi-linear speedup. %In future, we will evaluate our parallel implementation of Ehrlich-Aberth algorithm on other parallel programming model -Our next objective is to extend the model presented here at nodes clusters frame multi-GPU , with a three-level scheme: inter-node communication via MPI processes (distributed memory), management of multi-GPU node by OpenMP threads (shared memory). +Our next objective is to extend the model presented here at clusters of nodes featuring multiple GPUs, with a three-level scheme: inter-node communication via MPI processes (distributed memory), management of multi-GPU node by OpenMP threads (shared memory). %present a communication approach between multiple GPUs. The comparison between MPI and OpenMP as GPUs controllers shows that these %solutions can effectively manage multiple graphics cards to work together