• 沒有找到結果。

Bootstrap Monte Carlo with adaptive stratification for power estimation

N/A
N/A
Protected

Academic year: 2021

Share "Bootstrap Monte Carlo with adaptive stratification for power estimation"

Copied!
18
0
0

加載中.... (立即查看全文)

全文

(1)

World Scientific Publishing Company

BOOTSTRAP MONTE CARLO WITH

ADAPTIVE STRATIFICATION FOR POWER ESTIMATION

HENG-LIANG HUANG∗and JING-YANG JOU†

Department of Electronic Engineering, National Chiao-Tung University, 1001 Da-Hsueh Road, HsinChu, Taiwan, 30050, ROC

[email protected][email protected]

Received 15 April 2002 Accepted 27 June 2002

Monte Carlo approach for power estimation is based on the assumption that the samples of power are Normally distributed. However, the power distribution of a circuit is not always Normal in the real world. In this paper, the Bootstrap method is adopted to ad-just the confidence interval and redeem the deficiency of the conventional Monte Carlo method. Besides, a new input sequence stratification technique for power estimation is proposed. The proposed technique utilizes a multiple regression method to compute the coefficient matrix of the indicator function for stratification. This new stratifica-tion technique can adaptively update the coefficient matrix and keep the populastratifica-tion of input vectors in a better stratification status. The experimental results demonstrate that the proposed Bootstrap Monte Carlo method with adaptive stratification can effec-tively reduce the simulation time and meet the user-specified confidence level and error level.

Keywords: Power characterization; adaptive stratification; Monte Carlo; Bootstrap.

1. Introduction

With the increasing size of design blocks, the number of input vectors required for estimating the power consumption of a circuit is growing exponentially. In the meantime, the time needed for simulating each input vector increases rapidly with the growing complexity of circuits. In previous literatures, methods for shortening the time required for power estimation can be classified into two categories. One is to generate a shorter input sequence, and the other is to sample a small portion of the input vectors from the original sequence. To regenerate an input sequence that has the similar average power as that of the original input sequence, some fea-tures of the original sequence need to be preserved while regenerating the shorter one. These features include preserving the pattern transition probabilities,1 preserv-ing the spatial-temporal correlations for all inputs,2 and preserving the significant correlations between the clustered inputs.3 Regenerating a compact input sequence sounds easy. However, the compact input sequence can only be generated according

333

J CIRCUIT SYST COMP 2002.11:333-350. Downloaded from www.worldscientific.com

(2)

to a user-specified compaction ratio, which users usually do not know the proper value.

The Monte Carlo approach for power estimation is proposed by F. Najm.4The method estimates the average power by sampling the input vectors with certain length l from the original sequence and fed them into the simulator to derive a sample value of the average power. The average power consumption can be es-timated with the average of several sample values. From Central Limit Theorem (CLT ), the sample values can be presumed as a Normal distribution when l ap-proaches infinity. The probability that the estimated mean is within a certain error range of the real mean can also be derived under the assumption. However, the required l to preserve the normality of x is not discussed. If x is far from a Normal distribution, the basis of the Monte Carlo method fails and the estimated power may have a larger error level than expected.

Bootstrap theory is a resampling technique that will generate Bootstrap Samples by picking the sample data with replacement and report a Bootstrap confidence interval without assuming any parameter of the distribution.5 This is also known as nonparametric Bootstrap resampling. By adopting the Bootstrap technique, this paper develops a way to calculate a more accurate confidence level to assure that the user specified confidence level would not be violated in Monte Carlo simulation. Although the Monte Carlo method can achieve acceptable input sequence com-paction ratio generally, it suffers severe degradation as dealing with power his-tograms like bi-modal or multi-modal.4 For Monte Carlo approach, large sample variance means large number of samples required for the estimation to converge to the real value. The stratification method on the original input sequence is proposed to minimize the sample variance and the probability of generating the pre-matured samples.7According to the method, a gate level power model is required for roughly estimating the power consumption of the original input sequence on a zero-delay logic simulator. The zero-delay gate-level power consumption is used as an indica-tor of the circuit-level power consumption. With this indicaindica-tor, the original input sequence can be partitioned into strata, within which the input vectors are with similar power consumptions such that the samples sampled from these strata can have a smaller sample variance. However, the gate level net-list sometimes needs to be concealed especially when they are the intellectual property (IP). In this paper, a novel input sequence stratification technique is proposed. It utilizes the multiple regression method on the sampled input vectors to find the weighting of each in-put transition, which can be used in the power indicator function for stratification. The proposed technique can restratify the original input sequence according to the updated samples, and keep the sample variance the smallest.

The following parts of this paper are organized as follows. In Sec. 2, some essen-tial definitions and basis for this paper are introduced. Section 3 details the concepts of the Bootstrap Monte Carlo method and demonstrates its efficiency. In Sec. 4, the proposed adaptive stratification technique with multiple regression method is pre-sented. The flow of the Bootstrap Monte Carlo method combined with the adaptive

J CIRCUIT SYST COMP 2002.11:333-350. Downloaded from www.worldscientific.com

(3)

stratification technique is shown and evaluated in Sec. 4 also. Section 5 concludes this paper.

