X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/kahina_paper2.git/blobdiff_plain/867e83f7cceed45f069eddbdc5ae04562f715ddb..52c13a5b7c87a55b164309ce2c92eb6a6b9e6df1:/paper.tex

diff --git a/paper.tex b/paper.tex
index 49cd195..72d9379 100644
--- a/paper.tex
+++ b/paper.tex
@@ -715,8 +715,8 @@ where:
 \begin{eqnarray}
 \label{Log_H1}
 Q(z^{k}_{i})=\exp\left( \ln (p(z^{k}_{i}))-\ln(p'(z^{k}_{i}))+\ln \left(
-\sum_{i\neq j}^{n}\frac{1}{z^{k}_{i}-z^{k}_{j}}\right)\right)\\
-i=1,...,n, \nonumber
+\sum_{i\neq j}^{n}\frac{1}{z^{k}_{i}-z^{k}_{j}}\right)\right) \nonumber  \\
+i=1,...,n  
 \end{eqnarray}
 
 
@@ -727,41 +727,52 @@ Using the logarithm  and the exponential operators, we can replace any multiplic
 %propose to use the logarithm and the exponential of a complex in order to compute the power at a high exponent. Using the logarithm  and the exponential operators, we can replace any multiplications and divisions with additions and subtractions. Consequently, computations manipulate lower absolute values and the roots for large polynomial degrees can be looked for successfully~\cite{Karimall98}.
 
 \subsection{Ehrlich-Aberth parallel implementation on CUDA}
-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.
-
-
-
-
-Like any parallel code, a GPU parallel implementation first
-requires to determine the sequential tasks and the
-parallelizable parts of the sequential version of the
-program/algorithm. In our case, all the operations that are easy
-to execute in parallel must be made by the GPU to accelerate
-the execution of the application, like the step 3 and step 4. On the other hand, all the
-sequential operations and the operations that have data
-dependencies between threads or recursive computations must
-be executed by only one CUDA or CPU thread (step 1 and step 2). Initially, we specify the organization of parallel threads, by specifying the dimension of the grid Dimgrid, the number of blocks per grid DimBlock and the number of threads per block. 
-
-The code is organized  by what is named kernels, portions code that are run on GPU devices. For step 3, there are two kernels, the
-first named \textit{save} is used to save vector $Z^{K-1}$ and the seconde one is named
-\textit{update} and is used to update the $Z^{K}$ vector. For step 4, a kernel 
-tests the convergence of the method. In order to
-compute the function H, we have two possibilities: either to use
-the Jacobi mode, or the Gauss-Seidel mode of iterating which uses the
-most recent computed roots. It is well known that the Gauss-
-Seidel mode converges more quickly. So, we used the Gauss-Seidel mode of iteration. To
-parallelize the code, we created kernels and many functions to
-be executed on the GPU for all the operations dealing with the
+%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.
+
+
+
+
+Like any parallel code, a GPU parallel implementation first requires
+to determine the sequential tasks and the parallelizable parts of the
+sequential version of the program/algorithm. In our case, all the
+operations that are easy to execute in parallel must be made by the
+GPU to accelerate the execution of the application, like the step 3
+and step 4. On the other hand, all the sequential operations and the
+operations that have data dependencies between threads or recursive
+computations must be executed by only one CUDA or CPU thread (step 1
+and step 2). Initially, we specify the organization of parallel
+threads, by specifying the dimension of the grid Dimgrid, the number
+of blocks per grid DimBlock and the number of threads per block.
+
+The code is organized kernels which are part of code that are run on
+GPU devices. For step 3, there are two kernels, the first named
+\textit{save} is used to save vector $Z^{K-1}$ and the second one is
+named \textit{update} and is used to update the $Z^{K}$ vector. For
+step 4, a kernel tests the convergence of the method. In order to
+compute the function H, we have two possibilities: either to use the
+Jacobi mode, or the Gauss-Seidel mode of iterating which uses the most
+recent computed roots. It is well known that the Gauss-Seidel mode
+converges more quickly. So, we use Gauss-Seidel iterations. To
+parallelize the code, we create kernels and many functions to be
+executed on the GPU for all the operations dealing with the
 computation on complex numbers and the evaluation of the
-polynomials. As said previously, we managed both functions
-of evaluation of a polynomial: the normal method, based on
-the method of Horner and the method based on the logarithm
-of the polynomial. All these methods were rather long to
-implement, as the development of corresponding kernels with
-CUDA is longer than on a CPU host. This comes in particular
-from the fact that it is very difficult to debug CUDA running
-threads like threads on a CPU host. In the following paragraph
-Algorithm~\ref{alg1-cuda} shows the GPU parallel implementation of Ehrlich-Aberth method.
+polynomials. As said previously, we manage both functions of
+evaluation: the normal method, based on the method of
+Horner and the method based on the logarithm of the polynomial. All
+these methods were rather long to implement, as the development of
+corresponding kernels with CUDA is longer than on a CPU host. This
+comes in particular from the fact that it is very difficult to debug
+CUDA running threads like threads on a CPU host. In the following
+paragraph Algorithm~\ref{alg1-cuda} shows the GPU parallel
+implementation of Ehrlich-Aberth method.
 
 \begin{enumerate}
 \begin{algorithm}[htpb]
