-\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{%
+ \IEEEauthorblockN{%
+ Jean-Claude Charr,
+ Raphaël Couturier,
+ Ahmed Fanfakh and
+ Arnaud Giersch
+ }
+ \IEEEauthorblockA{%
+ FEMTO-ST Institute\\
+ University of Franche-Comté
+ }
+}
+
+\maketitle
+
+\AG{``Optimal'' is a bit pretentious in the title.\\
+ Complete affiliation, add an email address, etc.}
+
+\begin{abstract}
+ The important technique for energy reduction of parallel systems is CPU
+ frequency scaling. This operation is used by many researchers to reduce energy
+ consumption in many ways. Frequency scaling operation also has a big impact on
+ the performances. In some cases, the performance degradation ratio is bigger
+ than energy saving ratio when the frequency is scaled to low level. Therefore,
+ the trade offs between the energy and performance becomes more important topic
+ when using this technique. In this paper we developed an algorithm that select
+ the frequency scaling factor for both energy and performance simultaneously.
+ This algorithm takes into account the communication times when selecting the
+ frequency scaling factor. It works online without training or profiling to
+ have a very small overhead. The algorithm has better energy-performance trade
+ offs compared to other methods.
+\end{abstract}
+
+\section{Introduction}
+\label{sec.intro}
-penchmarks (NPB v3.3) developed by NASA~\cite{44}. Our experiments are executed
-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 }
-
-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}
+benchmarks (NPB v3.3) developed by NASA~\cite{44}. Our experiments are executed
+using the simulator SimGrid/SMPI v3.10~\cite{Casanova:2008:SGF:1397760.1398183}
+over an homogeneous distributed memory architecture. Furthermore, we compare the
+proposed algorithm with Rauber and Rünger methods~\cite{3}.
+The comparison's results show that our
+algorithm gives better energy-time trade off.
+
+This paper is organized as follows: Section~\ref{sec.relwork} presents the works
+from other authors. Section~\ref{sec.exe} shows the execution of parallel
+tasks and sources of idle times. Also, it resumes the energy
+model of homogeneous platform. Section~\ref{sec.mpip} evaluates the performance
+of MPI program. Section~\ref{sec.compet} presents the energy-performance trade offs
+objective function. Section~\ref{sec.optim} demonstrates the proposed
+energy-performance algorithm. Section~\ref{sec.expe} verifies the performance prediction
+model and presents the results of the proposed algorithm. Also, It shows the comparison results. Finally,
+we conclude in Section~\ref{sec.concl}.
+\section{Related Works}
+\label{sec.relwork}
+
+\AG{Consider introducing the models sec.~\ref{sec.exe} maybe before related works}
+
+In the this section some heuristics to compute the scaling factor are
+presented and classified in two parts: offline and online methods.
+
+\subsection{The offline DVFS orientations}
-during the compilation phases as an example in Azevedo et al.~\cite{40}. He used
-intra-task algorithm to choose the DVFS setting when there are dependency points
-between tasks. While in~\cite{29}, Xie et al. used breadth-first search
-algorithm to do that. Their goal is saving energy with time limits. Another
-approaches gathers and stores the runtime information for each DVFS state , then
-used their methods offline to select the suitable DVFS that optimize energy-time
-trade offs. As an example~\cite{8}, Rountree et al. used liner programming
-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}
-
-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
-predicting approaches for the energy-time trade offs developed by
-~\cite{11,2,31}. These works select the best DVFS setting depending on the slack
-times. These times happen when the processors have to wait for data from other
-processors to compute their task. For example, during the synchronous
-communication time that take place in the MPI programs, the processors are
-idle. The optimal DVFS can be selected using the learning methods. Therefore, in
-~\cite{39,19} used machine learning to converge to the suitable DVFS
-configuration. Their learning algorithms have big time to converge when the
-number of available frequencies is high. Also, the communication time of the MPI
-program used online for saving energy as in~\cite{1}, Lim et al. developed an
-algorithm that detects the communication sections and changes the frequency
-during these sections only. This approach changes the frequency many times
-because an iteration may contain more than one communication section. The domain
-of analytical modeling used for choosing the optimal frequency as in ~\cite{3},
-Rauber et al. developed an analytical mathematical model for determining the
-optimal frequency scaling factor for any number of concurrent tasks, without
-considering communication times. They set the slowest task to maximum frequency
-for maintaining performance. In this paper we compare our algorithm with
-Rauber's model~\cite{3}, because his model can be used for any number of
-concurrent tasks for homogeneous platform and this is the same direction of this
-paper. However, the primary contributions of this paper are:
+during the compilation phases as for example in Azevedo et al.~\cite{40}. They
+use dynamic voltage scaling (DVS) algorithm to choose the DVS setting when there
+are dependency points between tasks. While in~\cite{29}, Xie et al. used
+breadth-first search algorithm to do that. Their goal is to save energy with
+time limits. Another approach gathers and stores the runtime information for
+each DVFS state, then selects the suitable DVFS offline to optimize energy-time
+trade offs. As an example, Rountree et al.~\cite{8} use liner programming
+algorithm, while in~\cite{38,34}, Cochran et al. use multi logistic regression
+algorithm for the same goal. The offline study that shows the DVFS impact on the
+communication time of the MPI program is~\cite{17}, where Freeh et al. show that
+these times do not change when the frequency is scaled down.
+
+\subsection{The online DVFS orientations}
+
+The objective of the online DVFS orientations is to dynamically compute and set
+the frequency of the CPU for saving energy during the runtime of the
+programs. Estimating and predicting approaches for the energy-time trade offs
+are developed by Kimura, Peraza, Yu-Liang et al. ~\cite{11,2,31}. These works
+select the best DVFS setting depending on the slack times. These times happen
+when the processors have to wait for data from other processors to compute their
+task. For example, during the synchronous communications that take place in MPI
+programs, some processors are idle. The optimal DVFS can be selected using
+learning methods. Therefore, in Dhiman, Hao Shen et al. ~\cite{39,19} used
+machine learning to converge to the suitable DVFS configuration. Their learning
+algorithms take big time to converge when the number of available frequencies is
+high. Also, the communication sections of the MPI program can be used to save
+energy. In~\cite{1}, Lim et al. developed an algorithm that detects the
+communication sections and changes the frequency during these sections
+only. This approach changes the frequency many times because an iteration may
+contain more than one communication section. The domain of analytical modeling
+can also be used for choosing the optimal frequency as in Rauber and
+Rünger~\cite{3}. They developed an analytical mathematical model to determine
+the optimal frequency scaling factor for any number of concurrent tasks. They
+set the slowest task to maximum frequency for maintaining performance. In this
+paper we compare our algorithm with Rauber and Rünger model~\cite{3}, because
+their model can be used for any number of concurrent tasks for homogeneous
+platforms. The primary contributions of this paper are:
-lead to idle time while tasks wait at the synchronous point for others tasks to
-finish their communications see figure~(\ref{fig:h1}). Another source for idle
-times is the imbalanced computations. This happen when processing different
-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
+lead to idle time while tasks wait at the synchronization barrier for other tasks to
+finish their communications (see figure~(\ref{fig:h1})). The imbalanced communications
+happen when nodes have to send/receive different amount of data or each node is communicates
+with different number of nodes. Another source for idle times is the imbalanced computations.
+This happens when processing different amounts of data on each processor (see figure~(\ref{fig:h2})).
+In this case the fastest tasks have to wait at the synchronization barrier for the
+slowest tasks to finish their job. In both cases the overall execution time
+of the program is the execution time of the slowest task as:
+\begin{equation}
+ \label{eq:T1}
+ \textit{Program Time} = \max_{i=1,2,\dots,N} T_i
-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
-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
-static energy linearly because the execution time is increased~\cite{36}. The
-energy model, depending on the frequency scaling factor, of homogeneous platform
-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
+The value of the scale $S$ is greater than 1 when changing the frequency to any
+new frequency value~(\emph {P-state}) in governor, the CPU governor is an
+interface driver supplied by the operating system kernel (e.g. Linux) to
+lowering core's frequency. The scaling factor is equal to 1 when the new frequency is
+set to the maximum frequency. The energy consumption model for parallel
+homogeneous platform depends on the scaling factor \emph S. This factor reduces
+quadratically the dynamic power. Also, this factor increases the static energy
+linearly because the execution time is increased~\cite{36}. The energy model
+depending on the frequency scaling factor for homogeneous platform for any
+number of concurrent tasks was developed by Rauber and Rünger~\cite{3}. This
+model considers the two power metrics for measuring the energy of the parallel
+tasks as in EQ~(\ref{eq:energy}):
+\begin{equation}
+ \label{eq:energy}
+ E = 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
-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
-for homogeneous platform that we work on in this paper. 2-we are compare our
-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
+where $N$ is the number of nodes. In this paper we depend on
+Rauber and Rünger energy model EQ~(\ref{eq:energy}) for two reasons: (1) this
+model is used for homogeneous platform that we work on in this paper, and (2) we
+compare our algorithm with Rauber and Rünger scaling model. Rauber and Rünger
+scaling factor that reduce energy consumption derived from the
+EQ~(\ref{eq:energy}). They take 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_\textit{opt} = \sqrt[3]{\frac{2}{n} \cdot \frac{P_\textit{dyn}}{P_\textit{static}} \cdot
+ \left( 1 + \sum_{i=2}^{N} \frac{T_i^3}{T_1^3} \right) }
-computation~\cite{17}. We are made many tests on real cluster to prove that the
-frequency scaling factor \emph S has a linear relation with computation time
-only also see~\cite{41}. To predict the execution time of MPI program, firstly
-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
+computation~\cite{17}. To predict the execution time of MPI program, the communication time and
+the computation time for the slower task must be first precisely specified. Secondly,
+these times are used to predict the execution time for any MPI program as a function of
+the new scaling factor as in EQ~(\ref{eq:tnew}).
+\begin{equation}
+ \label{eq:tnew}
+ \textit T_\textit{New} = T_\textit{Max Comp Old} \cdot S + T_{\textit{Max Comm Old}}
-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
-time for any scale value. The NAS programs run the class B for comparing the
-real execution time with the predicted execution time. Each program runs offline
-with all available scaling factors on 8 or 9 nodes to produce real execution
-time values. These scaling factors are computed by dividing the maximum
-frequency by the new one see EQ~(\ref{eq:s}). In all tests, we use the simulator
-Simgrid/SMPI v3.10 to run the NAS programs.
-\begin{figure}[width=\textwidth,height=\textheight,keepaspectratio]
- \centering
- \includegraphics[scale=0.60]{cg_per.eps}
- \includegraphics[scale=0.60]{mg_pre.eps}
- \includegraphics[scale=0.60]{bt_pre.eps}
- \includegraphics[scale=0.60]{lu_pre.eps}
- \caption{Fitting Predicted to Real Execution Time}
- \label{fig:pred}
-\end{figure}
-%see Figure~\ref{fig:pred}
-In our cluster there are 18 available frequency states for each processor from
-2.5 GHz to 800 MHz, there is 100 MHz difference between two successive
-frequencies. For more details on the characteristics of the platform refer to
-table~(\ref{table:platform}). This lead 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. 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}
between the energy and the performance are nonlinear and complex, because the
relation of the energy with scaling factor is nonlinear and with the performance
it is linear see~\cite{17}. The relation between the energy and the performance
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
between the energy and the performance are nonlinear and complex, because the
relation of the energy with scaling factor is nonlinear and with the performance
it is linear see~\cite{17}. The relation between the energy and the performance
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 }
-\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}} \;\;
+without scaled frequency:
+\begin{multline}
+ \label{eq:enorm}
+ E_\textit{Norm} = \frac{ E_\textit{Reduced}}{E_\textit{Original}} \\
+ {} = \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 }
+\end{multline}
+By the same way we can normalize the performance as follows:
+\begin{equation}
+ \label{eq:pnorm}
+ P_\textit{Norm} = \frac{T_\textit{New}}{T_\textit{Old}}
+ = \frac{T_\textit{Max Comp Old} \cdot S +
+ T_\textit{Max Comm Old}}{ T_\textit{Old}}
-\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}
-FOR J:=1 to Some_iterations Do
- -Computations Section.
- -Communications Section.
- IF (J==1) THEN
- -Gather all times of computation and communication
- from each node.
- -Call EPSA with these times.
- -Calculate the new frequency from optimal scale.
- -Set the new frequency to the system.
- ENDIF
-ENDFOR
-\end{lstlisting}
-After obtaining the optimal scale factor from the EPSA algorithm. The program
+The proposed EPSA algorithm works online during the execution time of the MPI
+program. It selects the optimal scaling factor by gathering the computation and communication times
+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 algorithm complexity is O(F$\cdot$N),
+where F is the number of available frequencies and N is the number of computing 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 changes the new frequency of the system. The algorithm is called just
+one time during the execution of the program. The DVFS algorithm~(\ref{dvfs}) shows where and when the EPSA algorithm is called
+in the MPI program.
+%\begin{minipage}{\textwidth}
+%\AG{Use the same format as for Algorithm~\ref{$EPSA$}}
+
+\begin{algorithm}[tp]
+ \caption{DVFS}
+ \label{dvfs}
+ \begin{algorithmic}[1]
+ \For {$K:=1$ to $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 EPSA with these times.
+ \State -Calculate the new frequency from optimal scale.
+ \State -Change the new frequency of the system.
+ \EndIf
+\EndFor
+\end{algorithmic}
+\end{algorithm}
+After obtaining the optimal scale factor from the EPSA algorithm, the program
-Depending on the EQ~(\ref{eq:energy}), we measure the energy consumption for all
-the NAS MPI programs while assuming the power dynamic is equal to 20W and the
-power static is equal to 4W for all experiments. We run the proposed ESPA
+\subsection{Performance Prediction Verification}
+
+In this section we evaluate the precision of our performance prediction methods
+on the NAS benchmarks. We use EQ~(\ref{eq:tnew}) that predicts the execution
+time for any scale value. The NAS programs run the class B for comparing the
+real execution time with the predicted execution time. Each program runs offline
+with all available scaling factors on 8 or 9 nodes to produce real execution
+time values. These scaling factors are computed by dividing the maximum
+frequency by the new one see EQ~(\ref{eq:s}).
+\begin{figure*}[t]
+ \centering
+ \includegraphics[width=.4\textwidth]{cg_per.eps}\qquad%
+ \includegraphics[width=.4\textwidth]{mg_pre.eps}
+ \includegraphics[width=.4\textwidth]{bt_pre.eps}\qquad%
+ \includegraphics[width=.4\textwidth]{lu_pre.eps}
+ \caption{Fitting Predicted to Real Execution Time}
+ \label{fig:pred}
+\end{figure*}
+%see Figure~\ref{fig:pred}
+In our cluster there are 18 available frequency states for each processor.
+This lead 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. 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 present the execution times of the NAS benchmarks as in the
+figure~(\ref{fig:pred}).
+
+\subsection{The EPSA Results}
+The proposed EPSA 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
+C) for each program. Each program runs on specific number of processors
+proportional to the size of the class. Each class represents the problem size
+ascending from the class A to C. Additionally, depending on some speed up points
+for each class we run the classes A, B and C on 4, 8 or 9 and 16 nodes
+respectively.
+Depending on EQ~(\ref{eq:energy}), we measure the energy consumption for all
+the NAS MPI programs while assuming the power dynamic is equal to \np[W]{20} and
+the power static is equal to \np[W]{4} for all experiments. These power values
+used by Rauber and Rünger~\cite{3}. We run the proposed EPSA
-%\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 and Rünger 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 and Rünger energy-performance method ($R_{E-P}$). Also, in
+($R_{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.