2. Preliminary

2.1. Normal distribution and Gaussian distribution 2.1.1. Normal random variable

A random variable (RV) x is Normally distributed with mean µx, and standard deviation σx if its probability density function (denoted as p.d.f.) equals:

f (x) = 1 σx

√ 2πe

−(x−µx)2/2σx2. (1)

2.1.2. Gaussian (Standard Normal ) random variable A RV y is Gaussian if its p.d.f. equals:

g(y) = √1 2πe

−y2/2

. (2)

2.1.3. Cumulative distribution function (c.d.f.) of Gaussian

The probability of a Gaussian RV y smaller than an arbitrary value y is defined as: G(y) = P{y ≤ y} = Z y −∞ 1 √ 2πe −ξ2/2 dξ . (3) 2.1.4. α-percentile of Gaussian

The α-percentile of Gaussian is denoted as zα and expressed as:

zα= G−1(α) , 0≤ α ≤ 1 . (4)

Note that the p.d.f. of the Gaussian RV is an even function, therefore zα=−z1−α, and z0.5= 0.

2.1.5. Sample mean and sample variance

Let{xi, i = 1, 2, . . . , n} be n randomly sampled elements out of a population with an arbitrary distribution, the sample mean is defined as the arithmetic average of these n samples ¯ x = 1 n n X i=1 xi. (5)

The sample variance s2 is defined as: s2= 1 n− 1 n X i=1 (xi− ¯x)2. (6)

J CIRCUIT SYST COMP 2002.11:333-350. Downloaded from www.worldscientific.com

(4)

2.2. Monte Carlo method

The power consumption of a CMOS circuit is dominated by charging and discharg-ing of the load capacitances at each gate output. The average power consumption can thus be defined as a function in terms of successive input patterns:

µx=

NX−1

j=0

Power(Vj)

N , (7)

where µx is the average power consumption, N is the number of input patterns, and Power(Vj) is the power measured when the primary inputs are transiting from the the jth pattern to the (j + 1)th pattern. The definition of Vj will be detailed in Sec. 4.

Let pwr be the RV defined on a sample space containing all Power(Vj). The average of l values of pwr is called a random sample, x, whose sample mean ap-proaches the desired average power, µx, and can be expressed as:

x = 1 l l X i=1 pwri, (8)

where pwri is a value of the RV pwr. According to the Central Limit Theorem (CLT ), the RV x has a distribution close to Normal for large l.8

To estimate the µx in Eq. (7) without simulating all input vectors, the Monte Carlo approach for power estimation can help. Let ¯x and s2 be the sample mean and sample variance of x, respectively. From Eqs. (4)–(6), the following results can be derived: P µx− ¯x ¯ x ≤ rel err= 1− 2α , 0≤ α ≤ 0.5 ,

where rel err= z1−αs

¯ x√n .

(9)

The rel err stands for the related error level, α is the confidence level, and n is the number of samples of x. Equation (9) means that the user can have a confidence level of 1 – 2α about the claim that the error between the real mean µx and the sample mean ¯x is smaller than the related error level. If the related error level rel err is larger than the user specified error level ε, one or more samples of x should be picked and the sample mean and rel err are evaluated again. The procedure is iterated until the user-specified error level ε is satisfied.

2.3. Bootstrap6

2.3.1. Bootstrap Replication

Let x be the RV defined as the samples from an arbitrary distribution:

x ={xi|1 ≤ i ≤ n} . (10)

J CIRCUIT SYST COMP 2002.11:333-350. Downloaded from www.worldscientific.com

(5)

Let x∗ be the RV defined as the random samples of x with replacement for each xi with equal probability, 1/n:

x∗={x∗i|1 ≤ i ≤ n , x∗i ∈ x} . (11) The Bootstrap Replication b of ¯x is defined as the mean of x∗:

b = ( bk bk= 1 n n X i=1 x∗i, 1≤ k ≤ nb ) , (12)

where nb is the number of Bootstrap Replications. 2.3.2. Sorted Bootstrap Replications

Let the RV B stands for the sorted Bootstrap Replications and defined as:

B ={Bk|Bk ∈ b ; Bi≤ Bj if i < j ; 1≤ i, j, k ≤ nb} . (13) 2.3.3. Cumulative distribution function (c.d.f.) of B

The probability that the RV B is smaller than an arbitrary value b is defined as: GB(b) = P{B ≤ b} =  kb nb Bi≤ b , 1 ≤ i ≤ kb  . (14) 2.3.4. α-percentile of Bootstrap

The α-Bootstrap percentile is defined as:

θα= GB−1(α) , 0≤ α ≤ 1 . (15)

2.3.5. Percentile confidence interval of Bootstrap

There are several ways of calculating confidence intervals of the Bootstrap Replica-tions. The most straightforward one for the 1− 2α Bootstrap confidence interval is the percentile Bootstrap confidence interval, and is defined as the interval that can cover (1− 2α)∗nb Bootstrap Replications:

[θ%,lo, θ%,up] = [GB−1(α), GB−1(1− α)] , 0≤ α ≤ 0.5 . (16) 2.3.6. Bias-Corrected and accelerated (BCa) confidence interval

