X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/mpi-energy.git/blobdiff_plain/b039491f5ad738be1d313f6203bec5d1d39a84e8..d8a273b8e73d09a77669ac723652f4d51e856e0f:/paper.tex diff --git a/paper.tex b/paper.tex index e6d6745..efe0e3e 100644 --- a/paper.tex +++ b/paper.tex @@ -1,33 +1,32 @@ \documentclass[12pt]{article} %\documentclass[12pt,twocolumn]{article} -\DeclareMathSizes{40}{4000}{200}{2000} + \usepackage[T1]{fontenc} +\usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage{algorithm,algorithmicx,algpseudocode} \usepackage{graphicx,graphics} \usepackage{subfig} \usepackage{listings} \usepackage{colortbl} -\usepackage{sectsty} -\usepackage{titlesec} -\usepackage{secdot} +\usepackage{amsmath} +% \usepackage{sectsty} +% \usepackage{titlesec} +% \usepackage{secdot} %\usepackage[font={footnotesize,bt}]{caption} %\usepackage[font=scriptsize,labelfont=bf]{caption} +\usepackage{lmodern} + +\usepackage{todonotes} +\newcommand{\AG}[2][inline]{\todo[color=green!50,#1]{\sffamily\small\textbf{AG:} #2}} \begin{document} -\begin{center} - \Large - \title*\textbf{Optimal Dynamic Frequency Scaling for Energy-Performance of Parallel MPI Programs} -\end{center} -\parskip 0pt -\linespread{1.18} -\normalsize -\makeatletter -\renewcommand*{\@seccntformat}[1]{\csname the#1\endcsname\hspace{0.01cm}} -\makeatother -\sectionfont{\large} - -\section{.~Introduction } + +\title{Optimal Dynamic Frequency Scaling for Energy-Performance of Parallel MPI Programs} +\author{A. Badri \and J.-C. Charr \and R. Couturier \and A. Giersch} +\maketitle + +\section{Introduction} The need for computing power is still increasing and it is not expected to slow down in the coming years. To satisfy this demand, researchers and supercomputers @@ -69,15 +68,13 @@ using the simulator Simgrid/SMPI v3.10~\cite{45} over an homogeneous distributed memory architecture. Furthermore, we compare the proposed algorithm with Rauber's methods. The comparison's results show that our algorithm gives better energy-time trade off. -\sectionfont{\large} -\section{.~Related Works } +\section{Related Works} In the this section some heuristics, to compute the scaling factor, are presented and classified in two parts : offline and online methods. - \sectionfont{\large} -\subsection{~The offline DVFS orientations} +\subsection{The offline DVFS orientations} The DVFS offline methods are static and are not executed during the runtime of the program. Some approaches used heuristics to select the best DVFS state @@ -92,9 +89,8 @@ algorithm, while in~\cite{38,34}, Cochran et al. used multi logistic regression algorithm for the same goal. The offline study that shown the DVFS impact on the communication time of the MPI program is~\cite{17}, Freeh et al. show that these times not changed when the frequency is scaled down. -\sectionfont{\large} -\subsection{~The online DVFS orientations} +\subsection{The online DVFS orientations} The objective of these works is to dynamically compute and set the frequency of the CPU during the runtime of the program for saving energy. Estimating and @@ -128,9 +124,8 @@ paper. However, the primary contributions of this paper are: \item The proposed algorithm works online without profiling or training as in~\cite{38,34}. \end{enumerate} -\sectionfont{\large} -\section{.~Parallel Tasks Execution on Homogeneous Platform} +\section{Parallel Tasks Execution on Homogeneous Platform} A homogeneous cluster consists of identical nodes in terms of the hardware and the software. Each node has its own memory and at least one processor which can @@ -154,34 +149,37 @@ amounts of data on each processor as an example see figure~(\ref{fig:h2}). In this case the fastest tasks have to wait at the synchronous barrier for the slowest tasks to finish their job. In both two cases the overall execution time of the program is the execution time of the slowest task as : -\begin{equation} \label{eq:T1} - Program Time=MAX_{i=1,2,..,N} (T_i) \hfill +\begin{equation} + \label{eq:T1} + \textit{Program Time} = \max_{i=1,2,\dots,N} T_i \end{equation} where $T_i$ is the execution time of process $i$. -\sectionfont{\large} -\section{.~Energy Model for Homogeneous Platform} +\section{Energy Model for Homogeneous Platform} The energy consumption by the processor consists of two powers metric: the dynamic and the static power. This general power formulation is used by many researchers see ~\cite{9,3,15,26}. The dynamic power of the CMOS processors $P_{dyn}$ is related to the switching activity $\alpha$, load capacitance $C_L$, the supply voltage $V$ and operational frequency $f$ respectively as follow : -\begin{equation} \label{eq:pd} - \displaystyle P_{dyn} = \alpha . C_L . V^2 . f +\begin{equation} + \label{eq:pd} + P_{dyn} = \alpha \cdot C_L \cdot V^2 \cdot f \end{equation} The static power $P_{static}$ captures the leakage power consumption as well as the power consumption of peripheral devices like the I/O subsystem. -\begin{equation} \label{eq:ps} - \displaystyle P_{static} = V . N . K_{design} . I_{leak} +\begin{equation} + \label{eq:ps} + P_{static} = V \cdot N \cdot K_{design} \cdot I_{leak} \end{equation} where V is the supply voltage, N is the number of transistors, $K_{design}$ is a design dependent parameter and $I_{leak}$ is a technology-dependent parameter. Energy consumed by an individual processor $E_{ind}$ is the summation of the dynamic and the static power multiply by the execution time for example see~\cite{36,15} . -\begin{equation} \label{eq:eind} - \displaystyle E_{ind} = (P_{dyn} + P_{static} ) . T +\begin{equation} + \label{eq:eind} + E_{ind} = ( P_{dyn} + P_{static} ) \cdot T \end{equation} The dynamic voltage and frequency scaling (DVFS) is a process that allowed in modern processors to reduce the dynamic power by scaling down the voltage and @@ -192,11 +190,12 @@ 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 are expressed by scaling factor \emph S. The scale \emph S is the ratio between the maximum and the new frequency as in EQ~(\ref{eq:s}). -\begin{equation} \label{eq:s} - S=\:\frac{F_{max}}{F_{new}} \hfill \newline +\begin{equation} + \label{eq:s} + S = \frac{F_{max}}{F_{new}} \end{equation} The value of the scale \emph S is grater than 1 when changing the frequency to -any new frequency value(\emph {P-state}) in governor.~It is equal to 1 when the +any new frequency value(\emph {P-state}) in governor. It is equal to 1 when the frequency are set to the maximum frequency. The energy consumption model for parallel homogeneous platform is depending on the scaling factor \emph S. This factor reduces quadratically the dynamic power. Also, this factor increases the @@ -206,8 +205,11 @@ for any number of concurrent tasks develops by Rauber~\cite{3}. This model consider the two powers metric for measuring the energy of the parallel tasks as in EQ~(\ref{eq:energy}). -\begin{equation} \label{eq:energy} - E= \displaystyle \;P_{dyn}\,.\,S_1^{-2}\;.\,(T_1+\sum\limits_{i=2}^{N}\frac{T_i^3}{T_1^2})+\;P_{static}\,.\,T_1\,.\,S_1\;\,.\,N +\begin{equation} + \label{eq:energy} + E = P_{dyn} \cdot S_1^{-2} \cdot + \left( T_1 + \sum_{i=2}^{N} \frac{T_i^3}{T_1^2} \right) + + P_{static} \cdot T_1 \cdot S_1 \cdot N \hfill \end{equation} Where \emph N is the number of parallel nodes, $T_1 $ is the time of the slower @@ -215,11 +217,14 @@ task, $T_i$ is the time of the task $i$ and $S_1$ is the maximum scaling factor for the slower task. The scaling factor $S_1$, as in EQ~(\ref{eq:s1}), selects from the set of scales values $S_i$. Each of these scales are proportional to the time value $T_i$ depends on the new frequency value as in EQ~(\ref{eq:si}). -\begin{equation} \label{eq:s1} - S_1=MAX_{i=1,2,..,F} (S_i) \hfill +\begin{equation} + \label{eq:s1} + S_1 = \max_{i=1,2,\dots,F} S_i \end{equation} -\begin{equation} \label{eq:si} - S_i=\:S\: .\:(\frac{T_1}{T_i})=\: (\frac{F_{max}}{F_{new}}).(\frac{T_1}{T_i}) \hfill +\begin{equation} + \label{eq:si} + S_i = S \cdot \frac{T_1}{T_i} + = \frac{F_{max}}{F_{new}} \cdot \frac{T_1}{T_i} \end{equation} Where $F$ is the number of available frequencies. In this paper we depend on Rauber's energy model EQ~(\ref{eq:energy}) for two reasons : 1-this model used @@ -228,13 +233,13 @@ algorithm with Rauber's scaling model. Rauber's optimal scaling factor for optimal energy reduction derived from the EQ~(\ref{eq:energy}). He takes the derivation for this equation (to be minimized) and set it to zero to produce the scaling factor as in EQ~(\ref{eq:sopt}). -\begin{equation} \label{eq:sopt} - S_{opt}= {\sqrt [3~]{\frac{2}{n} \frac{P_{dyn}}{P_{static}} \Big(1+\sum\limits_{i=2}^{N}\frac{T_i^3}{T_1^3}\Big) }} \hfill +\begin{equation} + \label{eq:sopt} + S_{opt} = \sqrt[3]{\frac{2}{n} \cdot \frac{P_{dyn}}{P_{static}} \cdot + \left( 1 + \sum_{i=2}^{N} \frac{T_i^3}{T_1^3} \right) } \end{equation} -%[\Big 3] -\sectionfont{\large} -\section{.~Performance Evaluation of MPI Programs} +\section{Performance Evaluation of MPI Programs} The performance (execution time) of the parallel MPI applications are depends on the time of the slowest task as in figure~(\ref{fig:homo}). Normally the @@ -260,9 +265,9 @@ must be precisely specifying communication time and the computation time for the slower task. Secondly, we use these times for predicting the execution time for any MPI program as a function of the new scaling factor as in the EQ~(\ref{eq:tnew}). -\begin{equation} \label{eq:tnew} - \displaystyle T_{new}= T_{Max \:Comp \:Old} \; . \:S \;+ \;T_{Max\: Comm\: Old} - \hfill +\begin{equation} + \label{eq:tnew} + T_{new} = T_{\textit{Max Comp Old}} \cdot S + T_{\textit{Max Comm Old}} \end{equation} The above equation shows that the scaling factor \emph S has linear relation with the computation time without affecting the communication time. The @@ -272,9 +277,8 @@ paper we predict the execution time of the program for any new scaling factor value. Depending on this prediction we can produce our energy-performace scaling method as we will show in the coming sections. In the next section we make an investigation study for the EQ~(\ref{eq:tnew}). -\sectionfont{\large} -\section{.~Performance Prediction Verification } +\section{Performance Prediction Verification} In this section we evaluate the precision of our performance prediction methods on the NAS benchmark. We use the EQ~(\ref{eq:tnew}) that predicts the execution @@ -303,9 +307,8 @@ and SP. The average normalized errors between the predicted execution time and the real time (Simgrid time) for all programs is between 0.0032 to 0.0133. AS an example, we are present the execution times of the NAS benchmarks as in the figure~(\ref{fig:pred}). -\sectionfont{\large} -\section{.~Performance to Energy Competition} +\section{Performance to Energy Competition} This section demonstrates our approach for choosing the optimal scaling factor. This factor gives maximum energy reduction taking into account the execution time for both computation and communication times . The relation @@ -316,12 +319,21 @@ is not straightforward. Moreover, they are not measured using the same metric. For solving this problem, we normalize the energy by calculating the ratio between the consumed energy with scaled frequency and the consumed energy without scaled frequency : -\begin{equation} \label{eq:enorm} - E_{Norm}=\displaystyle\frac{E_{Reduced}}{E_{Orginal}}= \frac{\displaystyle \;P_{dyn}\,.\,S_i^{-2}\,.\,(T_1+\sum\limits_{i=2}^{N}\frac{T_i^3}{T_1^2})+\;P_{static}\,.\,T_1\,.\,S_i\;\,.\,N }{\displaystyle \;P_{dyn}\,.\,(T_1+\sum\limits_{i=2}^{N}\frac{T_i^3}{T_1^2})+\;P_{static}\,.\,T_1\,\,.\,N } +\begin{equation} + \label{eq:enorm} + E_{Norm} = \frac{E_{Reduced}}{E_{Orginal}} + = \frac{ P_{dyn} \cdot S_i^{-2} \cdot + \left( T_1 + \sum_{i=2}^{N}\frac{T_i^3}{T_1^2}\right) + + P_{static} \cdot T_1 \cdot S_i \cdot N }{ + P_{dyn} \cdot \left(T_1+\sum_{i=2}^{N}\frac{T_i^3}{T_1^2}\right) + + P_{static} \cdot T_1\, \cdot N } \end{equation} By the same way we can normalize the performance as follows : -\begin{equation} \label{eq:pnorm} - P_{Norm}=\displaystyle \frac{T_{New}}{T_{Old}}=\frac{T_{Max \:Comp \:Old} \;. \:S \;+ \;T_{Max\: Comm\: Old}}{T_{Old}} \;\; +\begin{equation} + \label{eq:pnorm} + P_{Norm} = \frac{T_{New}}{T_{Old}} + = \frac{T_{\textit{Max Comp Old}} \cdot S + + T_{\textit{Max Comm Old}}}{T_{Old}} \end{equation} The second problem is the optimization operation for both energy and performance is not in the same direction. In other words, the normalized energy and the @@ -338,8 +350,11 @@ optimize 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 performance as follows : -\begin{equation} \label{eq:pnorm_en} - \displaystyle P^{-1}_{Norm}= \frac{T_{Old}}{T_{New}}=\frac{T_{Old}}{T_{Max \:Comp \:Old} \;. \:S \;+ \;T_{Max\: Comm\: Old}} +\begin{equation} + \label{eq:pnorm_en} + P^{-1}_{Norm} = \frac{T_{Old}}{T_{New}} + = \frac{T_{Old}}{T_{\textit{Max Comp Old}} \cdot S + + T_{\textit{Max Comm Old}}} \end{equation} \begin{figure} \centering @@ -354,8 +369,10 @@ curve EQ~(\ref{eq:pnorm_en}) over all available scaling factors. This represent the minimum energy consumption with minimum execution time (better performance) in the same time, see figure~(\ref{fig:r1}). Then our objective function has the following form: -\begin{equation} \label{eq:max} - \displaystyle MaxDist = Max \;(\;\overbrace{P^{-1}_{Norm}}^{Maximize}\; -\; \overbrace{E_{Norm}}^{Minimize} \;) +\begin{equation} + \label{eq:max} + \textit{MaxDist} = \max (\overbrace{P^{-1}_{Norm}}^{\text{Maximize}} - + \overbrace{E_{Norm}}^{\text{Minimize}} ) \end{equation} Then we can select the optimal scaling factor that satisfy the EQ~(\ref{eq:max}). Our objective function can works with any energy model or @@ -364,17 +381,15 @@ optimal way when the energy function has a convex form with frequency scaling factor as shown in ~\cite{15,3,19}. Energy measurement model is not the objective of this paper and we choose Rauber's model as an example with two reasons that mentioned before. -\sectionfont{\large} -\section{.~Optimal Scaling Factor for Performance and Energy } +\section{Optimal Scaling Factor for Performance and Energy} In the previous section we described the objective function that satisfy our goal in discovering optimal scaling factor for both performance and energy at the same time. Therefore, we develop an energy to performance scaling algorithm (EPSA). This algorithm is simple and has a direct way to calculate the optimal -scaling factor for both energy and performance at the same time. \clearpage -\linespread{1} -\begin{algorithm}[width=\textwidth,height=\textheight,keepaspectratio] +scaling factor for both energy and performance at the same time. +\begin{algorithm}[t] \caption{EPSA} \label{EPSA} \begin{algorithmic}[1] @@ -389,29 +404,29 @@ scaling factor for both energy and performance at the same time. \clearpage \State - Calculate all available scales $S_i$ depend on $S$ as in EQ~(\ref{eq:si}). \State - Select the maximum scale factor $S_1$ from the set of scales $S_i$. \State - Calculate the normalize energy $E_{Norm}=E_{R}/E_{O}$ as in EQ~(\ref{eq:enorm}). - \State - Calculate the normalize inverse of performance $P_{NormInv}=T_{old}/T_{new}$ - - as in EQ~(\ref{eq:pnorm_en}). - \If{ $(P_{NormInv}-E_{Norm}$ $>$ $Dist$) } - \State $S_{optimal}=S$ + \State - Calculate the normalize inverse of performance\par + $P_{NormInv}=T_{old}/T_{new}$ as in EQ~(\ref{eq:pnorm_en}). + \If{ $(P_{NormInv}-E_{Norm} > Dist$) } + \State $S_{optimal} = S$ \State $Dist = P_{NormInv} - E_{Norm}$ \EndIf \EndFor \State $ Return \; \; (S_{optimal})$ \end{algorithmic} \end{algorithm} -\linespread{1.2} The proposed EPSA algorithm works online during the execution -time of the MPI program. It selects the optimal scaling factor by gathering some -information from the program after one iteration. This algorithm has small -execution time (between 0.00152 $ms$ for 4 nodes to 0.00665 $ms$ for 32 -nodes). The data required by this algorithm is the computation time and the -communication time for each task from the first iteration only. When these times -are measured, the MPI program calls the EPSA algorithm to choose the new -frequency using the optimal scaling factor. Then the program set the new -frequency to the system. The algorithm is called just one time during the -execution of the program. The following example shows where and when the EPSA -algorithm is called in the MPI program : \clearpage -\begin{lstlisting} +The proposed EPSA algorithm works online during the execution time of the MPI +program. It selects the optimal scaling factor by gathering some information +from the program after one iteration. This algorithm has small execution time +(between 0.00152 $ms$ for 4 nodes to 0.00665 $ms$ for 32 nodes). The data +required by this algorithm is the computation time and the communication time +for each task from the first iteration only. When these times are measured, the +MPI program calls the EPSA algorithm to choose the new frequency using the +optimal scaling factor. Then the program set the new frequency to the +system. The algorithm is called just one time during the execution of the +program. The following example shows where and when the EPSA algorithm is called +in the MPI program : +\begin{minipage}{\textwidth} +\begin{lstlisting}[frame=tb] FOR J:=1 to Some_iterations Do -Computations Section. -Communications Section. @@ -424,20 +439,21 @@ FOR J:=1 to Some_iterations Do ENDIF ENDFOR \end{lstlisting} +\end{minipage} After obtaining the optimal scale factor from the EPSA algorithm. The program calculates the new frequency $F_i$ for each task proportionally to its time value $T_i$. By substitution of the EQ~(\ref{eq:s}) in the EQ~(\ref{eq:si}), we can calculate the new frequency $F_i$ as follows : -\begin{equation} \label{eq:fi} - F_i=\frac{F_{max} \; . \;T_i}{S_{optimal} \; . \;T_{max}} \hfill +\begin{equation} + \label{eq:fi} + F_i = \frac{F_{max} \cdot T_i}{S_{optimal} \cdot T_{max}} \end{equation} According to this equation all the nodes may have the same frequency value if they have balanced workloads. Otherwise, they take different frequencies when have imbalanced workloads. Then EQ~(\ref{eq:fi}) works in adaptive way to change the freguency according to the nodes workloads. -\sectionfont{\large} -\section{.~Experimental Results} +\section{Experimental Results} The proposed ESPA algorithm was applied to seven MPI programs of the NAS benchmarks (EP ,CG , MG ,FT , BT, LU and SP). We work on three classes (A, B and @@ -495,7 +511,6 @@ same time over all available scales. \caption{Optimal scaling factors for The NAS MPI Programs} \label{fig:nas} \end{figure} -\linespread{1.1} \begin{table}[width=\textwidth,height=\textheight,keepaspectratio] \caption{Optimal Scaling Factors Results} % title of Table @@ -515,7 +530,6 @@ same time over all available scales. \label{table:factors results} % is used to refer this table in the text \end{table} -\linespread{1.2} As shown in the table~(\ref{table:factors results}), when the optimal scaling factor has big value we can gain more energy savings for example as in CG and @@ -525,10 +539,7 @@ communication and the other slacks times are big and smaller ones in opposite cases. In EP there are no communications inside the iterations. This make our EPSA to selects smaller scaling factor values (inducing smaller energy savings). -% \clearpage -\sectionfont{\large} - -\section{.~Comparing Results} +\section{Comparing Results} In this section, we compare our EPSA algorithm results with Rauber's methods~\cite{3}. He had two scenarios, the first is to reduce energy to optimal @@ -540,7 +551,6 @@ scenario as $Rauber_{E-P}$. The comparison is made in tables~(\ref{table:compare Class A},\ref{table:compare Class B},\ref{table:compare Class C}). These tables show the results of our EPSA and Rauber's two scenarios for all the NAS benchmarks programs for classes A,B and C. -%\linespread{1} \begin{table}[ht] \caption{Comparing Results for The NAS Class A} % title of Table @@ -665,17 +675,16 @@ benchmarks programs for classes A,B and C. \label{table:compare Class C} % is used to refer this table in the text \end{table} -%\linespread{1.2} -\clearpage As shown in these tables our scaling factor is not optimal for energy -saving such as Rauber's scaling factor EQ~(\ref{eq:sopt}), but it is optimal for -both the energy and the performance simultaneously. Our EPSA optimal scaling -factors has better simultaneous optimization for both the energy and the -performance compared to Rauber's energy-performance method -($Rauber_{E-P}$). Also, in ($Rauber_{E-P}$) method when setting the frequency to -maximum value for the slower task lead to a small improvement of the -performance. Also the results show that this method keep or improve energy -saving. Because of the energy consumption decrease when the execution time -decreased while the frequency value increased. +As shown in these tables our scaling factor is not optimal for energy saving +such as Rauber's scaling factor EQ~(\ref{eq:sopt}), but it is optimal for both +the energy and the performance simultaneously. Our EPSA optimal scaling factors +has better simultaneous optimization for both the energy and the performance +compared to Rauber's energy-performance method ($Rauber_{E-P}$). Also, in +($Rauber_{E-P}$) method when setting the frequency to maximum value for the +slower task lead to a small improvement of the performance. Also the results +show that this method keep or improve energy saving. Because of the energy +consumption decrease when the execution time decreased while the frequency value +increased. Figure~(\ref{fig:compare}) shows the maximum distance between the energy saving percent and the performance degradation percent. Therefore, this means it is the @@ -697,7 +706,6 @@ than the first. \label{fig:compare} \end{figure} -\clearpage \bibliographystyle{plain} \bibliography{my_reference} \end{document}