• No se han encontrado resultados

3. DISEÑO METODOLÓGICO

3.4 Fase de codificación

In order to completely evaluate the performance impact of the correlation between a runtime process and a parallelism process on parallel systems, an ecient approach 1We use the words “locality” and “correlation” to indicate the phenomenon of temporal locality

80 Chapter 7. Performance Impact of Runtime and Parallelism on Scheduling

that is able to control its degree on demand is required. We propose in this section such an approach with the idea illustrated in Figure 7.1. Each row of circles/squares in the gure represents one stochastic process that can be a runtime or parallelism process. Assume the two processes in Figure 7.1 exhibit a correlation, we decrease this correlation in two steps. Firstly, we select randomly a number of elements from one process, and secondly permute them. Although there exists a correlation between the selected elements and their partners2before the permutation, this correlation will be lost after they are randomly permuted. Consequently, the total correlation between the two processes decreases.

Figure 7.1: Illustration of controlling correlation.

Our approach is implemented by a procedure, namedControl_Correlation, pre- sented in Algorithm 3. The procedure receives a runtime process{Ri}, a parallelism

process {Pi} and a list of m parameters dj, j = 1, . . . , m as its inputs. The value

of dj ranges from 1 to +1, where |dj| indicates which percentage of elements is

randomly selected and kept unchanged (i.e., not permuted) and the sign ofdj indi-

cates a positive/negative correlation, respectively. For example, if the two processes 2In Figure 7.1, each element in one process will associate with one element of the other pro-

cess, showing by either a continuous or discrete two-direction arrow. We use the words “partner” and “partnership” to indicate the associated element and the association between two elements, respectively.

7.1. Control Correlation 81

in Figure 7.1 exhibit a negative correlation, we havedj=0.6because 60% elements

are not permuted. The outputs of the procedure consist of m new parallelism pro- cesses{Pij}, j= 1, . . . , m. Each{Pij}associates with{Ri}to yield a correlation that

corresponds todj.

Algorithm 3ProcedureControl Correlation.

Input: a runtime process{Ri}, a parallelism process{Pi}and a list ofmparam- etersdj, j= 1, . . . , m.

Output: mnew parallelism processes{Pij}, j= 1, . . . , m.

// Maximize the correlation

{R0

i}=sort({Ri},0ascend0); {P pi}=sort({Pi},0ascend0); {P ni}=sort({Pi},0descend0);

// To assure that locality is not affected

Rearrange{R0

i} to{Ri}while fixing its partnerships with{P pi}and{P ni};

// Generate mparallelism processes and tune correlation

forj= 1 tomdo if dj 0then {Pij} = PERMUTATION({P pi},1−dj); else {Pij} = PERMUTATION({P ni},1 +dj); end if end for function{Yi}= PERMUTATION({Xi}, z)

// Calculate number of elements in{Xi} to be permuted

N=round(z×length({Xi}));

Randomly selectN elements in{Xi} and permute them to form a new process as shown in Figure 7.1;

Assign the new process to{Yi};

end

The procedure tunes a correlation via 3 steps. Since our approach can only reduce the degree of correlation, the procedure as the rst step needs to maximize it to achieve a maximal positive/negative correlation3. As presented in Section 2.3.2, we 3In theory when a correlation reaches the maximal threshold, the correlation coefficient reaches

±1. The Spearman’s rank correlation coefficient can only obtain±1 in case there are no tied ranks, i.e., elements of a stochastic process must have distinguish values so that they do not have the same ranks [60, 75]. However, tied ranks exist in real runtime and parallelism processes due to repeated data values. Therefore, the maximal correlation that can be achieved in practice is often only approximately equal to +/−1, which is refered as a maximal positive/negative correlation, respectively.

82 Chapter 7. Performance Impact of Runtime and Parallelism on Scheduling

use Spearman's approach which is based on data ranks instead of the data itself to calculate a correlation coecient. Hence to maximize the correlation coecient, we sort {Ri} in an ascending order to form {R0i} and sort {Pi} in ascending and

descending orders to form {P pi}and {P ni}, respectively. Consequently, we achieve

a maximal positive correlation between {R0

i} and {P pi}, and a maximal negative

correlation between {R0

i} and {P ni}. As the second step, we rearrange {R0i} to

{Ri} since our purpose is to keep the input runtime process unchanged to ensure

the procedure will not aect locality. In this rearrangement, we keep the partnerships between elements of{R0

i}and elements of{P pi}and{P ni}unchanged, i.e., whenever

