1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7 \newcommand{\AG}[2][inline]{%
8 \todo[color=green!50,#1]{\sffamily\textbf{AG:} #2}\xspace}
9 \newcommand{\JC}[2][inline]{%
10 \todo[color=red!10,#1]{\sffamily\textbf{JC:} #2}\xspace}
12 \newcommand{\Xsub}[2]{{\ensuremath{#1_\mathit{#2}}}}
14 %% used to put some subscripts lower, and make them more legible
15 \newcommand{\fxheight}[1]{\ifx#1\relax\relax\else\rule{0pt}{1.52ex}#1\fi}
17 \newcommand{\Tcomp}[1][]{\Xsub{T}{comp}_{#1}}
18 \renewcommand*\npunitcommand[1]{\text{#1}}
21 \chapter{Energy optimization of homogeneous platform}
24 \section{Introduction}
27 Dynamic Voltage and Frequency Scaling (DVFS) can be applied to modern CPUs. This technique is
28 usually used to reduce the energy consumed by a CPU while computing. Indeed,
29 power consumption by a processor at a given time is exponentially related to its frequency.
30 Thus, decreasing the frequency reduces the power consumed by the CPU. However, it can also
31 significantly affect the performance of the executed program if it is compute bound and
32 if a low CPU frequency is selected. The performance degradation ratio can even be higher
33 than the saved energy ratio. Therefore, the chosen frequency scaling factor must give the best possible
34 trade-off between energy reduction and performance. This chapter presents an algorithm
35 that predicts the energy consumed with each frequency gear and selects the one that gives
36 the best ratio between energy consumption reduction and performance. Furthermore, the main
37 objective of HPC systems is to execute as fast as possible the application. Therefore, our
38 algorithm selects the scaling factor online with very small overhead. The proposed algorithm
39 takes into account both the computation and communication times of the Message passing
40 programs (MPI) to choose the frequency scaling factor.
41 This algorithm has the ability to predict both energy consumption and execution time over
42 all available scaling factors. The prediction achieved depends on some computing time information,
43 gathered at the beginning of the runtime. We apply this algorithm to seven MPI
44 benchmarks. These MPI programs are the NAS parallel benchmarks (NPB v3.3)
45 developed by NASA~\cite{ref65}. Our experiments are executed using the simulator
46 SimGrid/SMPI v3.10~\cite{ref66} over an homogeneous
47 distributed memory architecture.
49 Mainly there are two tasks in this chapter, the first one is showed the results of the proposed frequency scaling selection algorithm using the energy model of the Rauber and Rünger \cite{ref47}. Furthermore, the proposed algorithm is compared with Rauber and Rünger's method. The comparison results show that our algorithm gives better energy-time trade-off. In the second task, a new energy model that takes into account both the communication and computation times of the MPI programs running over homogeneous cluster is developed.
50 It also shows the new results obtained using the new energy model and comparing them with the ones use Rauber and Rünger energy model.
53 This chapter is organized as follows: Section~\ref{ch2:2} explains the execution
54 of parallel tasks and the sources of slack times. It also presents an energy
55 model for homogeneous platforms from other authors. Section~\ref{ch2:3} describes how the
56 performance of MPI programs can be predicted. Section~\ref{ch2:4} presents
57 the energy-performance objective function that maximizes the reduction of energy
58 consumption while minimizing the degradation of the program's performance.
59 Section~\ref{ch2:5} details the proposed energy-performance algorithm.
60 Section~\ref{ch2:6} verifies the accuracy of the performance prediction model
61 and presents the results of the proposed algorithm. It also shows the
62 comparison results between our method and other existing method.
63 Section~\ref{ch2:7} describes the new proposed energy consumption model for
64 homogeneous platforms. Section~\ref{ch2:8} presents the experimental results
65 of using the new energy model. Finally, section~\ref{ch2:9} summarizes this chapter.
68 \section{Related works}
72 In this section, some heuristics to compute the scaling factor are presented and
73 classified into two categories: offline and online methods.
75 \subsection{Offline scaling factor selection methods}
77 The offline scaling factor selection methods are executed before the runtime of
78 the program. They return static scaling factor values to the processors
79 participating in the execution of the parallel program. On the one hand, the
80 scaling factor values could be computed based on information retrieved by
81 analyzing the code of the program and the computing system that will execute it.
82 In~\cite{ref56}, Azevedo et al. detect during compilation the dependency points
83 between tasks in a multi-task program. This information is then used to lower
84 the frequency of some processors in order to eliminate slack times. A slack
85 time is the period of time during which a processor that has already finished
86 its computation, has to wait for a set of processors to finish their
87 computations and send their results to the waiting processor in order to
88 continue its task that is dependent on the results of computations being
89 executed on other processors. Freeh et al. showed in~\cite{ref53} that the
90 communication times of MPI programs do not change when the frequency is scaled
91 down. On the other hand, some offline scaling factor selection methods use the
92 information gathered from previous full or partial executions of the program.
93 The whole program or, a part of it, is usually executed over all the available frequency
94 gears and the execution time and the energy consumed with each frequency
95 gear are measured. Then a heuristic or an exact method uses the retrieved
96 information to compute the values of the scaling factor for the processors.
97 In~\cite{ref57}, Xie et al. use an exact exponential breadth-first search algorithm
98 to compute the scaling factor values that give the optimal energy reduction
99 while respecting a deadline for a sequential program. They also present a
100 linear heuristic that approximates the optimal solution. In~\cite{ref58} , Rountree
101 et al. use a linear programming algorithm, while in~\cite{ref59,ref60}, Cochran et
102 al. use a multi-logistic regression algorithm for the same goal. The main
103 drawback of these methods is that they all require executing the
104 whole program or, a part of it, on all frequency gears for each new instance of
107 \subsection{Online scaling factor selection methods}
109 The online scaling factor selection methods are executed during the runtime of
110 the program. They are usually integrated into iterative programs where the same
111 block of instructions is executed many times. During the first few iterations,
112 a lot of information is measured such as the execution time, the energy consumed
113 using a multimeter, the slack times, \dots{} Then a method will exploit these
114 measurements to compute the scaling factor values for each processor. This
115 operation, measurements and computing new scaling factor, can be repeated as
116 much as needed if the iterations are not regular. Kimura, Peraza, Yu-Liang et
117 al.~\cite{ref61,ref55,ref62} used varied heuristics to select the appropriate scaling
118 factor values to eliminate the slack times during runtime. However, as seen
119 in~\cite{ref63,ref64}, machine learning methods can take a lot of time to converge
120 when the number of available gears is big. To reduce the impact of slack times,
121 in~\cite{ref54}, Lim et al. developed an algorithm that detects the communication
122 sections and changes the frequency during these sections only. This approach
123 might change the frequency of each processor many times per iteration if an
124 iteration contains more than one communication section. In~\cite{ref53}, Rauber and
125 Rünger used an analytical model that can predict the consumed energy and the
126 execution time for every frequency gear after measuring the consumed energy and
127 the execution time with the highest frequency gear. These predictions may be
128 used to choose the optimal gear for each processor executing the parallel
129 program to reduce energy consumption. To maintain the performance of the
130 parallel program , they set the processor with the biggest load to the highest
131 gear and then compute the scaling factor values for the rest of the processors.
132 Although this model was built for parallel architectures, it can be adapted to
133 distributed architectures by taking into account the communication times. The
134 primary contribution of this chapter is to present a new online scaling factor
135 selection method which has the following characteristics:
137 \item It is based on both Rauber and Rünger and the new developed energy models to predict the energy consumption of the application with different frequency gears.
138 \item It selects the frequency scaling factor for simultaneously optimizing
139 energy reduction and maintaining performance.
140 \item It is well adapted to distributed architectures because it takes into
141 account the communication time.
142 \item It is well adapted to distributed applications with imbalanced tasks.
143 \item It has a very small footprint when compared to other methods
144 (e.g.,~\cite{ref64}) and does not require profiling or training as
145 in~\cite{ref59,ref60}.
149 \section{Execution and energy of parallel tasks on homogeneous platform}
152 \subsection{Parallel tasks execution on homogeneous platform}
154 A homogeneous cluster consists in identical nodes in terms of hardware and
155 software. Each node has its own memory and at least one processor which can be
156 a multi-core. The nodes are connected via a high bandwidth network. Tasks
157 executed on this model can be either synchronous or asynchronous. In this chapter
158 we consider execution of the synchronous tasks on distributed homogeneous
159 platform. These tasks can exchange the data via synchronous message passing.
166 \includegraphics[scale=0.73]{fig/ch2/commtasks}
167 \includegraphics[scale=0.73]{fig/ch2/compt}\\ ~ ~ ~ ~ ~ ~(a) ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~(b)
168 \caption{Parallel tasks execution on homogeneous platform (a) imbalanced communications and (b) imbalanced
173 Therefore, the execution time of a task consists in the computation time and the
174 communication time. Moreover, the synchronous communications between tasks can
175 lead to slack times while tasks wait at the synchronization barrier for other
176 tasks to finish their tasks (see figure~\ref{fig:homo}(a)). The imbalanced
177 communications happen when nodes have to send/receive different amounts of data
178 or they communicate with different numbers of nodes. Other sources of slack
179 times are imbalanced computations. This happens when processing different
180 amounts of data on each processor (see figure~\ref{fig:homo}(b)). In this case the
181 fastest tasks have to wait at the synchronization barrier for the slowest ones
182 to begin the next task. In both cases the overall execution time of the program
183 is the execution time of the slowest task as in EQ~(\ref{eq:T1}).
186 \textit{Program Time} = \max_{i=1,2,\dots,N} T_i
188 where $T_i$ is the execution time of task $i$ and all the tasks are executed
189 concurrently on different processors.
191 \subsection{Energy model for homogeneous platform}
194 The total energy consumption model for a parallel homogeneous
195 platform, as presented by Rauber and Rünger~\cite{ref47}, can be written as a
196 function of the scaling factor $S$, as in EQ~\ref{eq:energy}.
197 Moreover, the scaling factor $S_1$ is the scaling factor which should be the
198 highest because they are proportional to the time values $T_i$. Therefore, the scaling
199 factors of the others tasks $S_i$ are computed as in EQ~\ref{eq:si}.
203 S_i = S \cdot \frac{T_1}{T_i}
204 = \frac{F_{max}}{F_{new}} \cdot \frac{T_1}{T_i}
207 We compare our algorithm with Rauber and Rünger's scaling factor selection
208 method which uses the same energy model. In their method, the optimal scaling factor is
209 computed by minimizing the derivation of EQ~(\ref{eq:energy}) which produces
214 S_\textit{opt} = \sqrt[3]{\frac{2}{N} \cdot \frac{P_\textit{dyn}}{P_\textit{static}} \cdot
215 \left( 1 + \sum_{i=2}^{N} \frac{T_i^3}{T_1^3} \right) }
218 This model is computed the frequency scaling factor which optimizes the energy consumption of the parallel
219 program into minimal level.
221 \section{Performance evaluation of MPI programs}
224 The execution time of a parallel synchronous iterative application is equal
225 to the execution time of the slowest task as in figure~(\ref{fig:homo}).
226 If there is no communication and the application is not data bounded, the execution time of a
227 parallel program is linearly proportional to the operational frequency and any
228 DVFS operation for energy reduction increases the execution time of the parallel
229 program. Therefore, the scaling factor $S$ is linearly proportional to the
230 execution time. However, in most MPI applications the processes exchange
231 data. During these communications the processors involved remain idle until the
232 communications are finished. For that reason, any change in the frequency has no
233 impact on the time of communication~\cite{ref53}. The communication time for a
234 task is the summation of periods of time that begin with an MPI call for sending
235 or receiving a message till the message is synchronously sent or received. To
236 be able to predict the execution time of MPI program, the communication time and
237 the computation time for the slowest task must be measured before scaling. These
238 times are used to predict the execution time for any MPI program as a function
239 of the new scaling factor as in EQ~(\ref{eq:tnew}).
242 \textit T_\textit{new} = T_\textit{Max Comp Old} \cdot S + T_{\textit{Min Comm Old}}
244 In this chapter, this prediction method is used to select the best scaling factor
245 for each processor as presented in the next section.
249 \section{Performance and energy reduction trade-off}
251 This section presents our method for choosing the optimal scaling factor that
252 gives the best tradeoff between energy reduction and performance. This method
253 takes into account the execution times for both computation and communication to
254 compute the scaling factor. Since the energy consumption and the performance
255 are not measured using the same metric, a normalized value of both measurements
256 can be used to compare them. The normalized energy is the ratio between the
257 consumed energy with scaled frequency and the consumed energy without scaled
262 E_\textit{Norm} = \frac{ E_\textit{Reduced}}{E_\textit{Original}}
263 = \frac{P_\textit{dyn} \cdot S_1^{-2} \cdot
264 \left( T_1 + \sum_{i=2}^{N}\frac{T_i^3}{T_1^2}\right) +
265 P_\textit{static} \cdot T_1 \cdot S_1 \cdot N }{
266 P_\textit{dyn} \cdot \left(T_1+\sum_{i=2}^{N}\frac{T_i^3}{T_1^2}\right) +
267 P_\textit{static} \cdot T_1 \cdot N }
269 In the same way we can normalize the performance as follows:
272 T_\textit{Norm} = \frac{T_\textit{New}}{T_\textit{Old}}
273 = \frac{T_\textit{Max Comp Old} \cdot S +
274 T_\textit{Min Comm Old}}{T_\textit{Max Comp Old} +
275 T_\textit{Min Comm Old}}
278 The relation between the execution time and the consumed energy of a program is nonlinear and complex. In consequences, the relation between the consumed energy and the scaling factor is also nonlinear, for more details refer to~\cite{ref53}. Therefore, the resulting normalized energy consumption curve and execution time curve, for different scaling factors, do not have the same direction see Figure~\ref{fig:rel}(b). To tackle this problem and optimize both terms, we inverse the equation of the normalized execution time (normalized performance) as follows:
282 P_\textit{Norm} = \frac{ T_\textit{old}}{ T_\textit{new}}
283 = \frac{T_\textit{max Comp Old} +
284 T_\textit{min Comm Old}}{T_\textit{max Comp Old} \cdot S +
285 T_\textit{min Comm Old}}
291 \includegraphics[scale=1]{fig/ch2/file}\\~ ~ ~ ~ ~(a) \\
293 \includegraphics[scale=1]{fig/ch2/file3}\\~ ~ ~ ~ ~(b)
295 \caption{The energy and performance relation (a) Converted relation and (b) Real relation}
299 Then, we can model our objective function as finding the maximum distance
300 between the energy curve EQ~\ref{eq:enorm} and the inverse of the execution time (performance)
301 curve EQ~\ref{eq:pnorm_en} over all available scaling factors. This
302 represents the minimum energy consumption with minimum execution time (better
303 performance) at the same time, see Figure~\ref{fig:rel}(a). Then
304 our objective function has the following form:
308 MaxDist = \max_{j=1,2,\dots,F}
309 (\overbrace{P_\textit{norm}(S_j)}^{\text{Maximize}} -
310 \overbrace{E_\textit{norm}(S_j)}^{\text{Minimize}} )
312 where $F$ is the number of available frequencies. Then we can select the optimal
313 scaling factor that satisfies EQ~\ref{eq:max1}. Our objective function can
314 work with any energy model or static power values stored in a data file.
315 Moreover, this function works in optimal way when the energy curve has a convex
316 form over the available frequency scaling factors as shown in~\cite{ref48,ref47,ref64}.
318 \section{Optimal scaling factor for performance and energy}
321 Algorithm~\ref{EPSA} computes the optimal scaling factor according to the
322 objective function described above.
324 \begin{algorithm}[!t]
325 \caption{Scaling factor selection algorithm for homogeneous cluster}
327 \begin{algorithmic}[1]
328 \State Initialize the variable $Dist=0$
329 \State Set dynamic and static power values.
330 \State Set $P_{states}$ to the number of available frequencies.
331 \State Set the variable $F_{new}$ to max. frequency, $F_{new} = F_{max} $
332 \State Set the variable $F_{diff}$ to the difference between two successive
334 \For {$j:=1$ to $P_{states} $}
335 \State $F_{new}=F_{new} - F_{diff} $
336 \State $S = \frac{F_\textit{max}}{F_\textit{new}}$
337 \State $S_i = S \cdot \frac{T_1}{T_i}
338 = \frac{F_\textit{max}}{F_\textit{new}} \cdot \frac{T_1}{T_i}$
340 \State $E_\textit{Norm} =
341 \frac{P_\textit{dyn} \cdot S_1^{-2} \cdot
342 \left( T_1 + \sum_{i=2}^{N}\frac{T_i^3}{T_1^2}\right) +
343 P_\textit{static} \cdot T_1 \cdot S_1 \cdot N }{
345 \left(T_1+\sum_{i=2}^{N}\frac{T_i^3}{T_1^2}\right) +
346 P_\textit{static} \cdot T_1 \cdot N }$
347 \State $P_{Norm}= \frac{T_{old}}{T_{new}}$
348 \If{$(P_{Norm}-E_{Norm} > Dist)$}
350 \State $Dist = P_{Norm} - E_{Norm}$
353 \State Return $S_{opt}$
359 The proposed algorithm works online during the execution time of the MPI
360 program. It selects the optimal scaling factor after gathering the computation
361 and communication times from the program after one iteration. Then the program
362 changes the new frequencies of the CPUs according to the computed scaling
363 factors. In our experiments over a homogeneous cluster described in
364 Section~\ref{ch2:6}, this algorithm has a small execution time. It takes
365 \np[$\mu$s]{1.52} on average for 4 nodes and \np[$\mu$s]{6.65} on average for 32
366 nodes. The algorithm complexity is $O(F\cdot N)$, where $F$ is the number of
367 available frequencies and $N$ is the number of computing nodes. The algorithm
368 is called just once during the execution of the program. The DVFS algorithm
369 ~\ref{dvfs} shows where and when the algorithm is called in the MPI
374 \begin{algorithm}[!t]
375 \caption{DVFS algorithm of homogeneous cluster}
377 \begin{algorithmic}[1]
378 \For {$k:=1$ to \textit{some iterations}}
379 \State Computations section.
380 \State Communications section.
382 \State Gather all times of computation and communication from each node.
383 \State Call algorithm~\ref{EPSA} with these times.
384 \State Compute the new frequency from the returned optimal scaling factor.
385 \State Set the new frequency to the CPU.
392 After obtaining the optimal scaling factor, the program calculates the new
393 frequency $F_i$ for each task proportionally to its time value $T_i$. By
394 substitution of EQ~(\ref{eq:s}) in EQ~(\ref{eq:si}), we can calculate the new
395 frequency $F_i$ as follows:
398 F_i = \frac{F_\textit{max} \cdot T_i}{S_\textit{opt} \cdot T_\textit{max}}
400 According to this equation all the nodes may have the same frequency value if
401 they have balanced workloads, otherwise, they take different frequencies when
402 having imbalanced workloads. Thus, EQ~(\ref{eq:fi}) adapts the frequency of the
403 CPU to the nodes' workloads to maintain the performance of the program.
405 \section{Experimental results}
407 Our experiments are executed on the simulator SimGrid/SMPI v3.10. We configure
408 the simulator to use a homogeneous cluster with one core per node. The detailed
409 characteristics of our platform file are shown in
410 table~(\ref{table:platform-homo}). Each node in the cluster has 18 frequency values
411 from 2.5 GHz to 800 MHz with 100 MHz difference between each
412 two successive frequencies. The simulated network link is 1 GB Ethernet
413 (TCP/IP). The backbone of the cluster simulates a high performance switch.
416 \caption{Platform file parameters}
419 \begin{tabular}{|*{7}{l|}}
421 Max & Min & Backbone & Backbone & Link & Link & Sharing \\
422 Freq. & Freq. & Bandwidth & Latency & Bandwidth & Latency & Policy \\
424 2.5 & 800 & 2.25 GBps & 0.5 $\mu$s & 1 GBps & 50 $\mu$s & Full \\
425 GHz & MHz & & & & & Duplex \\
428 \label{table:platform-homo}
430 \subsection{Performance prediction verification}
432 In this section, the precision of the proposed performance prediction method
433 based on EQ~(\ref{eq:tnew}) is evaluated by applying it to the NAS benchmarks.
434 The NAS programs are executed with the class B option to compare the real execution
435 time with the predicted execution time. Each program runs offline with all available
436 scaling factors on 8 or 9 nodes (depending on the benchmark) to produce real
437 execution time values. These scaling factors are computed by dividing the
438 maximum frequency by the new one see EQ~(\ref{eq:s}).
443 \includegraphics[width=.49\textwidth]{fig/ch2/cg_per}
444 \includegraphics[width=.49\textwidth]{fig/ch2/mg_pre}
445 \includegraphics[width=.49\textwidth]{fig/ch2/bt_pre}
446 \includegraphics[width=.49\textwidth]{fig/ch2/lu_pre}
447 \caption{Comparing predicted to real execution time}
450 %see Figure~\ref{fig:pred}
451 In our cluster there are 18 available frequency states for each processor. This
452 leads to 18 run states for each program. We use seven MPI programs of the NAS
453 parallel benchmarks: CG, MG, EP, FT, BT, LU and SP.~Figure~(\ref{fig:pred})
454 presents plots of the real execution times compared to the simulated ones. The maximum
455 normalized error between these two execution times varies between 0.0073 to
456 0.031 dependent on the executed benchmark. The smallest prediction error
457 was for CG and the worst one was for LU.
460 \subsection{The experimental results for the scaling algorithm }
462 The proposed algorithm was applied to seven MPI programs of the NAS benchmarks
463 (EP, CG, MG, FT, BT, LU and SP) which were run with three classes (A, B and C).
464 For each instance the benchmarks were executed on a number of processors
465 proportional to the size of the class. Each class represents the problem size
466 ascending from class A to C. Additionally, depending on some speed up
467 points for each class we run the classes A, B and C on 4, 8 or 9 and 16 nodes
468 respectively. Depending on EQ~(\ref{eq:energy}), we measure the energy
469 consumption for all the NAS MPI programs while assuming that the dynamic power with
470 the highest frequency is equal to 20 W and the power static is equal to
471 4 W for all experiments. These power values were also used by Rauber and
472 Rünger in~\cite{ref47}. The results showed that the algorithm selected different
473 scaling factors for each program depending on the communication features of the
474 program as in the plots~(\ref{fig:nas}). These plots illustrate that there are
475 different distances between the normalized energy and the normalized
476 performance curves, because there are different communication features for each
477 benchmark. When there are little or no communications, the
478 performance curve is very close to the energy curve. Then the distance between
479 the two curves is very small. This leads to small energy savings. The opposite
480 happens when there are a lot of communication, the distance between the two
481 curves is big. This leads to more energy savings (e.g. CG and FT), see
482 table~(\ref{table:factors results}). All discovered frequency scaling factors
483 optimize both the energy and the performance simultaneously for all NAS
484 benchmarks. In table~(\ref{table:factors results}), we record all optimal
485 scaling factors results for each benchmark running class C. These scaling
486 factors give the maximum energy saving percentage and the minimum performance
487 degradation percentage at the same time from all available scaling factors.
490 \includegraphics[width=.49\textwidth]{fig/ch2/ep}
491 \includegraphics[width=.49\textwidth]{fig/ch2/cg}
492 \includegraphics[width=.49\textwidth]{fig/ch2/sp}
493 \includegraphics[width=.49\textwidth]{fig/ch2/lu}
494 \includegraphics[width=.49\textwidth]{fig/ch2/bt}
495 \includegraphics[width=.49\textwidth]{fig/ch2/ft}
496 \caption{Optimal scaling factors for the predicted energy and performance of NAS benchmarks}
500 \caption{The scaling factors results}
503 \begin{tabular}{|l|*{4}{r|}}
505 Program & Optimal & Energy & Performance & Energy-Perf. \\
506 Name & Scaling Factor & Saving \% & Degradation \% & Distance \\
508 CG & 1.56 & 39.23 & 14.88 & 24.35 \\
510 MG & 1.47 & 34.97 & 21.70 & 13.27 \\
512 EP & 1.04 & 22.14 & 20.73 & 1.41 \\
514 LU & 1.38 & 35.83 & 22.49 & 13.34 \\
516 BT & 1.31 & 29.60 & 21.28 & 8.32 \\
518 SP & 1.38 & 33.48 & 21.36 & 12.12 \\
520 FT & 1.47 & 34.72 & 19.00 & 15.72 \\
523 \label{table:factors results}
524 % is used to refer this table in the text
527 As shown in table~(\ref{table:factors results}), when the optimal scaling
528 factor has a big value we can gain more energy savings as in CG and
529 FT benchmarks. The opposite happens when the optimal scaling factor has a small value as in BT and EP benchmarks. Our algorithm selects a big scaling factor value when the
530 communication and other slacks times are big and smaller ones in opposite
531 cases. In EP there are no communication inside the iterations. This leads our
532 algorithm to select smaller scaling factor values (inducing smaller energy
536 \subsection{Results comparison}
538 In this section, we compare our scaling factor selection method with Rauber and
539 Rünger methods~\cite{ref47}. They had two scenarios, the first is to reduce energy
540 to the optimal level without considering the performance as in
541 EQ~(\ref{eq:sopt}). We refer to this scenario as $R_{E}$. The second scenario
542 is similar to the first except setting the slower task to the maximum frequency
543 (when the scale $S=1$) to keep the performance from degradation as mush as
544 possible. We refer to this scenario as $R_{E-P}$. While we refer to our
545 algorithm as EPSA (Energy to Performance Scaling Algorithm). The comparison is
546 made in table ~\ref{table:compareC}. This table shows the results of our method and
547 Rauber and Rünger scenarios for all the NAS benchmarks programs for class C.
550 \caption{Comparing results for the NAS class C}
553 \begin{tabular}{|l|l|*{4}{r|}}
555 Method & Program & Factor & Energy & Performance & Energy-Perf. \\
556 Name & Name & Value & Saving \% & Degradation \% & Distance \\
558 % \rowcolor[gray]{0.85}
559 $EPSA$ & CG & 1.56 & 39.23 & 14.88 & 24.35 \\ \hline
560 $R_{E-P}$ & CG & 2.15 & 45.36 & 25.89 & 19.47 \\ \hline
561 $R_{E}$ & CG & 2.15 & 45.36 & 26.70 & 18.66 \\ \hline
563 $EPSA$ & MG & 1.47 & 34.97 & 21.69 & 13.27 \\ \hline
564 $R_{E-P}$ & MG & 2.15 & 43.65 & 40.45 & 3.20 \\ \hline
565 $R_{E}$ & MG & 2.15 & 43.64 & 41.38 & 2.26 \\ \hline
567 $EPSA$ & EP & 1.04 & 22.14 & 20.73 & 1.41 \\ \hline
568 $R_{E-P}$ & EP & 1.92 & 39.40 & 56.33 & -16.93 \\ \hline
569 $R_{E}$ & EP & 1.92 & 38.10 & 56.35 & -18.25 \\ \hline
571 $EPSA$ & LU & 1.38 & 35.83 & 22.49 & 13.34 \\ \hline
572 $R_{E-P}$ & LU & 2.15 & 44.97 & 41.00 & 3.97 \\ \hline
573 $R_{E}$ & LU & 2.15 & 44.97 & 41.80 & 3.17 \\ \hline
575 $EPSA$ & BT & 1.31 & 29.60 & 21.28 & 8.32 \\ \hline
576 $R_{E-P}$ & BT & 2.13 & 45.60 & 49.84 & -4.24 \\ \hline
577 $R_{E}$ & BT & 2.13 & 44.90 & 55.16 & -10.26 \\ \hline
579 $EPSA$ & SP & 1.38 & 33.48 & 21.35 & 12.12 \\ \hline
580 $R_{E-P}$ & SP & 2.10 & 45.69 & 43.60 & 2.09 \\ \hline
581 $R_{E}$ & SP & 2.10 & 45.75 & 44.10 & 1.65 \\ \hline
583 $EPSA$ & FT & 1.47 & 34.72 & 19.00 & 15.72 \\ \hline
584 $R_{E-P}$ & FT & 2.04 & 39.40 & 37.10 & 2.30 \\ \hline
585 $R_{E}$ & FT & 2.04 & 39.35 & 37.70 & 1.65 \\ \hline
587 \label{table:compareC}
588 % is used to refer this table in the text
594 % \includegraphics[width=.6\textwidth]{fig/ch2/classA.eps}
595 % \includegraphics[width=.6\textwidth]{fig/ch2/classB.eps}
596 \includegraphics[width=.7\textwidth]{fig/ch2/classC.eps}
597 \caption{Comparing our method to Rauber and Rünger's methods}
603 As shown in the table~\ref{table:compareC}, the ($R_{E-P}$) method outperforms the ($R_{E}$)
604 method in terms of performance and energy reduction. The ($R_{E-P}$) method
605 also gives better energy savings than our method. However, although our scaling
606 factor is not optimal for energy reduction, the results in these tables prove
607 that our algorithm returns the best scaling factor that satisfy our objective
608 method: the largest distance between energy reduction and performance
609 degradation. Figure~\ref{fig:compare} illustrates even better the distance between the energy reduction and performance degradation. The negative values mean that one of
610 the two objectives (energy or performance) have been degraded more than
611 other. The positive trade-offs with the highest values lead to maximum energy
612 savings while keeping the performance degradation as low as possible. Our
613 algorithm always gives the highest positive energy to performance trade-offs
614 while Rauber and Rünger's method, ($R_{E-P}$), gives sometimes negative
615 trade-offs such as in BT and EP.
618 \section{The new energy model for homogeneous cluster}
620 As mentioned in chapter \ref{ch1} section \ref{ch1:3}, the power consumed by a processor is divided
621 into two power metrics: the static and the dynamic power. The first power metrics is
622 consumed as long as the computing unit is on, while the other one is consumed when the processor is
623 doing the computations. Consequentially, the energy consumed by an individual processor
624 to execute a given program can be computed as follows:
629 E_\textit{ind} = P_\textit{dyn} \cdot T_{Comp} + P_\textit{static} \cdot T
632 where $T$ is the execution time of the program, $T_{Comp}$ is the computation
633 time and $T_{Comp} \leq T$. $T_{Comp}$ may be equal to $T$ if there is no
634 communication, no slack time and no synchronization.
636 Applying DVFS operation leads to a new frequency state, which is represented by the frequency scaling factor $S$ computed as in the equation \ref{eq:s}. According to the Rauber and Rünger energy model \ref{eq:energy}, the dynamic energy is consumed during the overall program's execution time. This assumption is not precise because the CPU is only consumed the dynamic power during computation time. Moreover, the CPU involved remain idle during the communication times and only consumed the static power, see \cite{ref53}. Also, we have conducted some experiments over a real homogeneous cluster by running some MPI programs of the NAS benchmarks. The results prove that there is no effect of changing the frequency on the communication times of these programs. Therefore, the frequency scaling factor $S$ can be increased the computation times propositionally, while not effecting the communication times. This assumption is acceptable according the used performance prediction model \ref{eq:tnew}. This model is evaluated and its prediction accuracy is showed in section \ref{ch2:6:1}. Therefore, the new dynamic energy is the dynamic power multiplied by the new time of computation and is given by the following equation:
640 Ed_{New} = Pd_{Old} \cdot S^{-3} \cdot (T_{comp} \cdot S)= S^{-2} \cdot Pd_{Old} \cdot T_{comp}
643 The static power is related to the power leakage of the CPU and is consumed
644 during computation and even when idle. As in~\cite{ref47,ref46},
645 the static power of a processor is considered as constant during idle and
646 computation periods, and for all its available frequencies. The static energy
647 is the static power multiplied by the execution time of the program. According
648 to the execution time model in (\ref{eq:tnew}), the execution time of the
649 program is the sum of the computation and the communication times. The
650 computation time is linearly related to the frequency scaling factor, while this
651 scaling factor does not affect the communication time. Then, the static energy of a
652 processor after scaling its frequency is computed as follows:
654 \label{eq:Estatic_new}
655 Es = P_{static} \cdot (T_{comp} \cdot S + T_{comm})
658 In particular, in the homogeneous cluster all the computing nodes have the same computing power and thus they have similar frequencies gears. The execution time of the MPI application is the execution time of the slowest task as shown in section \ref{ch2:2:1}. Therefore, the frequency scaling factor $S$ of the slowest task can be used to modelize the energy consumption of the parallel tasks execution.
659 The dynamic energy consumed by $N$ parallel tasks is the summation of all the dynamic energies of all tasks during the computation time $\Tcomp[i]$ of each task. The static energy of each task is the static power consumed during the execution time of the slower task because they are synchronised together.
660 Therefore, the energy consumption model of $N$ parallel task executed synchronously over a homogeneous platforms is represented in \ref{eq:e-new}.
664 E_{new} = \sum_{i=1}^{N} {(S^{-2} \cdot Pd \cdot \Tcomp[i])} +
665 ( Ps \cdot ( T_\textit{Max Comp Old} \cdot S + T_{\textit{Min Comm Old}} ) ) \cdot N
668 According to this model, the frequency scaling factor $S$ reducing the energy consumption of the homogeneous architecture by a factor of $S^{-2}$ and increases the execution time by a factor of $S$.
669 This model can be used to predict the energy consumption of the message passing synchronous iterative applications depending on the gathered computation and communication times from the first iteration.
670 Furthermore, it can be used to measured the energy consumption of the iterative application by multiplying the energy consumed of all tasks in one iteration by the number of the iterations.
672 Consequently, this model is used in the prediction process of the energy consumption by the
673 algorithm \ref{EPSA} to selects the optimal frequency scaling factor. By the same way in the last section, the new frequency $F_i$ can be computed as in \ref{eq:fi} depending on the new selected frequency scaling factor.
674 In the next section, the algorithm \ref{EPSA} is reimplemented using this new energy model \ref{eq:e-new} to select new frequency scaling factors and thus a new results are obtained.
676 \section{The experimental results using the new energy model}
679 This section presents results of applying the frequency selection algorithm \ref{EPSA} using
680 the new proposed energy model \ref{eq:e-new}. The algorithm is applied to NAS parallel benchmarks class
681 C running on 16 computing nodes using the SimGrid simulator. Same values are used for the static and dynamic powers values as in section \ref{ch2:6:2}. Two measured energy consumptions of the NAS benchmarks class C using the new energy model and Rauber and Rünger's model are presented in the figure \ref{fig:energy_con}. The energy consumptions of both models are computed using similar parameters: frequency scaling factors, dynamic and static powers values. As shown in this figure, the majority of the benchmarks have smaller computed energies values using the new model compare to those use Rauber and Rünger's model.
682 Indeed, there are two reasons explaining these differences in the energy consumptions. The first one is related to the dynamic power consumption, where the new energy model ensures that this power metric is consumed only during the computation time, while the other model assumes to consume the dynamic power during both computation and communication times and thus more dynamic energy consumption is given.
683 The second one is related to the execution time, that is only its computation times is increased with the
684 scaling factor value in the new energy model, while other energy model indicates that both the
685 computation and communication times are increased with scaling factor and hence more static energy consumption is given. Therefore, the MPI programs that have big communication times, they have bigger measured energy consumption values using Rauber and Rünger's model compare to the new model as in CG, SP, LU and FT benchmarks. Whereas, if the MPI programs have very small communication times, their computed energy values have very small differences such as in MG and BT benchmarks, or they are identical such as in EP benchmark where there is no communication and no idle times.
690 \includegraphics[width=.7\textwidth]{fig/ch2/energy_con.eps}
691 \caption{Comparing the energy consumptions measured using the new and Rauber energy models}
692 \label{fig:energy_con}
696 \begin{tabular}{|l|l|l|l|l|l|l|}
698 \multicolumn{1}{|c|}{\multirow{2}{*}{\begin{tabular}[c]{@{}c@{}}Method\\ Name\end{tabular}}} & \multicolumn{3}{c|}{Rauber Energy Model Results} & \multicolumn{3}{c|}{New Energy Model Results} \\ \cline{2-7}
699 \multicolumn{1}{|c|}{} & \begin{tabular}[c]{@{}l@{}}Scaling\\ Factors\end{tabular} & \begin{tabular}[c]{@{}l@{}}Energy \\ Saving\%\end{tabular} & \begin{tabular}[c]{@{}l@{}}Performance\\ Degradation\%\end{tabular} & \begin{tabular}[c]{@{}l@{}}Scaling\\ Factors\end{tabular} & \begin{tabular}[c]{@{}l@{}}Energy \\ Saving\%\end{tabular} & \begin{tabular}[c]{@{}l@{}}Performance\\ Degradation\%\end{tabular} \\ \hline
701 CG & 1.56 & 39.23 & 14.88 & 1.47 & 30.20 & 13.56 \\ \hline
702 MG & 1.47 & 34.97 & 21.69 & 1.38 & 30.04 & 16.48 \\ \hline
703 EP & 1.04 & 22.14 & 20.73 & 1.04 & 22.14 & 20.73 \\ \hline
704 LU & 1.38 & 35.83 & 22.49 & 1.31 & 29.15 & 18.03 \\ \hline
705 BT & 1.31 & 29.60 & 21.53 & 1.31 & 28.75 & 21.55 \\ \hline
706 SP & 1.38 & 33.48 & 21.35 & 1.31 & 28.93 & 14.83 \\ \hline
707 FT & 1.47 & 34.72 & 19.00 & 1.38 & 29.94 & 17.43 \\ \hline
709 \caption{The Results of NAS Parallel Benchmarks running on 16 nodes}
710 \label{table:new-res}
713 Table \ref{table:new-res} shows results of energy saving and performance degradation percentages of applying the frequency selecting algorithm using the new propose energy model. It also presents the new selected frequency scaling factor values and comparing them to ones use Rauber and Rünger's model. It indicates that the new selected frequency scaling factors are smaller compared to those selected using other model because the predicted energies by the new energy model are smaller.
714 Consequentially, less energy savings and performance degradation percentages are produced according to
715 these smaller frequency scaling factors selected using the new energy model, such as in CG, MG, LU, SP and FT benchmarks. While in BT and EP benchmarks where a very small or no communication times, similar scaling factors are selected because the predicted energies by the two models are approximately equivalent.
716 On the other hand, the scaling factor selection algorithm can work with any energy model and it selects proportionally the scaling factor values depending on the predicted energies values.
718 As a results, the new proposed energy model is more accurate than Rauber and Rünger's energy
719 model, because it takes into consideration both the communication and idle times in addition to
720 the computation times of MPI programs running over homogeneous clusters.
724 In this chapter, a new online scaling factor selection method
725 that optimizes simultaneously the energy and performance of a distributed
726 application running on a homogeneous cluster have been presented . It uses the computation and
727 communication times measured at the first iteration to predict the energy
728 consumption and the performance of the parallel application at every available
729 frequency. Then, it selects the scaling factor that gives the best trade-off
730 between energy reduction and performance which is the maximum distance between
731 the energy and the performance curves. To evaluate this method, we
732 have applied it to the NAS benchmarks and it was compared to Rauber and Rünger
733 methods while being executed on the SimGrid simulator. The results showed that
734 our method, outperforms Rauber and Rünger's methods in terms of energy-performance
735 ratio. Finally, this chapter presents a new energy consumption model for the parallel
736 synchronous iterative methods running on homogeneous clusters. This model takes into consideration
737 both the computation and communication times and them relation with the frequency scaling
738 factor. The results obtained using the new energy model have shown selecting different frequency scaling factors than using other energy model and thus different experimental results have been produced.