X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/GMRES_For_Journal.git/blobdiff_plain/e346549807fbc51f5b361163ff612d15f69efc12..80e04ca47ac0bdfc41b5102add1f359501bd5c76:/GMRES_Journal.tex?ds=inline diff --git a/GMRES_Journal.tex b/GMRES_Journal.tex index ee4f62e..541d873 100644 --- a/GMRES_Journal.tex +++ b/GMRES_Journal.tex @@ -19,26 +19,26 @@ \usepackage{url} \usepackage{mdwlist} \usepackage{multirow} -\usepackage{color} +%\usepackage{color} \date{} \title{Parallel sparse linear solver with GMRES method using minimization techniques of communications for GPU clusters} \author{ -\textsc{Jacques M. Bahi} +\textsc{Lilia Ziane Khodja} \qquad \textsc{Rapha\"el Couturier}\thanks{Contact author} \qquad -\textsc{Lilia Ziane Khodja} +\textsc{Jacques M. Bahi} \mbox{}\\ % \\ FEMTO-ST Institute, University of Franche-Comte\\ IUT Belfort-Montb\'eliard\\ -Rue Engel Gros, BP 527, 90016 Belfort, \underline{France}\\ +19 Av. du Maréchal Juin, BP 527, 90016 Belfort, France\\ \mbox{}\\ % \normalsize -\{\texttt{jacques.bahi},~\texttt{raphael.couturier},~\texttt{lilia.ziane\_khoja}\}\texttt{@univ-fcomte.fr} +\{\texttt{lilia.ziane\_khoja},~\texttt{raphael.couturier},~\texttt{jacques.bahi}\}\texttt{@univ-fcomte.fr} } \begin{document} @@ -126,9 +126,8 @@ This method firstly uses the Reverse Cuthill-McKee reordering to reduce the tota volume. In addition, the performances of the parallel FEM algorithm are improved by overlapping the communication with computation. -%%% MODIF %%% -\textcolor{red}{ \bf Our main contribution in this work is to show the difficulties to implement the GMRES method for solving sparse linear systems on a cluster of GPUs. First, we show the main key points of the parallel GMRES algorithm on a GPU cluster. Then, we discuss the improvements of the algorithm which are mainly performed on the sparse matrix-vector multiplication when the matrix is distributed on several GPUs. In fact, on a cluster of GPUs the influence of the communications is greater than on clusters of CPUs due to the CPU/GPU communications between two GPUs that are not on the same machines. We propose to perform a hypergraph partitioning on the problem to be solved, then we reorder the matrix columns according to the partitioning scheme, and we use a compressed format for storing the vectors in order a way to minimize the communication overheads between two GPUs.} -%%% END %%% + Our main contribution in this work is to show the difficulties of implementing the GMRES method to solve sparse linear systems on a cluster of GPUs. First, we show the main key points of the parallel GMRES algorithm on a GPU cluster. Then, we discuss the improvements of the algorithm which are mainly performed on the sparse matrix-vector multiplication when the matrix is distributed on several GPUs. In fact, on a cluster of GPUs the influence of the communications is greater than on clusters of CPUs due to the CPU/GPU communications between two GPUs that are not on the same machines. We propose to perform a hypergraph partitioning on the problem to be solved, then we reorder the matrix columns according to the partitioning scheme, and we use a compressed format to store the vectors in order to minimize the communication overheads between two GPUs. + %%--------------------%% %% SECTION 3 %% @@ -179,7 +178,7 @@ the transfer of data between the GPU and its host. %%--------------------%% \section{{GMRES} method} \label{sec:04} -%%% MODIF %%% + The generalized minimal residual method (GMRES) is an iterative method designed by Saad and Schultz in 1986~\cite{Saa86}. It is a generalization of the minimal residual method (MNRES)~\cite{Pai75} to deal with asymmetric and non Hermitian problems and indefinite symmetric problems. Let us consider the following sparse linear system of $n$ equations: @@ -402,9 +401,7 @@ initialized to $1$. For simplicity sake, we chose the matrix preconditioning $M$ main diagonal of the sparse matrix $A$. Indeed, it allows us to easily compute the required inverse matrix $M^{-1}$ and it provides relatively good preconditioning in most cases. Finally, we set the size of a thread-block in GPUs to $512$ threads. -%%% MODIF %%% -\textcolor{red}{\bf It should be noted that the same optimizations are performed on the CPU version and on the GPU version of the parallel GMRES algorithm.} -%%% END %%% + It should be noted that the same optimizations are performed on the CPU version and on the GPU version of the parallel GMRES algorithm. \begin{table}[!h] \begin{center} @@ -571,13 +568,20 @@ and 9) and two elements from node 3 (elements 13 and 14). Therefore to reduce t of the unused vector elements, the GPU computing nodes must exchange between them only the vector elements necessary to perform their local sparse matrix-vector multiplications. -\begin{figure} +\begin{figure}[!h] \centering \includegraphics[width=120mm,keepaspectratio]{Figures/compress} \caption{Example of data exchanges between node 1 and its neighbors 0, 2 and 3.} \label{fig:05} \end{figure} +\begin{figure}[!h] +\centering + \includegraphics[width=100mm,keepaspectratio]{Figures/reorder} +\caption{Reordering of the columns of a local sparse matrix.} +\label{fig:06} +\end{figure} + We propose to use a compressed storage format of the sparse global vector. In Figure~\ref{fig:05}, we show an example of the data exchanges between node 1 and its neighbors to construct the compressed global vector. First, the neighboring nodes 0, 2 and 3 determine the vector elements needed by node 1 and, then, they send @@ -589,13 +593,6 @@ For performance purposes, the computation of the shared data to send to the neig by the GPU as a kernel. In addition, we use the MPI point-to-point communication routines: a blocking send routine \verb+MPI_Send()+ and a nonblocking receive routine \verb+MPI_Irecv()+. -\begin{figure} -\centering - \includegraphics[width=100mm,keepaspectratio]{Figures/reorder} -\caption{Reordering of the columns of a local sparse matrix.} -\label{fig:06} -\end{figure} - Table~\ref{tab:05} shows the performances of the parallel GMRES algorithm using the compressed storage format of the sparse global vector. The results are obtained from solving large linear systems associated to the sparse band matrices presented in Table~\ref{tab:03}. We can see from Table~\ref{tab:05} that the execution times @@ -630,7 +627,6 @@ a cluster of 12 GPUs.} \end{center} \end{table} - \subsection{Hypergraph partitioning} \label{sec:06.02} In this section, we use another structure of the sparse matrices. We are interested in sparse matrices @@ -642,14 +638,13 @@ off-diagonals on the left and right of the main diagonal. Table~\ref{tab:06} sho of sparse matrices of size 25 million of rows and generated from those of the Davis collection. We can see in the fourth column that the bandwidths of these matrices are as large as their sizes. -\begin{figure} +\begin{figure}[h!] \centering \includegraphics[width=100mm,keepaspectratio]{Figures/generation_1} \caption{Example of the generation of a large sparse matrix having five bands by four computing nodes.} \label{fig:07} \end{figure} - \begin{table}[!h] \begin{center} \begin{tabular}{|c|c|r|r|} @@ -807,19 +802,9 @@ having five bands on a cluster of 24 CPU cores vs. a cluster of 12 GPUs.} \end{center} \end{table} -Table~\ref{tab:09} shows in the second, third and fourth columns the total communication volume on a cluster of 12 GPUs by using row-by-row partitioning or hypergraph partitioning and compressed format. The total communication volume defines the total number of the vector elements exchanged between the 12 GPUs. From these columns we can see that the two heuristics, compressed format for the vectors and the hypergraph partitioning, minimize the number the vector elements to be exchanged over the GPU cluster. The compressed format applied +Table~\ref{tab:09} shows in the second, third and fourth columns the total communication volume on a cluster of 12 GPUs by using row-by-row partitioning or hypergraph partitioning and compressed format. The total communication volume defines the total number of the vector elements exchanged between the 12 GPUs. From these columns we can see that the two heuristics, compressed format for the vectors and the hypergraph partitioning, minimize the number of vector elements to be exchanged over the GPU cluster. The compressed format allows the GPUs to exchange the needed vector elements witout any communication overheads. The hypergraph partitioning allows to split the large sparse matrices so as to minimize data dependencies between the GPU computing nodes. However, we can notice in the fifth column that the hypergraph partitioning takes longer than the computation times. As we have mentioned before, the hypergraph partitioning method is less efficient in terms of memory consumption and partitioning time than its graph counterpart. So for the applications which often use the same sparse matrices, we can perform the hypergraph partitioning only once and, then, we save the traces in files to be reused several times. Therefore, this allows us to avoid the partitioning of the sparse matrices at each resolution of the linear systems. - - -This table shows that the hypergraph partitioning allows to split the large sparse matrices so as to minimize data -dependencies between the GPU computing nodes. However, we can notice in the fourth column that the hypergraph -partitioning takes longer than the computation times. As we have mentioned before, the hypergraph partitioning -method is less efficient in terms of memory consumption and partitioning time than its graph counterpart. -So for the applications which often use the same sparse matrices, we can perform the hypergraph partitioning -only once and, then, we save the traces in files to be reused several times. Therefore, this allows us to -avoid the partitioning of the sparse matrices at each resolution of the linear systems. - -\begin{table}[!h] +\begin{table} \begin{center} \begin{tabular}{|c|c|c|c|c|} \hline @@ -858,8 +843,7 @@ torso3 & 183 863 292 & 25 682 514 & 613 250 -%%% MODIF %%% -\textcolor{red}{\bf Hereafter, we show the influence of the communications on a GPU cluster compared to a CPU cluster. In Tables~\ref{tab:10},~\ref{tab:11} and~\ref{tab:12}, we compute the ratios between the computation time over the communication time of three versions of the parallel GMRES algorithm for solving sparse linear systems associated to matrices of Table~\ref{tab:06}. These tables show that the hypergraph partitioning and the compressed format of the vectors increase the ratios either on the GPU cluster or on the CPU cluster. That means that the two optimization techniques allow the minimization of the total communication volume between the computing nodes. However, we can notice that the ratios obtained on the GPU cluster are lower than those obtained on the CPU cluster. Indeed, GPUs compute faster than CPUs but with GPUs they are more communications due to CPU/GPU communications, so the communications are more time-consuming while the computation time remains unchanged.} +Hereafter, we show the influence of the communications on a GPU cluster compared to a CPU cluster. In Tables~\ref{tab:10},~\ref{tab:11} and~\ref{tab:12}, we compute the ratios between the computation time over the communication time of three versions of the parallel GMRES algorithm to solve sparse linear systems associated to matrices of Table~\ref{tab:06}. These tables show that the hypergraph partitioning and the compressed format of the vectors increase the ratios either on the GPU cluster or on the CPU cluster. That means that the two optimization techniques allow the minimization of the total communication volume between the computing nodes. However, we can notice that the ratios obtained on the GPU cluster are lower than those obtained on the CPU cluster. Indeed, GPUs compute faster than CPUs but with GPUs there are more communications due to CPU/GPU communications, so communications are more time-consuming while the computation time remains unchanged. \begin{table} \begin{center} @@ -942,14 +926,13 @@ torso3 & 57.469 s & 16.828 s & {\bf 3.415} & 926.588 s \label{fig:09} \end{figure} -\textcolor{red}{\bf Figure~\ref{fig:09} presents the weak scaling of four versions of the parallel GMRES algorithm on a GPU cluster. We fixed the size of a sub-matrix to 5 million of rows per GPU computing node. We used matrices having five bands generated from the symmetric matrix thermal2. This figure shows that the parallel GMRES algorithm in its naive version or using either the compression format for vectors or the hypergraph partitioning is not scalable on a GPU cluster due to the large amount of communications between GPUs. In contrast, we can see that the algorithm using both optimization techniques is fairly scalable. That means that in this version the cost of communications is relatively constant regardless the number of computing nodes in the cluster.} + Figure~\ref{fig:09} presents the weak scaling of four versions of the parallel GMRES algorithm on a GPU cluster. We fixed the size of a sub-matrix to 5 million of rows per GPU computing node. We used matrices having five bands generated from the symmetric matrix thermal2. This figure shows that the parallel GMRES algorithm, in its naive version or using either the compression format for vectors or the hypergraph partitioning, is not scalable on a GPU cluster due to the large amount of communications between GPUs. In contrast, we can see that the algorithm using both optimization techniques is fairly scalable. That means that in this version the cost of communications is relatively constant regardless the number of computing nodes in the cluster.\\ -\textcolor{red}{\bf Finally, from our point of view, the parallel solving of a linear system can be easy to optimize when the associated matrix is regular. This is unfortunately not the case for many real-world applications. When the matrix has an irregular structure, the amount of communication between processors is not the same. Another important parameter is the size of the matrix bandwidth which has a huge influence on the amount of communication. In this work, we have generated different kinds of matrices in order to analyze different difficulties. With a bandwidth as large as possible, involving communications between all processors, which is the most difficult situation, we proposed to use two heuristics. Unfortunately, there is no fast method that optimizes the communication in any situation. For systems of non linear equations, there are different algorithms but most of them consist in linearizing the system of equations. In this case, a linear system needs to be solved. The big interest is that the matrix is the same at each step of the non linear system solving, so the partitioning method which is a time consuming step is performed once only. -} + Finally, as far as we are concerned, the parallel solving of a linear system can be easy to optimize when the associated matrix is regular. This is unfortunately not the case for many real-world applications. When the matrix has an irregular structure, the amount of communication between processors is not the same. Another important parameter is the size of the matrix bandwidth which has a huge influence on the amount of communication. In this work, we have generated different kinds of matrices in order to analyze several difficulties. With a bandwidth as large as possible, involving communications between all processors, which is the most difficult situation, we proposed to use two heuristics. Unfortunately, there is no fast method that optimizes the communication in any situation. For systems of non linear equations, there are different algorithms but most of them consist in linearizing the system of equations. In this case, a linear system needs to be solved. The big interest is that the matrix is the same at each step of the non linear system solving, so the partitioning method which is a time consuming step is performed only once. -\textcolor{red}{\bf -Another very important issue is that the communications have a greater influence on a cluster of GPUs than on a cluster of CPUs. There are two reasons for that. The first one comes from the fact that with a cluster of GPUs, the CPU/GPU data transfers slow down communications between two GPUs that are not on the same machines. The second one is due to the fact that with GPUs the ratio of the computation time over the communication time decreases since the computation time is reduced. So the impact of the communications between GPUs might be a very important issue that can limit the scalability of a parallel algorithm.} -%%% END %%% + + +Another very important issue, which might be ignored by too many people, is that the communications have a greater influence on a cluster of GPUs than on a cluster of CPUs. There are two reasons for that. The first one comes from the fact that with a cluster of GPUs, the CPU/GPU data transfers slow down communications between two GPUs that are not on the same machines. The second one is due to the fact that with GPUs the ratio of the computation time over the communication time decreases since the computation time is reduced. So the impact of the communications between GPUs might be a very important issue that can limit the scalability of a parallel algorithm. %%--------------------%% %% SECTION 7 %%