The BCa confidence intervals are complicated to describe but are as easy to use as the percentile confidence interval5:

[θBCa,lo, θBCa,up] = [GB−1(α1), GB−1(α2)] , α1= G  ˆ z0+ ˆ z0+ zα 1− ˆa(ˆz0+ zα)  , α2= G  ˆ z0+ ˆ z0+ z1−α 1− ˆa(ˆz0+ z1−α)  . (17)

J CIRCUIT SYST COMP 2002.11:333-350. Downloaded from www.worldscientific.com

(6)

The ˆz0 is designated as the Bias-Correction coefficient. It is simply derived from the portion of Bootstrap Replications that are smaller than ¯x (the sample mean of x): ˆ z0= G−1  #{b < ¯x} nb  , (18)

where the #{b < ¯x} is the number of Bootstrap Replications that are smaller than ¯x. The ˆa is designated as the Acceleration coefficient. Before defining ˆa, the definition of the Jacknife value, J(i), of ¯x is defined as:

J(i)=   J(i) J(i) = 1 n− 1    Xn j=1 xj   − xi   , 1 ≤ i ≤ n   . (19)

The mean of J(i) designate as J(·) is defined as: J(·)= 1 n n X j=1 J(i). (20)

The Acceleration coefficient is then defined as: ˆ a = Xn i=1(J(·)− J(i)) 3 6×nXn i=1(J(·)− J(i)) 2o3/2 . (21)

The BCa Bootstrap estimation of µx is defined as the 0.5-percentile of the distri-bution of BCa Bootstrap Replications:

¯ xBCa= GB−1  ˆ z0+ ˆ z0+ z0.5 1− ˆa(ˆz0+ z0.5)  = GB−1  ˆ z0+ ˆ z0 1− ˆaˆz0  . (22)

The Bias-Correction coefficient ˆz0is designed to compensate the difference between ¯

x and the BCa mean ¯xBCa. If the difference between them equals zero, ˆz0 equals zero also. As for the Acceleration coefficient, it refers to the rate of change of the standard error of ¯x with respect to ¯x, measured on a normalized scale.6The larger it is, the wider is the confidence interval. Detail discussion about how this acceleration coefficient works is referred to the references.5For a Normally distributed ¯x, the ˆz0 and ˆa are both zero, and α1= α2= α. The BCa confidence interval is exactly the same as standard confidence interval.

3. Bootstrap Monte Carlo Simulation 3.1. Bootstrap confidence level

For conventional Monte Carlo, the confidence interval and the rel err are calculated with Eq. (9), in which the rel err totally relies on the assumption that the distri-bution of ¯x is Normal. The possibility that the distribution of ¯x might be skewed

J CIRCUIT SYST COMP 2002.11:333-350. Downloaded from www.worldscientific.com

(7)

or platykurtic is ignored. Bootstrap technique, can be used to adjust the confidence level when the normality of the population is poor.

For a given error level, ε, the acceptable range for the real mean µxis defined as: [Alo, Aup] = [(1− ε)MAX(¯x, ¯xBCa), (1 + ε)MIN(¯x, ¯xBCa)] . (23) The acceptable range covers the safe range into which the real mean µx can land without violating the user specified error level ε, with respect to either ¯x or ¯xBCa. And then, the Bootstrap Confidence Level is defined with:

αBCa= GB(Alo) + 1− GB(Aup) . (24)

3.2. Bootstrap Monte Carlo method

With the αBCafrom Eq. (24), whether the user specified confidence level is guaran-teed or not, can be easily determined. The proposed Bootstrap Monte Carlo (BMC ) method is demonstrated with the pseudo-codes in Fig. 1.

Bootstrap Monte Carlo ( )

Pwr, ε, α; /∗Conventional Monte Carlo parameters∗/ nb; /∗Bootstrap parameter∗/

