X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/mpi-energy.git/blobdiff_plain/2a89f90737f792d555cc0f55afa68d1a7b937251..a90f74304eb6df459ee5e1f2b206d3b7aeedcfc6:/paper.tex diff --git a/paper.tex b/paper.tex index ffed39e..1a377e2 100644 --- a/paper.tex +++ b/paper.tex @@ -14,7 +14,9 @@ \DeclareUrlCommand\email{\urlstyle{same}} \usepackage[autolanguage,np]{numprint} -\renewcommand*\npunitcommand[1]{\text{#1}} +\AtBeginDocument{% + \renewcommand*\npunitcommand[1]{\text{#1}} + \npthousandthpartsep{}} \usepackage{xspace} \usepackage[textsize=footnotesize]{todonotes} @@ -47,7 +49,7 @@ \begin{abstract} Dynamic Voltage Frequency Scaling (DVFS) can be applied to modern CPUs. This technique is usually used to reduce the energy consumed by a CPU while -computing . Indeed, power consumption by a processor at a given instant is +computing. Indeed, power consumption by a processor at a given instant is exponentially related to its frequency. Thus, decreasing the frequency reduces the power consumed by the CPU. However, it can also significantly affect the performance of the executed program if it is compute bound and if a low CPU @@ -72,8 +74,8 @@ down in the coming years. To satisfy this demand, researchers and supercomputers constructors have been regularly increasing the number of computing cores and processors in supercomputers (for example in November 2013, according to the TOP500 list~\cite{43}, the Tianhe-2 was the fastest supercomputer. It has more than 3 -millions of cores and delivers more than 33 Tflop/s while consuming 17808 -kW). This large increase in number of computing cores has led to large energy +millions of cores and delivers more than \np[Tflop/s]{33} while consuming +\np[kW]{17808}). This large increase in number of computing cores has led to large energy consumption by these architectures. Moreover, the price of energy is expected to continue its ascent according to the demand. For all these reasons energy reduction became an important topic in the high performance computing field. To @@ -112,7 +114,7 @@ This paper is organized as follows: Section~\ref{sec.relwork} presents some rela from other authors. Section~\ref{sec.exe} explains the execution of parallel tasks and the sources of slack times. It also presents an energy model for homogeneous platforms. Section~\ref{sec.mpip} describes how the performance -of MPI programs can be predicted . Section~\ref{sec.compet} presents the energy-performance +of MPI programs can be predicted. Section~\ref{sec.compet} presents the energy-performance objective function that maximizes the reduction of energy consumption while minimizing the degradation of the program's performance. Section~\ref{sec.optim} details the proposed energy-performance algorithm. Section~\ref{sec.expe} verifies the accuracy of the performance prediction model and presents the results of the proposed algorithm. It also shows the comparison results between our method and other existing methods. Finally, we conclude in Section~\ref{sec.concl} with a summary and some future works. @@ -130,7 +132,7 @@ the program. They return static scaling factor values to the processors participating in the execution of the parallel program. On one hand, the scaling factor values could be computed based on information retrieved by analyzing the code of -the program and the computing system that will execute it. In ~\cite{40}, +the program and the computing system that will execute it. In~\cite{40}, Azevedo et al. detect during compilation the dependency points between tasks in a multi-task program. This information is then used to lower the frequency of @@ -138,7 +140,7 @@ some processors in order to eliminate slack times. A slack time is the period of for a set of processors to finish their computations and send their results to the waiting processor in order to continue its task that is dependent on the results of computations being executed on other processors. -Freeh et al. showed in ~\cite{17} that the +Freeh et al. showed in~\cite{17} that the communication times of MPI programs do not change when the frequency is scaled down. On the other hand, some offline scaling factor selection methods use the information gathered from previous full or @@ -148,13 +150,13 @@ algorithm, while in~\cite{38,34}, Cochran et al. use multi logistic regression a The main drawback for these methods is that they all require executing a part or the whole program on all frequency gears for each new instance of the same program. \subsection{Online scaling factor selection methods} -The online scaling factor selection methods are executed during the runtime of the program. They are usually integrated into iterative programs where the same block of instructions is executed many times. During the first few iterations, many informations are measured such as the execution time, the energy consumed using a multimeter, the slack times, ... Then a method will exploit these measurements to compute the scaling factor values for each processor. This operation, measurements and computing new scaling factor, can be repeated as much as needed if the iterations are not regular. Kimura, Peraza, Yu-Liang et al. ~\cite{11,2,31} used learning methods to select the appropriate scaling factor values to eliminate the slack times during runtime. However, as seen in ~\cite{39,19}, machine learning methods can take a lot of time to converge when the number of available gears is big. To reduce the impact of slack times, in~\cite{1}, Lim et al. developed an algorithm that detects the +The online scaling factor selection methods are executed during the runtime of the program. They are usually integrated into iterative programs where the same block of instructions is executed many times. During the first few iterations, many informations are measured such as the execution time, the energy consumed using a multimeter, the slack times, \dots{} Then a method will exploit these measurements to compute the scaling factor values for each processor. This operation, measurements and computing new scaling factor, can be repeated as much as needed if the iterations are not regular. Kimura, Peraza, Yu-Liang et al.~\cite{11,2,31} used learning methods to select the appropriate scaling factor values to eliminate the slack times during runtime. However, as seen in~\cite{39,19}, machine learning methods can take a lot of time to converge when the number of available gears is big. To reduce the impact of slack times, in~\cite{1}, Lim et al. developed an algorithm that detects the communication sections and changes the frequency during these sections only. This approach might change the frequency of each processor many times per iteration if an iteration -contains more than one communication section. In ~\cite{3}, Rauber and Rünger used an analytical model that can predict the consumed energy and the execution time for every frequency gear after measuring the consumed energy and the execution time with the highest frequency gear. These predictions may be used to choose the optimal gear for each processor executing the parallel program to reduce energy consumption. +contains more than one communication section. In~\cite{3}, Rauber and Rünger used an analytical model that can predict the consumed energy and the execution time for every frequency gear after measuring the consumed energy and the execution time with the highest frequency gear. These predictions may be used to choose the optimal gear for each processor executing the parallel program to reduce energy consumption. To maintain the performance of the parallel program , they set the processor with the biggest load to the highest gear and then compute the scaling factor values for the rest of the processors. Although this model was built for parallel architectures, it can be adapted to distributed architectures by taking into account the communications. -The primary contribution of our paper is presenting a new online scaling factor selection method which has the following characteristics : +The primary contribution of our paper is presenting a new online scaling factor selection method which has the following characteristics: \begin{enumerate} \item It is based on Rauber and Rünger analytical model to predict the energy consumption of the application with different frequency gears. \item It selects the frequency scaling factor for simultaneously optimizing energy reduction and maintaining performance. @@ -221,27 +223,27 @@ parameter. The energy consumed by an individual processor to execute a given pro \label{eq:eind} E_\textit{ind} = P_\textit{dyn} \cdot T_{Comp} + P_\textit{static} \cdot T \end{equation} -where $T$ is the execution time of the program, $T_{Comp}$ is the computation time and $T_{Comp} \le T$. $T_{Comp}$ may be equal to $T$ if there is no communications, no slack times and no synchronizations. +where $T$ is the execution time of the program, $T_{Comp}$ is the computation time and $T_{Comp} \leq T$. $T_{Comp}$ may be equal to $T$ if there is no communications, no slack times and no synchronizations. DVFS is a process that is allowed in modern processors to reduce the dynamic power by scaling down the voltage and frequency. Its main objective is to reduce the overall energy -consumption~\cite{37}. The operational frequency \emph f depends linearly on the +consumption~\cite{37}. The operational frequency $f$ depends linearly on the supply voltage $V$, i.e., $V = \beta \cdot f$ with some constant $\beta$. This equation is used to study the change of the dynamic voltage with respect to various frequency values in~\cite{3}. The reduction process of the frequency can be -expressed by the scaling factor \emph S which is the ratio between the +expressed by the scaling factor $S$ which is the ratio between the maximum and the new frequency as in EQ~(\ref{eq:s}). \begin{equation} \label{eq:s} S = \frac{F_\textit{max}}{F_\textit{new}} \end{equation} The value of the scaling factor $S$ is greater than 1 when changing the frequency of the CPU to any -new frequency value~(\emph {P-state}) in the governor. The CPU governor is an +new frequency value~(\emph{P-state}) in the governor. The CPU governor is an interface driver supplied by the operating system's kernel to lower a core's frequency. This factor reduces quadratically the dynamic power which may cause degradation in performance and thus, the increase of the static energy because the execution time is increased~\cite{36}. If the tasks are sorted according to their execution times before scaling in a descending order, the total energy consumption model for a parallel -homogeneous platform, as presented by Rauber and Rünger~\cite{3}, can be written as a function of the scaling factor \emph S, as in EQ~(\ref{eq:energy}). +homogeneous platform, as presented by Rauber and Rünger~\cite{3}, can be written as a function of the scaling factor $S$, as in EQ~(\ref{eq:energy}). \begin{equation} \label{eq:energy} @@ -250,7 +252,7 @@ homogeneous platform, as presented by Rauber and Rünger~\cite{3}, can be writt P_\textit{static} \cdot T_1 \cdot S_1 \cdot N \hfill \end{equation} -where \emph N is the number of parallel nodes, $T_i \ and \ S_i \ for \ i=1,...,N$ are the execution times and scaling factors of the sorted tasks. Therefore, $T1$ is the time of the slowest task, and $S_1$ its scaling factor which should be the highest because they are proportional to +where $N$ is the number of parallel nodes, $T_i$ and $S_i$ for $i=1,\dots,N$ are the execution times and scaling factors of the sorted tasks. Therefore, $T1$ is the time of the slowest task, and $S_1$ its scaling factor which should be the highest because they are proportional to the time values $T_i$. The scaling factors are computed as in EQ~(\ref{eq:si}). \begin{equation} \label{eq:si} @@ -325,12 +327,12 @@ is not in the same direction. In other words, the normalized energy and the performance curves are not in the same direction see figure~(\ref{fig:r2}). While the main goal is to optimize the energy and performance in the same time. According to the equations~(\ref{eq:enorm}) and~(\ref{eq:pnorm}), the -scaling factor \emph S reduce both the energy and the performance +scaling factor $S$ reduce both the energy and the performance simultaneously. But the main objective is to produce maximum energy reduction with minimum performance reduction. Many researchers used different strategies to solve this nonlinear problem for example see~\cite{19,42}, their methods add big overhead to the algorithm for selecting the suitable frequency. In this -paper we present a method to find the optimal scaling factor \emph S for +paper we present a method to find the optimal scaling factor $S$ for optimizing both energy and performance simultaneously without adding big overheads. Our solution for this problem is to make the optimization process have the same direction. Therefore, we inverse the equation of normalize @@ -363,7 +365,7 @@ following form: Max Dist = \max_{j=1,2,\dots,F} (\overbrace{P^{-1}_\textit{Norm}(S_j)}^{\text{Maximize}} - \overbrace{E_\textit{Norm}(S_j)}^{\text{Minimize}} ) \end{equation} -where F is the number of available frequencies. Then we can select the optimal scaling factor that satisfies +where $F$ is the number of available frequencies. Then we can select the optimal scaling factor that satisfies EQ~(\ref{eq:max}). Our objective function can work with any energy model or static power values stored in a data file. Moreover, this function works in optimal way when the energy curve has a convex form over the available frequency scaling @@ -382,17 +384,16 @@ factors as shown in~\cite{15,3,19}. \State Set the variable $F_{new}$ to max. frequency, $F_{new} = F_{max} $ \State Set the variable $F_{diff}$ to the difference between two successive frequencies. \For {$j:=1$ to $P_{states} $} - \State - $F_{new}=F_{new} - F_{diff} $ - \State - $S = \frac{F_\textit{max}}{F_\textit{new}}$ - \State - $S_i = S \cdot \frac{T_1}{T_i}= \frac{F_\textit{max}}{F_\textit{new}} \cdot \frac{T_1}{T_i} \ - for \ i=1,...,N$ - \State - $E_\textit{Norm} = \frac{P_\textit{dyn} \cdot S_1^{-2} \cdot + \State $F_{new}=F_{new} - F_{diff} $ + \State $S = \frac{F_\textit{max}}{F_\textit{new}}$ + \State $S_i = S \cdot \frac{T_1}{T_i}= \frac{F_\textit{max}}{F_\textit{new}} \cdot \frac{T_1}{T_i}$ for $i=1,\dots,N$ + \State $E_\textit{Norm} = \frac{P_\textit{dyn} \cdot S_1^{-2} \cdot \left( T_1 + \sum_{i=2}^{N}\frac{T_i^3}{T_1^2}\right) + P_\textit{static} \cdot T_1 \cdot S_1 \cdot N }{ P_\textit{dyn} \cdot \left(T_1+\sum_{i=2}^{N}\frac{T_i^3}{T_1^2}\right) + P_\textit{static} \cdot T_1 \cdot N }$ - \State - $P_{NormInv}=T_{old}/T_{new}$ - \If{ $(P_{NormInv}-E_{Norm} > Dist$) } + \State $P_{NormInv}=T_{old}/T_{new}$ + \If{$(P_{NormInv}-E_{Norm} > Dist)$} \State $S_{opt} = S$ \State $Dist = P_{NormInv} - E_{Norm}$ \EndIf @@ -403,8 +404,8 @@ factors as shown in~\cite{15,3,19}. The proposed algorithm works online during the execution time of the MPI program. It selects the optimal scaling factor after gathering the computation and communication times -from the program after one iteration. Then the program changes the new frequencies of the CPUs according to the computed scaling factors. This algorithm has a small execution time: for a homogeneous cluster composed of nodes having the characteristics presented in table~\ref{table:platform}, it takes 0.00152 $ms$ on average for 4 nodes and 0.00665 $ms$ on average for 32 nodes. The algorithm complexity is O(F$\cdot$N), -where F is the number of available frequencies and N is the number of computing nodes. The algorithm is called just +from the program after one iteration. Then the program changes the new frequencies of the CPUs according to the computed scaling factors. This algorithm has a small execution time: for a homogeneous cluster composed of nodes having the characteristics presented in table~\ref{table:platform}, it takes \np[ms]{0.00152} on average for 4 nodes and \np[ms]{0.00665} on average for 32 nodes. The algorithm complexity is $O(F\cdot N)$, +where $F$ is the number of available frequencies and $N$ is the number of computing nodes. The algorithm is called just once during the execution of the program. The DVFS algorithm~(\ref{dvfs}) shows where and when the algorithm is called in the MPI program. \begin{table}[htb] @@ -427,14 +428,16 @@ in the MPI program. \caption{DVFS} \label{dvfs} \begin{algorithmic}[1] - \For {$k:=1$ to $Some-Iterations \; $} - \State -Computations section. - \State -Communications section. + \For {$k:=1$ to \textit{some iterations}} + \State Computations section. + \State Communications section. \If {$(k=1)$} - \State -Gather all times of computation and\par\hspace{13 pt} communication from each node. - \State -Call algorithm~\ref{EPSA} with these times. - \State -Compute the new frequency from the \par\hspace{13 pt} returned optimal scaling factor. - \State -Set the new frequency to the CPU. + \State Gather all times of computation and\newline\hspace*{3em}% + communication from each node. + \State Call algorithm~\ref{EPSA} with these times. + \State Compute the new frequency from the\newline\hspace*{3em}% + returned optimal scaling factor. + \State Set the new frequency to the CPU. \EndIf \EndFor \end{algorithmic} @@ -459,8 +462,8 @@ node. The detailed characteristics of our platform file are shown in the table~(\ref{table:platform}). Each node in the cluster has 18 frequency values -from 2.5 GHz to 800 MHz with 100 MHz difference between each two successive -frequencies. The simulated network link is 1 GB Ethernet (TCP/IP). +from \np[GHz]{2.5} to \np[MHz]{800} with \np[MHz]{100} difference between each two successive +frequencies. The simulated network link is \np[GB]{1} Ethernet (TCP/IP). The backbone of the cluster simulates a high performance switch. \subsection{Performance prediction verification} @@ -483,7 +486,7 @@ frequency by the new one see EQ~(\ref{eq:s}). In our cluster there are 18 available frequency states for each processor. This leads to 18 run states for each program. We use seven MPI programs of the NAS parallel benchmarks: CG, MG, EP, FT, BT, LU -and SP. Figure~(\ref{fig:pred}) presents plots of the real execution times and the simulated ones. The maximum normalized error between these two execution times varies between 0.0073 to 0.031 dependent on the executed benchmark. The smallest prediction error was for CG and the worst one was for LU. +and SP. Figure~(\ref{fig:pred}) presents plots of the real execution times and the simulated ones. The maximum normalized error between these two execution times varies between \np{0.0073}\AG[]{unit?} to \np{0.031} dependent on the executed benchmark. The smallest prediction error was for CG and the worst one was for LU. \subsection{The experimental results for the scaling algorithm } The proposed algorithm was applied to seven MPI programs of the NAS benchmarks (EP, CG, MG, FT, BT, LU and SP) which were run with three classes (A, B and @@ -686,7 +689,7 @@ NAS benchmarks programs for classes A, B and C. \label{table:compareC} % is used to refer this table in the text \end{table} -As shown in tables~\ref{table:compareA},~\ref{table:compareB} and~\ref{table:compareC}, the ($R_{E-P}$) method outperforms the ($R_{E}$) method in terms of performance and energy reduction. The ($R_{E-P}$) method also gives better energy savings than our method. However, although our scaling factor is not optimal for energy reduction, the results in these tables prove that our algorithm returns the best scaling factor that satisfy our objective method : the largest distance between energy reduction and performance degradation. Negative values in the energy-performance column mean that one of the two objectives (energy or performance) have been degraded more than the other. The positive trade-offs with the highest values lead to maximum energy savings +As shown in tables~\ref{table:compareA},~\ref{table:compareB} and~\ref{table:compareC}, the ($R_{E-P}$) method outperforms the ($R_{E}$) method in terms of performance and energy reduction. The ($R_{E-P}$) method also gives better energy savings than our method. However, although our scaling factor is not optimal for energy reduction, the results in these tables prove that our algorithm returns the best scaling factor that satisfy our objective method: the largest distance between energy reduction and performance degradation. Negative values in the energy-performance column mean that one of the two objectives (energy or performance) have been degraded more than the other. The positive trade-offs with the highest values lead to maximum energy savings while keeping the performance degradation as low as possible. Our algorithm always gives the highest positive energy to performance trade-offs while Rauber and Rünger method ($R_{E-P}$) gives in some time negative trade-offs such as in BT and @@ -707,8 +710,8 @@ In the near future, we would like to adapt this scaling factor selection method \section*{Acknowledgment} -This work has been supported by the Labex ACTION project (contract ``ANR-11-LABX-01-01'').Computations have been performed on the supercomputer facilities of the -Mésocentre de calcul de Franche-Comté. As a PhD student, M. Ahmed Fanfakh, would like to thank the University of +This work has been supported by the Labex ACTION project (contract ``ANR-11-LABX-01-01''). Computations have been performed on the supercomputer facilities of the +Mésocentre de calcul de Franche-Comté. As a PhD student, Mr. Ahmed Fanfakh, would like to thank the University of Babylon (Iraq) for supporting his work. % trigger a \newpage just before the given reference