+Like any parallel code, a GPU parallel implementation first requires to determine the sequential code and the data-parallel operations of a algorithm. In fact, all the operations that are easy to execute in parallel must be made by the GPU to accelerate the execution, like the steps 3 and 4. On the other hand, all the sequential operations and the operations that have data dependencies between CUDA threads or recursive computations must be executed by only one CUDA thread or a CPU thread (the steps 1 and 2).\LZK{La méthode est déjà mal présentée, dans ce cas c'est encore plus difficile de comprendre que représentent ces différentes étapes!} Initially, we specify the organization of parallel threads by specifying the dimension of the grid \verb+Dimgrid+, the number of blocks per grid \verb+DimBlock+ and the number of threads per block.
+
+The code is organized as kernels which are parts of code that are run on GPU devices. For step 3, there are two kernels, the first is 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 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.
+\LZK{Vaut mieux expliquer l'implémentation en faisant référence à l'algo séquentiel que de parler des différentes steps.}
+
+%\begin{algorithm}[htpb]
+%\label{alg1-cuda}
+%\LinesNumbered
+%\SetAlgoNoLine
+%\caption{CUDA Algorithm to find polynomial roots with the Ehrlich-Aberth method}
+%\KwIn{$Z^{0}$ (Initial vector of roots), $\epsilon$ (Error tolerance threshold), P (Polynomial to solve), Pu (Derivative of P), $n$ (Polynomial degree), $\Delta z_{max}$ (Maximum value of stop condition)}
+%\KwOut{$Z$ (Solution vector of roots)}
+
+%\BlankLine
+
+%Initialization of P\;
+%Initialization of Pu\;
+%Initialization of the solution vector $Z^{0}$\;
+%Allocate and copy initial data to the GPU global memory\;
+%\While {$\Delta z_{max} > \epsilon$}{
+% $ ZPres=kernel\_save(Z)$\;
+% $ Z=kernel\_update(Z,P,Pu)$\;
+% $\Delta z_{max}=kernel\_testConv(Z,ZPrec)$\;
+
+%}
+%Copy results from GPU memory to CPU memory\;
+%\end{algorithm}
+
+\begin{algorithm}[htpb]
+\LinesNumbered
+\SetAlgoNoLine
+\caption{Finding roots of polynomials with the Ehrlich-Aberth method on a GPU}
+\KwIn{$n$ (polynomial's degree), $\epsilon$ (tolerance threshold)}
+\KwOut{$Z$ (solution vector of roots)}
+Initialize the polynomial $P$ and its derivative $P'$\;
+Set the initial values of vector $Z$\;
+Copy $P$, $P'$ and $Z$ from CPU to GPU\;
+\While{\emph{not convergence}}{
+ $Z^{prev}$ = KernelSave($Z,n$)\;
+ $Z$ = KernelUpdate($P,P',Z^{prev},n$)\;
+ $\Delta Z$ = KernelComputeError($Z,Z^{prev},n$)\;
+ $\Delta Z_{max}$ = CudaMaxFunction($\Delta Z,n$)\;
+ TestConvergence($\Delta Z_{max},\epsilon$)\;
+}
+Copy $Z$ from GPU to CPU\;
+\label{alg1-cuda}
+\RC{Si l'algo vous convient, il faudrait le détailler précisément\LZK{J'ai modifié l'algo. Sinon, est ce qu'on doit mettre en paramètre $Z^{prev}$ ou $Z$ tout court (dans le cas où on exploite l'asynchronisme des threads cuda!) pour le Kernel\_Update? }}
+\end{algorithm}
+
+
+\section{The EA algorithm on Multiple GPUs}
+\label{sec4}
+\subsection{an OpenMP-CUDA approach}
+Our OpenMP-CUDA implementation of EA algorithm is based on the hybrid
+OpenMP and CUDA programming model. 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 will be responsible to
+update its owns part of the vector Z. This part is call $Z_{loc}$ in
+the following. 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.
+
+To compute one iteration of the EA method each GPU performs the
+followings steps. First roots are shared with OpenMP and the
+computation of the local size for each GPU is performed (lines 5-7 in
+Algo\ref{alg2-cuda-openmp}). Each thread starts by copying all the
+previous roots inside its GPU (line 9). Then each GPU will copy the
+previous roots (line 10) and it will compute an iteration of the EA
+method on its own roots (line 11). For that all the other roots are
+used. The convergence is checked on the new roots (line 12). At the end
+of an iteration, the updated roots are copied from the GPU to the
+CPU (line 14) by direcly updating its own roots in the shared memory
+arrays containing all the roots.
+
+%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).