X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/kahina_paper2.git/blobdiff_plain/a65ed0e53d03bcf65eeb8c281dea8e57823299a3..7620333f88cf490eac21e8a1c1e1d29a6934533f:/paper.tex?ds=inline diff --git a/paper.tex b/paper.tex index 7878657..fbdcac7 100644 --- a/paper.tex +++ b/paper.tex @@ -315,7 +315,7 @@ \bibliographystyle{IEEEtran} % argument is your BibTeX string definitions and bibliography database(s) %\bibliography{IEEEabrv,../bib/paper} -\bibliographystyle{elsarticle-num} +%\bibliographystyle{elsarticle-num} \begin{document} % % paper title @@ -406,19 +406,19 @@ The abstract goes here. \section{Introduction} -Polynomials are mathematical algebraic structures used in science and engineering to capture physical phenomena and to express any outcome in the form of 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 : +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}}}. \end{equation} %%\end{center} -The root finding problem consists in finding the values of all the $n$ values of the variable $x$ for which \textit{p(x)} is nullified. Such values are called zeros of $p$. If zeros are $\alpha_{i},\textit{i=1,...,n}$ the $p(x)$ can be written as : +The root finding problem consists in finding the values of all the $n$ different values of the variable $x$ for which \textit{p(x)} is null. Such values are called zeros of $p$. If zeros are $\alpha_{i},\textit{i=1,...,n}$ then $p(x)$ can be written as : \begin{equation} {\Large p(x)=a_{n}\prod_{i=1}^{n}(x-\alpha_{i}), a_{0} a_{n}\neq 0}. \end{equation} -The problem of finding the roots of polynomials is encountered in different applications. Most of the numerical methods that deal with this problem are simultaneous ones. These methods start from the initial approximations of all the roots of the polynomial and give a sequence of approximations that converge to the roots of the polynomial. The first method of this group is Durand-Kerner method: +The problem of finding the roots of polynomials can be encountered in numerous applications. Most of the numerical methods that deal with this problem are simultaneous ones, i.e that find concurrently all of $n$ zeroes. These methods start from the initial approximations of all the roots of the polynomial and give a sequence of approximations that converge to the roots of the polynomial. The first method of this group is Durand-Kerner method: \begin{equation} \label{DK} DK: z_i^{k+1}=z_{i}^{k}-\frac{P(z_i^{k})}{\prod_{i\neq j}(z_i^{k}-z_j^{k})}, i = 1, . . . , n, @@ -442,18 +442,18 @@ point $z$. %Aberth, Ehrlich and Farmer-Loizou~\cite{Loizou83} have proved that %the Ehrlich-Aberth method (EA) has a cubic order of convergence for simple roots whereas the Durand-Kerner has a quadratic order of %convergence. -The main problem of the simultaneous methods is that the necessary time needed for the convergence is increased with the increasing of the degree of the polynomial. Many authors have treated the problem of implementation of simultaneous methods in parallel. Freeman [10] implemented and compared DK, EA and another method of the fourth order proposed by Farmer -and Loizou [9], on a 8-processor linear chain, for polynomials of degree up to 8. -The third method often diverges, but the first two methods have speed-up equal to 5.5. Later, Freeman and Bane [11] considered asynchronous algorithms, in which each processor continues to update its approximations even though the latest values of other $z^{k}_{i}$ have not been received from the other processors, in contrast with synchronous algorithms where it would wait those values before -making a new iteration. Couturier and al. [12] proposed two methods of parallelization for a shared memory architecture with \textit{OpenMP} and for distributed memory one with \textit{MPI}. They were able to compute the roots of sparse polynomials of degree 10,000 in 116 seconds with \textit{OpenMP} and 135 seconds with \textit{MPI} only 8 personal computers and 2 communications per iteration. Comparing to the sequential implementation where it takes up to 3,300 seconds to obtain the same results, the authors show an interesting speedup. +The main problem of the simultaneous methods is that the necessary time needed for the convergence is increased with the increasing of the degree of the polynomial. Many authors have treated the problem of implementing simultaneous methods in parallel. Freeman~\cite{Freeman89} implemented and compared DK, EA and another method of the fourth order proposed by Farmer +and Loizou~\cite{Loizou83}, on a 8-processor linear chain, for polynomials of degree up to 8. +The third method often diverges, but the first two methods have speed-up equal to 5.5. Later, Freeman and Bane~\cite{Freemanall90} considered asynchronous algorithms, in which each processor continues to update its approximations even though the latest values of other $z^{k}_{i}$ have not been received from the other processors, in contrast with synchronous algorithms where it would wait those values before +making a new iteration. Couturier and al.~\cite{Raphaelall01} proposed two methods of parallelization for a shared memory architecture with \textit{OpenMP} and for distributed memory one with \textit{MPI}. They were able to compute the roots of sparse polynomials of degree 10,000 in 116 seconds with \textit{OpenMP} and 135 seconds with \textit{MPI} only by using 8 personal computers and 2 communications per iteration. Comparing to the sequential implementation where it takes up to 3,300 seconds to obtain the same results, the authors show an interesting speedup. -Very few works had been performed since this last work until the appearing of the Compute Unified Device Architecture (CUDA) [13], a parallel computing platform and a programming model invented by NVIDIA. The computing power of GPUs (Graphics Processing Unit) has exceeded that of CPUs. However, CUDA adopts a totally new computing architecture to use the hardware resources provided by GPU in order to offer a stronger computing ability to the massive data computing. Ghidouche and al [14] proposed an implementation of the Durand-Kerner method on GPU. Their main result showed that a parallel CUDA implementation is about 10 times faster than the sequential implementation on a single CPU for sparse polynomials of degree 48,000. +Very few work had been performed since then until the appearing of the Compute Unified Device Architecture (CUDA)~\cite{CUDA10}, a parallel computing platform and a programming model invented by NVIDIA. The computing power of GPUs (Graphics Processing Unit) has exceeded that of CPUs. However, CUDA adopts a totally new computing architecture to use the hardware resources provided by GPU in order to offer a stronger computing ability to the massive data computing. Ghidouche and al~\cite{Kahinall14} proposed an implementation of the Durand-Kerner method on GPU. Their main result showed that a parallel CUDA implementation is about 10 times faster than the sequential implementation on a single CPU for sparse polynomials of degree 48,000. -Finding polynomial roots rapidly and accurately is the main objective of our work. In this paper we propose the parallelization of Ehrlich-Aberth method using a parallel programming paradigms (OpenMP, MPI) on GPUs. We consider two architectures: Shared memory with OpenMP API based on threads from the same system process, which each thread is attached to one GPU and after the various memory allocation, each thread throws its part of calculation ( to do this you must first load on the GPU required data and after Suddenly repatriate the result on the host). Distributed memory with MPI: The MPI library is often used for parallel programming [11] in -cluster systems because it is a message-passing programming language. Each GPU are attached to one process MPI, and a loop is in charge of the distribution of tasks between the MPI processes. this solution can be used on one GPU, or executed on a distributed cluster of GPUs, employing the Message Passing Interface (MPI) to communicate between separate CUDA cards. This solution permits scaling of the problem size to larger classes than would be possible on a single device and demonstrates the performance which users might expect from future +Finding polynomial roots rapidly and accurately is the main objective of our work. In this paper we propose the parallelization of Ehrlich-Aberth method using parallel programming paradigms (OpenMP, MPI) on GPUs. We consider two architectures: shared memory with OpenMP API and distributed memory MPI API. The first approach is based on threads from the same system process, with each thread attached to one GPU and after the various memory allocations, each thread launches its part of computations. To do this we must first load on the GPU required data and after the computations are carried, repatriate the result on the host. The second approach i.e distributed memory with MPI relies on the MPI library which is often used for parallel programming~\cite{Peter96} in +cluster systems because it is a message-passing programming language. Each GPU is attached to one MPI process, and a loop is in charge of the distribution of tasks between the MPI processes. This solution can be used on one GPU, or executed on a distributed cluster of GPUs, employing the Message Passing Interface (MPI) to communicate between separate CUDA cards. This solution permits scaling of the problem size to larger classes than would be possible on a single device and demonstrates the performance which users might expect from future HPC architectures where accelerators are deployed. -This paper is organized as follows, in section 2 we recall the Ehrlich-Aberth method. In section 3 we present EA algorithm on single GPU. In section 4 we propose the EA algorithm implementation on MGPU for (OpenMP-CUDA) approach and (MPI-CUDA) approach. In section 5 we present our experiments and discus it. Finally, Section~\ref{sec6} concludes this paper and gives some hints for future research directions in this topic. +This paper is organized as follows, in section 2 we recall the Ehrlich-Aberth method. In section 3 we present EA algorithm on single GPU. In section 4 we propose the EA algorithm implementation on Multi-GPU for (OpenMP-CUDA) approach and (MPI-CUDA) approach. In section 5 we present our experiments and discus it. Finally, Section~\ref{sec6} concludes this paper and gives some hints for future research directions in this topic. \section{Parallel Programmings Model} @@ -461,10 +461,7 @@ This paper is organized as follows, in section 2 we recall the Ehrlich-Aberth me \subsection{OpenMP} Open Multi-Processing (OpenMP) is a shared memory architecture API that provides multi thread capacity~\cite{openmp13}. OpenMP is a portable approach for parallel programming on shared memory systems based on compiler directives, that can be included in order -to parallelize a loop. In this way, a set of loops can be distributed along the different threads that will access to different data allo- -cated in local shared memory. One of the advantages of OpenMP is its global view of application memory address space that allows relatively fast development of parallel applications with easier maintenance. However, it is often difficult to get high rates of -performance in large scale applications. Although, in OpenMP a usage of threads ids and managing data explicitly as done in an MPI -code can be considered, it defeats the advantages of OpenMP. +to parallelize a loop. In this way, a set of loops can be distributed along the different threads that will access to different data allocated in local shared memory. One of the advantages of OpenMP is its global view of application memory address space that allows relatively fast development of parallel applications with easier maintenance. However, it is often difficult to get high rates of performance in large scale applications. Although usage of OpenMP threads and managed data explicitly done with MPI can be considered, this approcache undermines the advantages of OpenMP. %\subsection{OpenMP} %L'article en Français Programmation multiGPU – OpenMP versus MPI %OpenMP is a shared memory programming API based on threads from @@ -477,20 +474,20 @@ code can be considered, it defeats the advantages of OpenMP. %have private memory areas [6]. \subsection{MPI} - The library MPI allows to use a distributed memory architecture. The various processes have their own environment of execution and execute their codes in a asynchronous way, according to the model MIMD (Multiple Instruction streams, Multiple Dated streams); they communicate and synchronize by exchanges of messages~\cite{Peter96}. MPI messages are explicitly sent, while the exchanges are implicit within the framework of a programming multi-thread (OpenMP/Pthreads). +The MPI (Message Passing Interface) library allows to create computer programs that run on a distributed memory architecture. The various processes have their own environment of execution and execute their code in a asynchronous way, according to the MIMD model (Multiple Instruction streams, Multiple Data streams); they communicate and synchronise by exchanging messages~\cite{Peter96}. MPI messages are explicitly sent, while the exchanges are implicit within the framework of a multi-thread programming environment like OpenMP or Pthreads. \subsection{CUDA}%L'article en anglais Multi-GPU and multi-CPU accelerated FDTD scheme for vibroacoustic applications - CUDA (an acronym for Compute Unified Device Architecture) is a parallel computing architecture developed by NVIDIA~\cite{NVIDIA12}. The -unit of execution in CUDA is called a thread. Each thread executes the kernel by the streaming processors in parallel. In CUDA, -a group of threads that are executed together is called thread blocks, and the computational grid consists of a grid of thread -blocks. Additionally, a thread block can use the shared memory on a single multiprocessor as while as the grid executes a single +CUDA (an acronym for Compute Unified Device Architecture) is a parallel computing architecture developed by NVIDIA~\cite{CUDA10}. The +unit of execution in CUDA is called a thread. Each thread executes a kernel by the streaming processors in parallel. In CUDA, +a group of threads that are executed together is called a thread block, and the computational grid consists of a grid of thread +blocks. Additionally, a thread block can use the shared memory on a single multiprocessor while the grid executes a single CUDA program logically in parallel. Thus in CUDA programming, it is necessary to design carefully the arrangement of the thread blocks in order to ensure low latency and a proper usage of shared memory, since it can be shared only in a thread block scope. The effective bandwidth of each memory space depends on the memory access pattern. Since the global memory has lower bandwidth than the shared memory, the global memory accesses should be minimized. -We introduced three paradigms of parallel programming. Our objective consist to implement an algorithm of root finding polynomial on multiple GPUs. It primordial to know how manage CUDA context of different GPUs. A direct method for controlling the various GPU is to use as many threads or processes that GPU. We can choose the GPU index based on the identifier of OpenMP thread or the rank of the MPI process. Both approaches will be created. +We introduced three paradigms of parallel programming. Our objective consist to implement an algorithm of root finding polynomial on multiple GPUs. It primordial to know how to manage CUDA contexts of different GPUs. A direct method for controlling the various GPU 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 single GPU} \subsection{the EA method} @@ -559,13 +556,13 @@ v_{i}=\frac{|\frac{a_{n}}{a_{i}}|^{\frac{1}{n-i}}}{2}. \subsubsection{Iterative Function} The operator used by the Aberth method is corresponding to the -following equation~\ref{Eq:EA} which will enable the convergence towards +following equation~\ref{Eq:EA1} which will enable the convergence towards polynomial solutions, provided all the roots are distinct. %Here we give a second form of the iterative function used by the Ehrlich-Aberth method: \begin{equation} -\label{Eq:EA} +\label{Eq:EA1} EA: z^{k+1}_{i}=z_{i}^{k}-\frac{\frac{p(z_{i}^{k})}{p'(z_{i}^{k})}} {1-\frac{p(z_{i}^{k})}{p'(z_{i}^{k})}\sum_{j=1,j\neq i}^{j=n}{\frac{1}{(z_{i}^{k}-z_{j}^{k})}}}, i=1,. . . .,n \end{equation} @@ -837,33 +834,37 @@ This figure shows 4 curves of execution time of EA algorithm, a curve with singl \label{fig:04} \end{figure} -\begin{figure}[htbp] -\centering - \includegraphics[angle=-90,width=0.5\textwidth]{Sparse} -\caption{Comparaison between MPI and OpenMP versions of the Ehrlich-Aberth method for solving sparse plynomials on GPUs} -\label{fig:05} -\end{figure} -\begin{figure}[htbp] -\centering - \includegraphics[angle=-90,width=0.5\textwidth]{Full} -\caption{Comparaison between MPI and OpenMP versions of the Ehrlich-Aberth method for solving full polynomials on GPUs} -\label{fig:06} -\end{figure} +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 - \includegraphics[angle=-90,width=0.5\textwidth]{MPI} -\caption{Comparaison of execution times of the Ehrlich-Aberth method for solving sparse and full polynomials on GPUs with distributed memory paradigm using MPI} -\label{fig:07} -\end{figure} +%\begin{figure}[htbp] +%\centering + % \includegraphics[angle=-90,width=0.5\textwidth]{Sparse} +%\caption{Comparaison between MPI and OpenMP versions of the Ehrlich-Aberth method for solving sparse plynomials on GPUs} +%\label{fig:05} +%\end{figure} -\begin{figure}[htbp] -\centering - \includegraphics[angle=-90,width=0.5\textwidth]{OMP} -\caption{Comparaison of execution times of the Ehrlich-Aberth method for solving sparse and full polynomials on GPUs with shared memory paradigm using OpenMP} -\label{fig:08} -\end{figure} +%\begin{figure}[htbp] +%\centering + % \includegraphics[angle=-90,width=0.5\textwidth]{Full} +%\caption{Comparaison between MPI and OpenMP versions of the Ehrlich-Aberth method for solving full polynomials on GPUs} +%\label{fig:06} +%\end{figure} + +%\begin{figure}[htbp] +%\centering + % \includegraphics[angle=-90,width=0.5\textwidth]{MPI} +%\caption{Comparaison of execution times of the Ehrlich-Aberth method for solving sparse and full polynomials on GPUs with distributed memory paradigm using MPI} +%\label{fig:07} +%\end{figure} + +%\begin{figure}[htbp] +%\centering + % \includegraphics[angle=-90,width=0.5\textwidth]{OMP} +%\caption{Comparaison of execution times of the Ehrlich-Aberth method for solving sparse and full polynomials on GPUs with shared memory paradigm using OpenMP} +%\label{fig:08} +%\end{figure} % An example of a floating figure using the graphicx package. % Note that \label must occur AFTER (or within) \caption. @@ -963,7 +964,19 @@ This figure shows 4 curves of execution time of EA algorithm, a curve with singl \section{Conclusion} -The conclusion goes here~\cite{IEEEexample:bibtexdesign}. +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 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 effectively 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 future, we will evaluate our parallel implementation of Ehrlich-Aberth algorithm on other parallel programming model + + +%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 +%to solve the same problem + + + %than we have presented two communication approach between multiple GPUs.(CUDA-OpenMP) approach and (CUDA-MPI) approach, in the objective to manage multiple graphics cards to work together and solve the same problem. in the objective to manage multiple graphics cards to work together and solve the same problem.