X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/Krylov_multi.git/blobdiff_plain/c9242f9fee68ee32282c6b18679048eb4c3056b4..HEAD:/krylov_multi_reviewed.tex diff --git a/krylov_multi_reviewed.tex b/krylov_multi_reviewed.tex index 73881ba..7934501 100644 --- a/krylov_multi_reviewed.tex +++ b/krylov_multi_reviewed.tex @@ -8,7 +8,8 @@ \usepackage{multirow} \usepackage{authblk} -\algnewcommand\algorithmicinput{\textbf{Input:}} + +\algnewcommand\algorithmicinput{\textbf{I1nput:}} \algnewcommand\Input{\item[\algorithmicinput]} \algnewcommand\algorithmicoutput{\textbf{Output:}} @@ -83,21 +84,29 @@ thousands of cores are used. Traditional parallel iterative solvers are based on fine-grain computations that frequently require data exchanges between computing nodes and have global -synchronizations that penalize the scalability. Particularly, they are more -penalized on large scale architectures or on distributed platforms composed of -distant clusters interconnected by a high-latency network. It is therefore -imperative to develop coarse-grain based algorithms to reduce the communications -in the parallel iterative solvers. Two possible solutions consists either in -using asynchronous iterative methods~\cite{ref18} or in using multisplitting -algorithmss. In this paper, we will reconsider the use of a multisplitting -method. In opposition to traditional multisplitting method that suffer from slow -convergence, as proposed in~\cite{huang1993krylov}, the use of a minimization -process can drastically improve the convergence. +synchronizations that penalize the scalability~\cite{zkcgb+14:ij}. Particularly, +they are more penalized on large scale architectures or on distributed platforms +composed of distant clusters interconnected by a high-latency network. It is +therefore imperative to develop coarse-grain based algorithms to reduce the +communications in the parallel iterative solvers. Two possible solutions +consists either in using asynchronous iterative methods~\cite{ref18} or in using +multisplitting algorithms. In this paper, we will reconsider the use of a +multisplitting method. In opposition to traditional multisplitting method that +suffer from slow convergence, as proposed in~\cite{huang1993krylov}, the use of +a minimization process can drastically improve the convergence.\\ %%% AJOUTE************************ %%%******************************* -In this work we develop a new parallel two-stage algorithm for large-scale clusters. Our objective is to mix between Krylov based iterative methods and the multisplitting method to improve the scalability. In fact Krylov subspace methods are well-known for their good convergence compared to others iterative methods. So our main contribution is to use the multisplitting method which splits the problem to solve into different blocks in order to reduce the large amount of communications and, to implement both inner and outer iterations as Krylov subspace iterations improving the convergence of the multisplitting algorithm. +\noindent {\bf Contributions:}\\ In this work we develop a new parallel +two-stage algorithm for large-scale clusters. Our objective is to create a mix +between Krylov based iterative methods and the multisplitting method to improve +scalability. In fact Krylov subspace methods are well-known for their good +convergence compared to other iterative methods. So, our main contribution is +to use the multisplitting method which splits the problem to solve into +different blocks in order to reduce the large amount of communications and, to +implement both inner and outer iterations as Krylov subspace iterations in order +to improve the convergence of the multisplitting algorithm.\\ %%%******************************* %%%******************************* @@ -181,7 +190,7 @@ In the case where the diagonal weighting matrices $E_\ell$ have only zero and on %%% MODIFIE ************************ %%%********************************* -Let $Ax=b$ be a given large and sparse linear system of $n$ equations where $A\in\mathbb{R}^{n\times n}$ is a sparse square and non-singular matrix, $x\in\mathbb{R}^{n}$ is the solution vector and $b\in\mathbb{R}^{n}$ is the right-hand side vector. We use a multisplitting method to solve the linear system on a large computing platform in order to reduce the communications. Let the computing platform be composed of $L$ clusters of processors physically adjacent or geographically distant. In this work we apply the block Jacobi multisplitting to the linear system as follows +Let $Ax=b$ be a given large and sparse linear system of $n$ equations where $A\in\mathbb{R}^{n\times n}$ is a sparse square and non-singular matrix, $x\in\mathbb{R}^{n}$ is the solution vector and $b\in\mathbb{R}^{n}$ is the right-hand side vector. We use a multisplitting method to solve the linear system on a large computing platform in order to reduce communications. Let the computing platform be composed of $L$ blocks of processors physically adjacent or geographically distant. In this work we apply the block Jacobi multisplitting method to the linear system as follows %%%********************************* %%%********************************* @@ -199,7 +208,7 @@ b & = & [B_{1}, \ldots, B_{L}] where for $\ell\in\{1,\ldots,L\}$, $A_\ell$ is a rectangular block of size $n_\ell\times n$ and $X_\ell$ and $B_\ell$ are sub-vectors of size $n_\ell$ each, such that $\sum_\ell n_\ell=n$. %%% MODIFIE *********************** %%%******************************** -The splitting is performed row-by-row without overlapping in such a way that successive rows of sparse matrix $A$ and both vectors $x$ and $b$ are assigned to one cluster. +The splitting is performed row-by-row without overlapping in such a way that successive rows of sparse matrix $A$ and both vectors $x$ and $b$ are assigned to a block of processors. %%%******************************** %%%******************************** So, the multisplitting format of the linear system is defined as follows @@ -219,7 +228,7 @@ Y_\ell = B_\ell - \displaystyle\sum_{\substack{m=1\\m\neq \ell}}^{L}A_{\ell m}X_ \right. \label{sec03:eq03} \end{equation} -is solved independently by a {\it cluster of processors} and communications are required to update the right-hand side vectors $Y_\ell$, such that the vectors $X_m$ represent the data dependencies between the clusters. In this work, we use the parallel restarted GMRES method~\cite{ref34} as an inner iteration method to solve sub-systems~(\ref{sec03:eq03}). +is solved independently by a {\it block of processors} and communications are required to update the right-hand side vectors $Y_\ell$, such that the vectors $X_m$ represent the data dependencies between the blocks. In this work, we use the parallel restarted GMRES method~\cite{ref34} as an inner iteration method to solve sub-systems~(\ref{sec03:eq03}). %%% MODIFIE *********************** %%%******************************** GMRES is one of the most used Krylov iterative methods to solve sparse linear systems by minimizing the residuals over an orthonormal basis of a Krylov subspace. @@ -232,9 +241,9 @@ different sub-systems~(\ref{sec03:eq03}) does not necessarily involve the convergence of the multisplitting algorithm. It strongly depends on the properties of the global sparse linear system to be solved~\cite{o1985multi,ref18}. Furthermore, the splitting of the linear system -among several clusters of processors increases the spectral radius of the +among several blocks of processors increases the spectral radius of the iteration matrix, thereby slowing the convergence. In fact, the larger the -number of splitting is, the larger the spectral radius is. In this paper, our +number of splittings is, the larger the spectral radius is. In this paper, our work is based on the work presented in~\cite{huang1993krylov} to increase the convergence and improve the scalability of the multisplitting methods. @@ -251,11 +260,12 @@ S=\{x^1,x^2,\ldots,x^s\},~s\leq n, where for $j\in\{1,\ldots,s\}$, $x^j=[X_1^j,\ldots,X_L^j]$ is a solution of the global linear system. %%% MODIFIE *********************** %%%******************************** -The advantage of such a Krylov subspace is that we neither need an orthonormal basis nor any synchronization between clusters is necessary to orthogonalize the generated basis. This avoids to perform other synchronizations between the blocks of processors. +The advantage of such a Krylov subspace is that we neither need an orthonormal basis nor any synchronization between the different blocks to orthogonalize the generated basis. This avoids to perform other synchronizations between the blocks of processors. + +The multisplitting method is periodically restarted every $s$ iterations with a new initial guess $\tilde{x}=S\alpha$ which minimizes an error function, in our case it minimizes the residuals $\|b-Ax\|_2$ over the Krylov subspace spanned by vectors of $S$. So $\alpha$ is defined as the solution of the large overdetermined linear system. %%%******************************** %%%******************************** -The multisplitting method is periodically restarted every $s$ iterations with a new initial guess $\tilde{x}=S\alpha$ which minimizes the error function $\|b-Ax\|_2$ over the Krylov subspace spanned by vectors of $S$. So $\alpha$ is defined as the solution of the large overdetermined linear system \begin{equation} R\alpha=b, \label{sec03:eq05} @@ -270,7 +280,7 @@ which is associated with the least squares problem \text{minimize}~\|b-R\alpha\|_2, \label{sec03:eq07} \end{equation} -where $R^T$ denotes the transpose of matrix $R$. Since $R$ (i.e. $AS$) and $b$ are split among $L$ clusters, the symmetric positive definite system~(\ref{sec03:eq06}) is solved in parallel. Thus an iterative method would be more appropriate than a direct one to solve this system. We use the parallel Conjugate Gradient method for the normal equations CGNR~\cite{S96,refCGNR}. +where $R^T$ denotes the transpose of matrix $R$. Since $R$ (i.e. $AS$) and $b$ are split among $L$ blocks, the symmetric positive definite system~(\ref{sec03:eq06}) is solved in parallel. Thus an iterative method would be more appropriate than a direct one to solve this system. We use the parallel Conjugate Gradient method for the normal equations CGNR~\cite{S96,refCGNR}. \begin{algorithm}[!t] \caption{A two-stage linear solver with inner iteration GMRES method} @@ -285,12 +295,12 @@ where $R^T$ denotes the transpose of matrix $R$. Since $R$ (i.e. $AS$) and $b$ a \For {$j=1,2,\ldots,s$} \State \label{line7}Inner iteration solver: \Call{InnerSolver}{$x^0$, $j$} \State Construct basis $S$: add column vector $X_\ell^j$ to the matrix $S_\ell^k$ -\State Exchange local values of $X_\ell^j$ with the neighboring clusters +\State Exchange local values of $X_\ell^j$ with the neighboring blocks \State Compute dense matrix $R$: $R_\ell^{k,j}=\sum^L_{i=1}A_{\ell i}X_i^j$ \EndFor \State \label{line12}Minimization $\|b-R\alpha\|_2$: \Call{UpdateMinimizer}{$S_\ell$, $R$, $b$, $k$} \State Local solution of linear system $Ax=b$: $X_\ell^k=\tilde{X}_\ell^k$ -\State Exchange the local minimizer $\tilde{X}_\ell^k$ with the neighboring clusters +\State Exchange the local minimizer $\tilde{X}_\ell^k$ with the neighboring blocks \EndFor \Statex @@ -304,7 +314,7 @@ where $R^T$ denotes the transpose of matrix $R$. Since $R$ (i.e. $AS$) and $b$ a \Statex \Function {UpdateMinimizer}{$S_\ell$, $R$, $b$, $k$} -\State Solving normal equations $(R^k)^TR^k\alpha^k=(R^k)^Tb$ in parallel by $L$ clusters using parallel CGNR method +\State Solving normal equations $(R^k)^TR^k\alpha^k=(R^k)^Tb$ in parallel by $L$ blocks using parallel CGNR method \State Compute local minimizer $\tilde{X}_\ell^k=S_\ell^k\alpha^k$ \State \Return $\tilde{X}_\ell^k$ \EndFunction @@ -312,17 +322,19 @@ where $R^T$ denotes the transpose of matrix $R$. Since $R$ (i.e. $AS$) and $b$ a \label{algo:01} \end{algorithm} -The main key points of our Krylov multisplitting method to solve a large sparse linear system are given in Algorithm~\ref{algo:01}. This algorithm is based on a two-stage method with a minimization using restarted GMRES iterative method as an inner solver. It is executed in parallel by each cluster of processors. Matrices and vectors with the subscript $\ell$ represent the local data for cluster $\ell$, where $\ell\in\{1,\ldots,L\}$. The two-stage solver uses two different parallel iterative algorithms: the GMRES method to solve each splitting~(\ref{sec03:eq03}) on a cluster of processors, and the CGNR method, executed periodically in parallel by all clusters to minimize the function error~(\ref{sec03:eq07}) over the Krylov subspace spanned by $S$. The algorithm requires two global synchronizations between $L$ clusters. The first one is performed line~\ref{line12} in Algorithm~\ref{algo:01} to exchange local values of vector solution $x$ (i.e. the minimizer $\tilde{x}$) required to restart the multisplitting solver. The second one is needed to construct the matrix $R$. We chose to perform this latter synchronization $s$ times in every outer iteration $k$ (line~\ref{line7} in Algorithm~\ref{algo:01}). This is a straightforward way to compute the sparse matrix-dense matrix multiplication $R=AS$. We implemented all synchronizations by using message passing collective communications of MPI library. +The main key points of our Krylov multisplitting method to solve a large sparse linear system are given in Algorithm~\ref{algo:01}. This algorithm is based on a two-stage method with a minimization using restarted GMRES iterative method as an inner solver. It is executed in parallel by each block of processors. Matrices and vectors with the subscript $\ell$ represent the local data for block $\ell$, where $\ell\in\{1,\ldots,L\}$. The two-stage solver uses two different parallel iterative algorithms: the GMRES method to solve each splitting~(\ref{sec03:eq03}) on a block of processors, and the CGNR method, executed periodically in parallel by all blocks to minimize the function error~(\ref{sec03:eq07}) over the Krylov subspace spanned by $S$. The algorithm requires two global synchronizations between $L$ blocks. The first one is performed line~\ref{line12} in Algorithm~\ref{algo:01} to exchange local values of vector solution $x$ (i.e. the minimizer $\tilde{x}$) required to restart the multisplitting solver. The second one is needed to construct the matrix $R$. We chose to perform this latter synchronization $s$ times in every outer iteration $k$ (line~\ref{line7} in Algorithm~\ref{algo:01}). This is a straightforward way to compute the sparse matrix-dense matrix multiplication $R=AS$. We implemented all synchronizations by using message passing collective communications of MPI library. %%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%% \section{Experiments} \label{sec:04} -In order to illustrate the interest of our algorithm, we have compared our -algorithm with the GMRES method which is a commonly used method in many -situations. We have chosen to focus on only one problem which is very simple to -implement: a 3 dimension Poisson problem. +%%% MODIFIE *********************** +%%%******************************** +In order to illustrate the interest of our Krylov multisplitting algorithm, we have compared its performances with those of a classical block Jacobi multisplitting method and those of the GMRES method which is a commonly used method in many situations. +%%%******************************** +%%%******************************** + We have chosen to focus on only one problem which is very simple to implement: a 3 dimension Poisson problem. \begin{equation} \left\{ @@ -341,30 +353,77 @@ obtained for a 3D Poisson problem, the number of iterations is high. Using a preconditioner it is possible to reduce the number of iterations but preconditioners are not scalable when using many cores. + +%%% AJOUTE ************************ +%%%******************************** +We have performed some experiments on an infiniband cluster of three Intel Xeon +quad-core E5620 CPUs of 2.40 GHz and 12 GB of memory. For the GMRES code (alone +and in both multisplitting versions) the restart parameter is fixed to 16. The +precision of the GMRES version is fixed to 1e-6. For the multisplitting +versions, there are two precisions, one for the external solver which is fixed +to 1e-6 and another one for the inner solver (GMRES) which is fixed to 1e-10. It +should be noted that a high precision is used but we also fixed a maximum number +of iterations for each internal step. In practice, we limit the number of +iterations in the internal step to 10. So an internal iteration is finished when +the precision is reached or when the maximum internal number of iterations is +reached. The precision and the maximum number of iterations of CGNR method used +by our Krylov multisplitting algorithm are fixed to 1e-25 and 20 +respectively. The size of the Krylov subspace basis $S$ is fixed to 10 vectors. + +\begin{figure}[htbp] +\centering + \includegraphics[width=0.8\textwidth]{strong_scaling_150x150x150} +\caption{Strong scaling with 3 blocks of 4 cores each to solve a 3D Poisson problem of size $150^3$ components} +\label{fig:001} +\end{figure} + +\begin{figure}[htbp] +\centering +\begin{tabular}{c} +\includegraphics[width=0.8\textwidth]{weak_scaling_280k} \\ \includegraphics[width=0.8\textwidth]{weak_scaling_280K2}\\ +\end{tabular} +\caption{Weak scaling with 3 blocks of 4 cores each to solve a 3D Poisson problem with approximately 280K components per core} +\label{fig:002} +\end{figure} + +%%The experiments are performed on 3 different clusters of cores interconnected by an infiniband network (each cluster is a quad-core CPU). +Figures~\ref{fig:001} and~\ref{fig:002} show the scalability performances of +GMRES, classical multisplitting and Krylov multisplitting methods: strong and +weak scaling are presented respectively. We can remark from these figures that +the performances of our Krylov multisplitting method are better than those of +GMRES and classical multisplitting methods. In the experiments conducted in this +work, our method is approximately twice faster than the GMRES method and about 9 +times faster than the classical multisplitting method. Our multisplitting method +uses a minimization step over a Krylov subspace which reduces the number of +iterations and accelerates the convergence. We can also remark that the +performances of the classical block Jacobi multisplitting method are the worst +compared with those of the other two methods. This is why in the following +experiments we compare the performances of our Krylov multisplitting method with +only those of the GMRES method. +%%%******************************** +%%%******************************** + + +%%% MODIFIE ************************ +%%%********************************* %Doing many experiments with many cores is not easy and requires to access to a supercomputer with several hours for developing a code and then improving it. In the following we present some experiments we could achieve out on the Hector -architecture, a UK's high-end computing resource, funded by the UK Research +architecture, a UK high-end computing resource, funded by the UK Research Councils~\cite{hector}. This is a Cray XE6 supercomputer, equipped with two -16-core AMD Opteron 2.3 Ghz and 32 GB of memory. Machines are interconnected -with a 3D torus. +16-core AMD Opteron 2.3 GHz and 32 GB of memory. Machines are interconnected +with a 3D torus. The different parameters used by the GMRES and the Krylov multisplitting codes are as those previously mentioned. Table~\ref{tab1} shows the result of the experiments. The first column shows -the size of the 3D Poisson problem. The size is chosen in order to have +the size of the 3D Poisson problem. The size is chosen in order to have approximately 50,000 components per core. The second column represents the -number of cores used. In brackets, one can find the decomposition used for the -Krylov multisplitting. The third column and the sixth column respectively show -the execution time for the GMRES and the Krylov multisplitting codes. The fourth -and the seventh column describe the number of iterations. For the -multisplitting code, the total number of inner iterations is represented in -brackets. For the GMRES code (alone and in the multisplitting version) the -restart parameter is fixed to 16. The precision of the GMRES version is fixed to -1e-6. For the multisplitting, there are two precisions, one for the external -solver which is fixed to 1e-6 and another one for the inner solver (GMRES) which -is fixed to 1e-10. It should be noted that a high precision is used but we also -fixed a maximum number of iterations for each internal step. In practice, we -limit the number of iterations in the internal step to 10. So an internal iteration is finished -when the precision is reached or when the maximum internal number of iterations -is reached. The precision and the maximum number of iterations of CGNR method are fixed to 1e-25 and 20 respectively. The size of the Krylov subspace basis $S$ is fixed to 10 vectors. +number of cores used. Between brackets, one can find the decomposition used for +the Krylov multisplitting. The third column and the sixth column respectively +show the execution time for the GMRES and the Krylov multisplitting codes. The +fourth and the seventh column describe the number of iterations. For the +multisplitting code, the total number of inner iterations is represented between +brackets. +%%%******************************** +%%%******************************** \begin{table}[htbp] \begin{center} @@ -393,23 +452,55 @@ $743^3$ & 8,192 (4x2,048) & 704.4 & 87,822 & 4.80e-07 & 110.3 & \end{center} \end{table} - From these experiments, it can be observed that the multisplitting version is always faster than the GMRES version. The acceleration gain of the multisplitting version ranges between 4 and 6. It can be noticed that the number of iterations is drastically reduced with the multisplitting version even it is not -negligible. Moreover, with 8,192 cores, we can see that using 4 clusters gives a -better performance than simply using 2 clusters. In fact, we can notice that the -precision with 2 clusters is slightly better but in both cases the precision is +negligible. Moreover, with 8,192 cores, we can see that using 4 blocks of cores gives a +better performance than simply using 2 blocks. In fact, we can notice that the +precision with 2 blocks is slightly better but in both cases the precision is under the specified threshold. + +%%% AJOUTE************************ +%%%******************************* +In Figure~\ref{fig:01}, the number of iterations per second is reported for both +GMRES and the multisplitting methods. It should be noted that we took only the +inner number of iterations (i.e. the GMRES iterations) for the multisplitting +method. Iterations of CGNR are not taken into account. From this figure, it can +be seen that the number of iterations per second is higher with GMRES but it is +not so different with the multisplitting method. For the case with $8,192$ +cores, the number of iterations per second with 4 blocks is approximately equal +to 115. So it is not different from GMRES. + +\begin{figure}[htbp] +\centering + \includegraphics[width=0.7\textwidth]{nb_iter_sec} +\caption{Number of iterations per second with the same parameters as in Table~\ref{tab1} (weak scaling) with only blocks of cores} +\label{fig:01} +\end{figure} + +\noindent {\bf Final remarks:}\\ It should be noted, on the one hand, that the +development of a complete new code usable with any kind of problem is a really +long and fastidious task if one is working from scratch. On the other hand, +using an existing tool for the inner solver is also quite difficult because it +requires to establish a link between the inner solver and the outer one. We +plan to do that later with engineers working specifically on that point. +Moreover, we think that it is very important to analyze the convergence of this +method compared to other methods. In this work, we have focused on the +description of this method and its performances with a typical application. Many +other investigations are required for this method as explained in the next +section. +%%%******************************* +%%%******************************* + \section{Conclusion and perspectives} We have implemented a Krylov multisplitting method to solve sparse linear systems on large-scale computing platforms. We have developed a synchronous two-stage method based on the block Jacobi multisplitting which uses GMRES iterative method as an inner iteration. Our contribution in this paper is -twofold. First we provide a multi cluster decomposition that allows us to choose -the appropriate size of the clusters according to the architecures of the +twofold. First we provide a multi block decomposition that allows us to choose +the appropriate size of the blocks according to the architecures of the supercomputer. Second, we have implemented the outer iteration of the multisplitting method as a Krylov subspace method which minimizes some error function. This increases the convergence and improves the scalability of the @@ -418,11 +509,11 @@ multisplitting method. We have tested our multisplitting method to solve the sparse linear system issued from the discretization of a 3D Poisson problem. We have compared its performances to the classical GMRES method on a supercomputer composed of 2,048 -to 8,192 cores. The experimental results showed that the multisplitting method is +up-to 8,192 cores. The experimental results showed that the multisplitting method is about 4 to 6 times faster than the GMRES method for different sizes of the problem split into 2 or 4 blocks when using the multisplitting method. Indeed, the GMRES method has difficulties to scale with many cores while the Krylov -multisplitting method allows to hide latency and reduce the inter-cluster +multisplitting method allows to hide latency and reduce the inter-block communications. In future works, we plan to conduct experiments on larger numbers of cores and @@ -437,7 +528,9 @@ preconditioning techniques for Krylov iterative methods and multisplitting methods with overlapping blocks. \section{Acknowledgement} -The authors would like to thank Mark Bull of the EPCC his fruitful remarks and the facilities of HECToR. +The authors would like to thank Mark Bull of the EPCC his fruitful remarks and the facilities of HECToR. This work has been partially supported by the Labex +ACTION project (contract “ANR-11-LABX-01-01”). + %Other applications (=> other matrices)\\ %Larger experiments\\