we swap 2 elements of{R0

i}, we also swap their partners in{P pi} and{P ni}. After

the rearrangement, {R0

i} turns back to {Ri} which now has maximal positive and

negative correlations with{P pi} and{P ni}, respectively.

As the last step after maximizing the correlation, we control its degree by calling the function PERMUTATION. This function works as explained in Figure 7.1, which is described in the rst paragraph of this section. The procedure can be used to create several correlations with dierent degrees on demand by specifying a list of parameters

{dj}. The advantage of the procedure is that it yields many{Pij}but does not aect

{Ri}. This means that though the degree of correlation changes, the degree of locality

is kept unchanged. Thus, when evaluating the performance impact of correlation, we can avoid its potential interdependent impact with locality on results.

−1 −0.6 −0.2 0.2 0.6 1 −1 −0.6 −0.2 0.2 0.6 1 Parameters d Correlation

Figure 7.2: The relationship between correlation anddj, shown for the trace HPC.

The last problem we address in this section is the meaning of the list of parameters

{dj}. As explained above,|dj|indicates which percentage of elements in a stochastic

process is kept unchanged by the PERMUTATION function, and the sign ofdj indi-

cates a positive/negative correlation. However, we would like to know whetherdj has

any relation with the degree of correlation. To check this, we do an experiment by applying the procedureControl_Correlationon the runtime and the parallelism pro-

7.1. Control Correlation 83

cesses of the trace HPC with the list of parameters{dj}={−1,−0.9,−0.8, . . . ,+0.8,

+0.9,+1}. Interestingly, the result in Figure 7.2, which draws the Spearman's cor- relation as a function ofdj, shows that there exists a linear relationship betweendj

and the degree of correlation. When tting the line in Figure 7.2, we nd that its slope is approximately equal to the maximal correlation that HPC can obtain via the rst step of the procedure Control_Correlation: | ±0.95|. In other words, the line is of the formCorrelation=|M axCor| ×dj, whereM axCoris the maximal correla-

tion obtained in the rst step of the procedure. As such, when the possible maximal correlation of a trace reaches ±1, we can consider dj as the degree of correlation.

Mathematically, this consequence can be proven as follows. Given two N-element stochastic processesX andY which exhibit a maximal correlationM axCor. With a parameterdj [1,+1], we select elements randomly to divideX,Y correspondingly

into [(1− |dj|)×N]-element processesX1, Y1 and [|dj| ×N]-element processes X2, Y2. In statistics,X1,X2are considered two samples of the populationX, andY1,Y2 are two samples of the populationY. As such, we have4

µX1 'µX2'µX andµY1 'µY2 'µY,

σX1'σX2'σX andσY1'σY2'σY,

ρX1,Y1 'ρX2,Y2'ρX,Y =M axCor,

whereµ,σandρare the mean, the standard deviation and the correlation coecient, respectively. Now assume we randomly permute Y1 as in Figure 7.1, X1 and Y1, hence, become uncorrelated and ρX1,Y1 reduces from M axCor to approximately 0.

The correlation ρX2,Y2 between X2 and Y2 is still M axCor while the correlation

betweenX andY is reduced to

ρX,Y = E[(X−µX)(Y −µY)] σXσY = Σ(X−µX)(Y −µY) N σXσY = Σ(X1−µX)(Y1−µY) N σXσY + Σ(X2−µX)(Y2−µY) N σXσY ' (1− |dj|)Σ(X1−µX1)(Y1−µY1) (1− |dj|)N σX1σY1 +|dj|Σ(X2−µX2)(Y2−µY2) |dj|N σX2σY2 = (1− |dj|)E[(X1−µX1)(Y1−µY1)] σX1σY1 +|dj|E[(X2−µX2)(Y2−µY2)] σX2σY2 = (1− |dj|)ρX1,Y1+|dj|ρX2,Y2 ' |dj| ×M axCor=|M axCor| ×dj.

4In statistics, when the size of a sample is large enough, the sample can be used to estimate

statistical properties of its population such as mean, standard deviation, etc. In other words, these statistical properties of the sample are approximately equal to those of its population. In our study, each trace contains up to ten thousands of jobs, and hence the statistical properties of the sample are accurate estimators for the properties of the population.

84 Chapter 7. Performance Impact of Runtime and Parallelism on Scheduling

The above proof concludes that our procedure can adjust accurately the degree of correlation on demand by specifying the requested degree viadj.

Documento similar