{

nSamples = 1; rel err = 1; #Boot = 0; zα= G−1(α);

while (rel err≥ ε) { nSamples++;

get new sample xnfrom Pwr;

update sample mean ¯x and sample variance s2; update rel err;

if (rel err≤ ε) {

Generate nb Bootstrap Replications b from x; Calculate αBCa from b;

#Boot++; if (αBCa> 2∗α){ rel err= 1; } } }

return nSamples, nBoot, and ¯x; }

Fig. 1. Pseudo code of BMC.

3.3. Bootstrap Monte Carlo versus conventional Monte Carlo

The proposed BMC method is tested with estimating the average powers of the ISCAS-85 benchmark circuits. There are 10 000 input vectors in the input sequence for each circuit. The input sequence is a compound of three segments: a counter

J CIRCUIT SYST COMP 2002.11:333-350. Downloaded from www.worldscientific.com

(8)

sequence, a LFSR sequence and a sequence of pseudo random numbers. Note that half of the input vectors in the counter sequence have only single input change, therefore consumes less power. The LFSR sequence represents the input vectors with temporal correlations. The pseudo random input vectors, on the other hand, are spatially and temporally independent. The arrangement of the input sequence is to give the estimator a tough situation because the power histogram of such an input sequence is most likely to be skewed, long tailed and platykurtic at the same time. Besides the ISCAS-85 benchmarks, an additional circuit, add mpr, is included. It is a circuit with a mode controlling input that controls the function of the circuit to be an adder or a multiplier. The power histogram of it is a typical bimodal distribution. The experimental results are listed in Tables 1 to 3.

Table 1. MC versus BMC with α = 0.05.

M C BM C

Circuit

viol r nVecs viol r nVecs #Boot C432 0.1235 1538.51 0.0949 1786.97 14.4926 C499 0.1164 585.86 0.1050 629.34 2.9860 C880 0.1218 616.24 0.1010 663.19 3.1880 C1355 0.1145 633.05 0.1005 682.92 3.2847 C1908 0.1194 908.35 0.1004 996.04 5.4834 C3540 0.1586 154.90 0.1563 156.16 1.0405 C6288 0.1259 1344.78 0.1014 1532.66 11.0338 add mpr 0.1384 281.35 0.1288 288.27 1.2202 Max 0.1586 1538.51 0.1563 1786.97 14.4926 Avg 0.1273 757.88 0.1110 841.94 5.3412

Table 2. MC versus BMC with α = 0.025.

M C BM C

Circuit

viol r nVecs viol r nVecs #Boot C432 0.0748 2055.63 0.0487 2504.36 25.7884 C499 0.0591 820.55 0.0497 886.94 4.4027 C880 0.0611 862.70 0.0497 935.03 4.7865 C1355 0.0594 884.39 0.0499 961.19 4.9675 C1908 0.0653 1248.65 0.0525 1397.90 9.0968 C3540 0.0832 230.54 0.0810 232.59 1.0764 C6288 0.0710 1812.33 0.0485 2150.83 19.6258 add mpr 0.0688 408.67 0.0627 421.19 1.5073 Max 0.0832 2055.63 0.0810 2504.36 25.7884 Avg 0.0678 1040.43 0.0553 1186.25 8.9064

J CIRCUIT SYST COMP 2002.11:333-350. Downloaded from www.worldscientific.com

(9)

Table 3. MC versus BMC with α = 0.005.

M C BM C

Circuit

viol r nVecs viol r nVecs #Boot C432 0.0266 3089.78 0.0092 4145.60 59.5692 C499 0.0163 1345.06 0.0115 1480.03 8.3435 C880 0.0179 1408.56 0.0111 1558.86 9.2150 C1355 0.0180 1442.10 0.0138 1600.27 9.6379 C1908 0.0198 1980.65 0.0121 2322.61 19.8780 C3540 0.0160 409.03 0.0146 416.39 1.3426 C6288 0.0238 2768.35 0.0105 3561.91 44.9796 add mpr 0.0130 700.62 0.0111 728.20 2.9168 Max 0.0266 3089.78 0.0146 4145.6 59.5692 Avg 0.0189 1643.02 0.0117 1976.73 19.4853

Tables 1 to 3 are the results for α equals 0.05, 0.025 and 0.005, respectively. The corresponding confidence levels are 90%, 95% and 99%. For each α, there are results for every circuit with both conventional Monte Carlo method (MC ) and the proposed Bootstrap Monte Carlo method (BMC ). Each method is performed 10 000 times for each circuit to estimate their average power consumption. The error level ε is set to 0.05. If the error percentage of the estimated power exceed ε, the number of violations is increased by 1. The viol r columns are the violation ratio defined as the number of violations divided by the number of Monte Carlo simulations:

viol r = #  ¯ x− µx µx > ε  10 000 . (25)

The nVecs columns contain the numbers of input vectors sampled by the cor-responding estimation methods. For a good estimation method, the viol r should be close to and always smaller than 2∗α. For two estimation methods with the same viol r, the one with smaller nVecs is the better one. There is one additional #Boot column for BMC. It is the average number of times that Bootstrap process being invoked for a BMC estimation. It is roughly in proportion to the number of additional samples required for BMC. With a larger #Boot, the overhead of using Bootstrap is greater. For the circuits that the viol r of MC exceed 2∗α, the #Boot for BMC is supposed to be larger to keep the viol r of BMC within 2∗α safe range. As demonstrated in the tables, the viol r for conventional Monte Carlo method exceeds 2∗α in all 24 cases. On the other hand, with the Bootstrap method monitor-ing confidence level in BMC, the viol r are either under or close to the 2∗α, except for two cases: C3540 and add mpr. One thing needs to be emphasized is that the nVecs for C3540 and add mpr are the two smallest ones among all circuits. If the number of samples is too small to represent the original population, e.g. pre-matured sam-ples, BMC might sometimes fail to keep the viol r within 2∗α. This is because the

J CIRCUIT SYST COMP 2002.11:333-350. Downloaded from www.worldscientific.com

(10)

Bootstrap method produces its Bootstrap Replications from the samples of Monte Carlo. This drawback will be discussed and eliminated with the newly proposed method Bootstrap Monte Carlo with Adaptive Stratification method (BMCAS ) in the following section. Regardless of this deficiency, the proposed Bootstrap Monte Carlo method is more trustable than conventional Monte Carlo method with about 10% increasing in nVecs.

4. Adaptive Stratified Random Sampling

Stratification is a technique to divide the sample space into subspaces to reduce the sample variance so that the Monte Carlo can converge sooner with smaller number of samples, n, and achieve better compaction ratio. An indicator function for stratification is a function that returns a value closely related to or even equals the power consumption of input vectors. To build an indicator function, the multiple regression method is adopted.

4.1. Single variable linear regression10

Given a collection of n data points of two variables x and y:

(x, y) ={(xi, yi)|1 ≤ i ≤ n} . (26) The best line describing the relation between x and y is defined as:

ˆ y = ax + b , a = E[xy]− E[x]E[y] E[xx]− E[x]E[x], b = E[y]− aE[x] , (27)

where E[ ] is the function of expected value, and ˆy is the predictor of y. This predictor is the one with zero bias and minimum RMS error.

4.2. Multiple regression10

Multiple regression is simply an extension of the single variable linear regression. Given n data points of m + 1 variables:

(X, y) ={[x1, x2, . . . , xm], y}

={{[x1,i, x2,i, . . . , xm,i], yi}|1 ≤ i ≤ n} . (28) Note that X is a row matrix stands for the x variables. The best function describing the relation between X and y is defined as:

J CIRCUIT SYST COMP 2002.11:333-350. Downloaded from www.worldscientific.com

(11)

ˆ

y = XA + b ,

C = E[Xy]− E[X]E[y] , D = E[XTX]− E[X]TE[X] , A = D−1CT,

b = E[y]− E[X]A ,

(29)

where A is a column matrix that contains the coefficients for each x1, . . . , xm. Note that the order of X and A are switched to make the product of them a scalar.

4.3. Variable selection

As we can see in Eq. (29) that deriving the coefficient matrix A includes a matrix inverse operation on matrix D. If matrix D were singular, the equation of mea-suring the coefficient matrix A would fail. To prevent this, the basic assumptions of Multiple Regression need to be taken into consideration while selecting the x variables.

Assumption 1: The relation between y and xi is linear.

The y variable in power estimation is the power consumption of each input vec-tor. The power consumption of CMOS circuits is dominated by the dynamic power. The dynamic power is consumed when the inputs of the circuits are switching. In other words, more input switching implies that more dynamic power is consumed. This makes the switching conditions of the primary inputs good candidates for the x variables.

Assumption 2: The xi variables are mutually independent.

For a primary input, there are four possible transitions between two consecutive clock cycles: 0 to 0, 0 to 1, 1 to 0, and 1 to 1.

Let the Boolean value for the ith input in the jth clock cycle be denoted as bji, the input pattern in the jth clock cycle is defined as:

P atj={bji|b j

i ∈ {0, 1}, 1 ≤ i ≤ n in, 0 ≤ j ≤ N} , (30) where n in stands for the number of primary inputs, and N stands for the total number of input vectors. The jth input vector is defined as two consecutive input patterns:

Vj={(P atj, P atj+1)|0 ≤ j ≤ N − 1} . (31) There are four transition variables designated for the transition behavior of each input: T(i, Vj) ={T k(i, Vj)|0 ≤ k ≤ 3, 1 ≤ i ≤ n in, 0 ≤ j ≤ N − 1} , where Tk(i, Vj) =  1, if k = 2× bji+ bj+1i , 0, otherwise . (32)

J CIRCUIT SYST COMP 2002.11:333-350. Downloaded from www.worldscientific.com

(12)

For an input i and input vector Vj, one and only one of the four transitions can take place. This makes the four transition variables mutually dependent:

T0(i, Vj) + T1(i, Vj) + T2(i, Vj) + T3(i, Vj) = 1 . (33) Therefore, at most three out of the four transition variables need to be chosen as the x variables for multiple regression. In this paper, T0, T1 and T2 are selected. Note that, any combination of three chosen transition variables will not lose their generality because the removed one can always be derived from the others.

After choosing the X variables for Eq. (29), it can be rewritten in the form of constructing the predictor for the power consumption of each input vector. Let the power consumption of each input vector indicated by the indicator function be:

ˆ

P ower(V) = X(V)A + b ,

X(V) ={[T0(i, V), T1(i, V), T2(i, V)]|1 ≤ i ≤ n in} ,

(34)

where V is the set of all input vectors. In the same manner, the coefficient matrix A can be derived from the multiple regression equations:

C = E[X(W)P wr(W)]− E[X(W)]E[P wr(W)] , D = E[X(W)TX(W)]− E[X(W)]TE[X(W)] , A = D−1CT,

b = E[P wr(W)]− E[X(W)]A ,

(35)

where W is the set of sampled input vectors and Pwr(W) are their corresponding power consumption measured with simulator.

4.4. BMC with adaptive stratification (BMCAS )

With the coefficient matrix A and Eq. (34), the population can be stratified into a certain number of strata. Initially, the population is not stratified, and the first few samples xi’s are randomly sampled. After the number of sampled input vectors is larger than a predefined threshold, the Multiple Regression function is invoked to derive A. The ˆP ower(V) is calculated with Eq. (34) and the stratification pro-cess starts. Hence, the stratified random sampling propro-cess takes over the place of random sampling. After some other new input vectors are sampled, the Multiple Regression process is executed again to recalculate a better A for re-stratification. The pseudo code for the proposed Bootstrap Monte Carlo with Adaptive Stratifica-tion (BMCAS ) is depicted in Fig. 2.

The reason of starting multiple regression after the number of W larger than 9∗n in is to prevent too many empty elements in matrix D which might lead to a singular matrix for the matrix inverse operation. The keep sampling variable is an insurance to prevent the Bootstrap Monte Carlo failure caused by the premature

J CIRCUIT SYST COMP 2002.11:333-350. Downloaded from www.worldscientific.com

(13)

Bootstrap Monte Carlo with Adaptive Stratification ( ) Pwr, ε, α; /∗Conventional Monte Carlo parameters∗/ nb; /∗Bootstrap parameter∗/

{

nSamples = 0; rel err = 1; nRestrat = 0; keep sampling = 0; W ={∅}; S = {∅}; V = {Vi|1 ≤ i ≤ N}

zα= G−1(α);

while (rel err≥ ε) {

nSamples++; if (stratified)

Sample input vectors v from V with stratified sampling; else

Sampled input vectors v from V with random sampling; S = S∪ v; W = W ∪ v;

Get y = P ower(v); from simulator; y = y∪ y;

if (keep sampling){

keep sampling–; rel err = 1; continue; } else {

update ¯x, s2, and rel err; }

if (rel err≥ ε) { if (#(W) > 9∗n in){ MR: X = T(S);

if (A = Multiple Regression(X, y) is success){ ˆ

P ower(V) = T(V)A + b; Restratification(V);

stratified = TRUE; W ={∅}; nRestrat++; }

} } else {

Generate nb Bootstrap Replications b from x; Calculate αBCa from b;

#Boot++; if (αBCa> 2∗α){

rel err = 1; } else if (stratified) {

rel err = 1; keep sampling = 2; goto MR; } else {

return nSamples, nRestrat, and ¯x; }

} } }

Fig. 2. Pseudo code of BMCAS.

J CIRCUIT SYST COMP 2002.11:333-350. Downloaded from www.worldscientific.com

(14)

samples as discussed in previous section. The rel err and the keep sampling are given one and two, respectively when BMCAS exits before any stratification is performed. With these setting, the BMCAS will stratify the population at least once and samples three new samples after the forced stratification get at least three samples that are sampled from the population more uniformly.

4.5. Experimental results

To demonstrate the performance of the proposed BMCAS, one more stratification method called Hamming Distance Method (HDM ) is implemented for comparison. It is a stratification method based on the assumptions that when power consumption increases with the number of inputs transitions. HDM method stratifies the input vectors into strata according to the Hamming Distance of each input vector. For both methods, the input vectors are stratified into six equal sized strata. The reason is that one can get little sample variance reduction by setting the number of strata larger than six 0.

The results are in Tables 4 to 6. The results from BMC method in Sec. 4 are listed in the tables, too. It is designated as NO STRAT because there is no strati-fication procedure in BMC. Similar to Tables 1 to 3, Tables 4 to 6 show the results for confidence level 90%, 95% and 99%, respectively. The first columns of them are the names of the circuits. The numbers in the brackets next to the circuit names are the number of inputs of the corresponding circuit. They are listed as a reference be-cause BMCAS re-stratifies the population after 9∗n in new sampled input vectors. There are three columns of data for each stratification method. The “nSample” column shows the average number of samples required for the corresponding strat-ification method to converge to a value of estimated power. The “nVecs” columns are the average numbers of sampled input vectors. The smaller is the nVecs, the better is the stratification method. The error level ε is set to 0.05. The viol r col-umn shows the violation ratios with the same definition as Eq. (25), and the #Boot columns are of the same definition as in Tables 1 to 3. The extra #ReStrat column for BMCAS is the average number of stratification being performed.

Comparing the proposed BMCAS and the BMC, the viol r of BMCAS are closer to 2∗α than BMC in almost all circuits and all confidence level. Besides, with the proposed adaptive stratification technique, the numbers of sampled input vectors are about 27% smaller than those of BMC in average. For some circuits, BMCAS even needs only half of the number of input vectors that the BMC needs. The #Restrat for some circuits, like C3540, are equal to exactly 1.0 because all of the BMC estimations exit with a number of sampled input vectors smaller than the threshold for starting stratification, and BMCAS will perform at least one stratification process before exiting. As shown in Tables 4 to 6, the viol r for C3540 are safely kept within 2∗α. As for the results from HDM method, although its nVecs is the smallest, the violation ratio exceeds 2∗α for all cases. This makes the results from HDM untrustable and the nVecs meaningless. With the safely kept viol r and

J CIRCUIT SYST COMP 2002.11:333-350. Downloaded from www.worldscientific.com

(15)

T a bl e 4 . C om par ison o f v ar io us str a ti ficati o n m etho d, confidence lev el = 90% (2 α =0 .1). NO STRA T H DM BMCAS Cir c uit nSa mp le nV ec s v io l r # Bo o t nSa mp le nV ec s v io l r nSa mp le nV ec s v io l r # Re S tra t # Bo ot C 432 (37) 297. 74 1786. 47 0. 0949 14. 4926 48. 56 291. 36 0. 1596 193. 99 1163. 97 0. 0918 3. 6702 7. 8359 C 499 (42) 104. 89 629. 34 0. 1050 2. 9860 4. 96 29. 79 0. 1421 90. 72 544. 30 0. 0739 1. 9919 3. 8312 C 880 (61) 110. 53 663. 19 0. 1010 3. 1880 13. 02 78. 12 0. 2141 107. 92 647. 56 0. 0870 1. 8311 3. 7967 C 1355 (42) 113. 82 682. 92 0. 1005 3. 2847 4. 85 29. 10 0. 1388 94. 46 566. 80 0. 0770 1. 9974 3. 9666 C 1908 (34) 166. 00 996. 04 0. 1004 5. 4834 10. 60 63. 59 0. 2060 105. 05 630. 31 0. 0795 2. 2278 2. 2278 C 3540 (51) 26. 03 156. 16 0. 1563 1. 0405 7. 10 42. 61 0. 1923 30. 81 184. 89 0. 0982 1. 0000 2. 0777 C 6288 (33) 255. 44 1532. 66 0. 1014 11. 0338 10. 36 62. 16 0. 1969 138. 80 832. 80 0. 0831 3. 0274 5. 2061 add mpr (36) 48. 04 288. 27 0. 1288 1. 2202 43. 35 260. 07 0. 1628 53. 22 319. 32 0. 0911 1. 3348 2. 4049 M a x 297. 74 1786. 47 0. 1563 14. 4926 48. 56 291. 36 0. 2141 193. 99 1163. 97 0. 0982 3. 6702 7. 8359 A v g 140. 31 841. 88 0. 1110 5. 3412 17. 85 107. 1 0 .1766 101. 87 611. 24 0. 0852 2. 1351 3. 9184

J CIRCUIT SYST COMP 2002.11:333-350. Downloaded from www.worldscientific.com

(16)

T a bl e 5 . C om par ison o f v ar io us str a ti ficati o n m etho d, confidence lev el = 95% (2 α =0 .05). NO STRA T H DM BMCAS Cir c uit nSa mp le nV ec s v io l r # Bo o t nSa mp le nV ec s v io l r nSa mp le nV ec s v io l r # Re S tra t # Bo ot C 432 (37) 417. 39 2504. 36 0. 0487 25. 7884 72. 63 435. 80 0. 0703 261. 99 1571. 98 0. 0393 4. 6465 12. 3182 C 499 (42) 147. 82 886. 94 0. 0497 4. 4027 6. 96 41. 74 0. 0852 108. 05 648. 32 0. 0392 2. 0039 3. 8246 C 880 (61) 155. 84 935. 03 0. 0497 4. 7865 20. 14 120. 83 0. 1193 132. 88 797. 26 0. 0458 1. 9994 4. 2675 C 1355 (42) 160. 20 961. 19 0. 0499 4. 9675 6. 77 40. 66 0. 0847 111. 59 669. 55 0. 0400 2. 0152 3. 8161 C 1908 (34) 232. 98 1397. 90 0. 0525 9. 0968 16. 29 97. 75 0. 1148 131. 98 791. 87 0. 0430 2. 9044 4. 7751 C 3540 (51) 38. 77 232. 59 0. 0810 1. 0764 10. 42 62. 51 0. 1158 43. 19 259. 15 0. 0457 1. 0000 2. 1437 C 6288 (33) 358. 47 2150. 83 0. 0485 19. 6258 15. 91 95. 45 0. 1146 188. 89 1133. 32 0. 0395 3. 9200 7. 7984 add mpr (36) 70. 20 421. 19 0. 0627 1. 5073 64. 84 389. 06 0. 0768 68. 21 409. 27 0. 0443 1. 9117 2. 7532 M a x 417. 39 2504. 36 0. 0810 25. 7884 72. 63 435. 80 0. 1193 261. 99 1571. 98 0. 0458 4. 6465 12. 3182 A v g 197. 71 1186. 25 0. 0553 8. 9064 26. 75 160. 48 0. 0977 130. 85 785. 09 0. 0421 2. 5501 5. 2121

J CIRCUIT SYST COMP 2002.11:333-350. Downloaded from www.worldscientific.com

(17)

T a bl e 6 . C om par ison o f v ar io us str a ti ficati o n m etho d, confidence lev el = 99% (2 α =0 .01). NO STRA T H DM BMCAS Cir c uit nSa mp le nV ec s v io l r # Bo o t nSa mp le nV ec s v io l r nSa mp le nV ec s v io l r # Re S tra t # Bo ot C 432 (37) 690. 93 4145. 60 0. 0092 59. 5692 125. 95 755. 71 0. 0135 425. 68 2554. 10 0. 0073 6. 8489 26. 3906 C 499 (42) 246. 67 1480. 03 0. 0115 8. 3435 11. 88 71. 27 0. 0269 148. 93 893. 58 0. 0097 2. 7605 4. 8357 C 880 (61) 259. 80 1558. 86 0. 0111 9. 2150 37. 33 223. 95 0. 0316 186. 26 1117. 56 0. 0120 2. 1826 5. 9437 C 1355 (42) 266. 71 1600. 27 0. 0138 9. 6379 11. 53 69. 20 0. 0275 155. 74 934. 48 0. 0093 2. 8516 5. 1525 C 1908 (34) 387. 10 2322. 61 0. 0121 19. 8780 30. 19 181. 13 0. 0330 209. 86 1259. 15 0. 0078 4. 2333 8. 1702 C 3540 (51) 69. 34 416. 39 0. 0146 1. 3426 18. 92 113. 53 0. 0367 73. 16 438. 95 0. 0094 1. 2434 2. 5202 C 6288 (33) 593. 65 3561. 91 0. 0105 44. 9796 29. 90 179. 37 0. 0325 315. 67 1894. 00 0. 0093 6. 0004 16. 0834 add mpr (36) 123. 03 728. 20 0. 0111 2. 9168 112. 04 672. 25 0. 0137 93. 23 559. 35 0. 0074 2. 0002 3. 9304 M a x 690. 93 4145. 60 0. 0146 59. 5692 125. 95 755. 71 0. 0367 425. 68 2554. 10 0. 0120 6. 8489 26. 3906 A v g 329. 65 1976. 73 0. 0117 19. 4853 47. 22 283. 30 0. 0269 201. 07 1206. 40 0. 0090 3. 5151 9. 1283

J CIRCUIT SYST COMP 2002.11:333-350. Downloaded from www.worldscientific.com

(18)

the smaller number of nVecs, we can summarize that the proposed BMCAS is the most reliable one and can efficiently reduce the required number approach.

5. Conclusion

In this paper, the Bootstrap technique is adopted to assure the confidence level when doing Monte Carlo estimation. With this technique, the Monte Carlo method can be improved since confidence level is monitored during the Monte Carlo simulation. Besides, this paper proposed a novel Adaptive Stratification technique, with which the population can be dynamically and well stratified to keep the sample variance minimized. The experimental results on the ISCAS-85 benchmarks show that the proposed Bootstrap Monte Carlo with Adaptive Stratification (BMCAS ) success-fully preserves the confidence level while efficiently reducing the required number of input vectors.

References

1. A. Pinar and C. L. Liu, “Power invariant vector sequence compaction”, Proceeding of ICCAD, 1998, pp. 473–476.

2. R. Marculescu, D. Marculescu, and M. Pedram, “Sequence compaction for power estimation theory and practice”, IEEE Trans. CAD, July 1999, pp. 973–993. 3. N. Dragone, R. Zafalon, C. Guardiani, and C. Silvano, “Power invariant vector

com-paction based on bit clustering and temporal partitioning”, Proceeding of ISLPED, 1998, pp. 118–120.

4. R. Burch, F. N. Najm, P. Yang, and T. N. Trick, “A Monte Carlo approach for power estimation”, IEEE Trans. VLSI, March 1993, pp. 63–71.

5. B. Efron, “Better bootstrap confidence intervals”, J. American Statistical Association (1987) 171–200.

6. B. Efron and R. J. Tibshirani, An Introduction to the Bootstrap, Chapman & Hall, 1993.

7. C. S. Ding, Q. Wu, C. T. Hsieh, and M. Pedram, “Stratified random sampling for power estimation”, IEEE Trans. CAD, June 1998, pp. 465–478.

8. A. Papoulis, Probability and Statistics, Prentic-Hall, 1990.

9. H. Stark and J. W. Woods, Probability, Random Process, and Estimation Theory for Engineers, Prentice-Hall, 1986.

10. A. Bogliolo, L. Benini, and G. D. Micheli, “Adaptive least square behavioral power modeling”, Proceeding of ED&TC, 1997, pp. 400–406.

11. S. R. Huang, “Effectiveness of optimum stratified sampling and estimation in Monte Carlo production simulation”, IEEE Trans. Power System, May 1997, pp. 566–572.

J CIRCUIT SYST COMP 2002.11:333-350. Downloaded from www.worldscientific.com

數據

Fig. 1. Pseudo code of BMC.
Table 1. MC versus BMC with α = 0.05.
Table 3. MC versus BMC with α = 0.005.
Fig. 2. Pseudo code of BMCAS.

參考文獻

相關文件

• Appearance: vectorized mathematical code appears more like the mathematical expressions found in textbooks, making the code easier to understand.. • Less error prone: without

Biases in Pricing Continuously Monitored Options with Monte Carlo (continued).. • If all of the sampled prices are below the barrier, this sample path pays max(S(t n ) −

• But Monte Carlo simulation can be modified to price American options with small biases (pp..

Biases in Pricing Continuously Monitored Options with Monte Carlo (continued).. • If all of the sampled prices are below the barrier, this sample path pays max(S(t n ) −

Bootstrapping is a general approach to statistical in- ference based on building a sampling distribution for a statistic by resampling from the data at hand.. • The

• The randomized bipartite perfect matching algorithm is called a Monte Carlo algorithm in the sense that.. – If the algorithm finds that a matching exists, it is always correct

• Consider an algorithm that runs C for time kT (n) and rejects the input if C does not stop within the time bound.. • By Markov’s inequality, this new algorithm runs in time kT (n)

• Suppose, instead, we run the algorithm for the same running time mkT (n) once and rejects the input if it does not stop within the time bound.. • By Markov’s inequality, this