@@ -794,13 +805,27 @@ Algorithm~\ref{alg1-cuda} shows the GPU parallel implementation of Ehrlich-Abert
 \end{enumerate}
 ~\\ 
 
-
+\RC{Le code n'est pas expliquÃ© et je me demande si c'est utile de
+  mettre ca...}
  
 \section{The EA algorithm on Multiple GPUs}
 \label{sec4}
 \subsection{M-GPU : an OpenMP-CUDA approach}
-Our OpenMP-CUDA implementation of EA algorithm is based on the hybrid OpenMP and CUDA programming model. It works as follows.
-Based on the metadata, a shared memory is used to make data evenly shared among OpenMP threads. The shared data are the solution vector $Z$, the polynomial to solve $P$, and  the error vector $\Delta z$. Let (T\_omp) the number of OpenMP threads be equal to the number of GPUs, each OpenMP thread binds to one GPU,  and controls a part of the shared memory, that is a part of the vector Z , that is $(n/num\_gpu)$ roots where $n$ is the polynomial's degree and $num\_gpu$ the total number of available GPUs. Each OpenMP thread copies its data from host memory to GPUâs device memory. Then every GPU will have a grid of computation organized according to the device performance and the size of data on which it runs the computation kernels. %In principle a grid is set by two parameter DimGrid, the number of block per grid, DimBloc: the number of threads per block. The following schema  shows the architecture of (CUDA,OpenMP).
+Our OpenMP-CUDA implementation of EA algorithm is based on the hybrid
+OpenMP and CUDA programming model. It works as follows.  All the data
+are shared with OpenMP amoung all the OpenMP threads. The shared data
+are the solution vector $Z$, the polynomial to solve $P$, and the
+error vector $\Delta z$. The number of OpenMP threads is equal to the
+number of GPUs, each OpenMP thread binds to one GPU, and it controls a
+part of the shared memory. More precisely each OpenMP thread owns of
+the vector Z, that is $(n/num\_gpu)$ roots where $n$ is the
+polynomial's degree and $num\_gpu$ the total number of available
+GPUs. Each OpenMP thread copies its data from host memory to GPUâs
+device memory. Then all GPUs will have a grid of computation organized
+according to the device performance and the size of data on which it
+runs the computation kernels.
+
+%In principle a grid is set by two parameter DimGrid, the number of block per grid, DimBloc: the number of threads per block. The following schema  shows the architecture of (CUDA,OpenMP).
 
 %\begin{figure}[htbp]
 %\centering
@@ -810,6 +835,7 @@ Based on the metadata, a shared memory is used to make data evenly shared among
 %\end{figure}
 %Each thread OpenMP compute the kernels on GPUs,than after each iteration they copy out the data from GPU memory to CPU shared memory. The kernels are re-runs is up to the roots converge sufficiently. Here are below the corresponding algorithm:
 
+\RC{Surement Ã  virer ou rÃ©Ã©crire pour etre compris sans algo}
 $num\_gpus$ OpenMP threads  are created using \verb=omp_set_num_threads();=function (step $3$, Algorithm \ref{alg2-cuda-openmp}), the shared memory is created using \verb=#pragma omp parallel shared()= OpenMP function (line $5$, Algorithm\ref{alg2-cuda-openmp}), then each OpenMP thread allocates memory and copies initial data from CPU memory to GPU global memory, executes the kernels on GPU, but computes only his portion of roots indicated with variable \textit{index} initialized in (line 5, Algorithm \ref{alg2-cuda-openmp}), used as input data in the $kernel\_update$ (line 10, Algorithm \ref{alg2-cuda-openmp}). After each iteration, all OpenMP threads synchronize using \verb=#pragma omp barrier;= to gather all the correct values of $\Delta z$, thus allowing the computation the maximum stop condition on vector $\Delta z$ (line 12, Algorithm \ref{alg2-cuda-openmp}). Finally, threads copy the results from GPU memories to CPU memory. The OpenMP threads execute kernels until the roots sufficiently converge.  
 \begin{enumerate}
 \begin{algorithm}[htpb]
@@ -847,7 +873,7 @@ $num\_gpus$ OpenMP threads  are created using \verb=omp_set_num_threads();=funct
 \end{algorithm}
 \end{enumerate}
 ~\\ 
-
+\RC{C'est encore pire ici, on ne voit pas les comm CPU <-> GPU }
 
 
 \subsection{Multi-GPU : an MPI-CUDA approach}
@@ -894,6 +920,8 @@ Since a GPU works only on data already allocated in its memory, all local input
 \end{enumerate}
 ~\\ 
 
+\RC{ENCORE ENCORE PIRE}
+
 \section{Experiments}
 \label{sec5}
 We study two categories of polynomials: sparse polynomials and full polynomials.\\
