40
Evolving Power-Efficient RNGs David R. White University of Glasgow 39th CREST Open Workshop Tuesday 24th February 2015 David R. White University of Glasgow Evolving Power-Efficient RNGs

Evolving Power-Efficient RNGs - UCL

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Evolving Power-Efficient RNGs - UCL

Evolving Power-Efficient RNGs

David R. WhiteUniversity of Glasgow

39th CREST Open WorkshopTuesday 24th February 2015

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 2: Evolving Power-Efficient RNGs - UCL

Table of Contents

Introduction

Evolving RNGs with GP

Measuring Power Consumption and Functionality

Experimental Method

Results

Conclusions and Postscript

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 3: Evolving Power-Efficient RNGs - UCL

Table of Contents

Introduction

Evolving RNGs with GP

Measuring Power Consumption and Functionality

Experimental Method

Results

Conclusions and Postscript

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 4: Evolving Power-Efficient RNGs - UCL

My First Paper

This work was my first paper, at GECCO 2008.

Followed by work on non-functional properties with GP and acollaboration with Andrea Arcuri.

Some of the earliest work on using GP to optimise non-functionalproperties.

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 5: Evolving Power-Efficient RNGs - UCL

Resource Efficient Software: Target Platforms

WSN Motes RFID Tags

I Hardware limited (e.g. 64KB, 12MHz Mote)

I Multiple, demanding, requirements

I Interdependence between requirements

I What happens when you just don’t have enough resources?

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 6: Evolving Power-Efficient RNGs - UCL

The Difficult of Manual Power Optimisation

AKA “the loneliness of the long-distance embedded systemsprogrammer.”

“The internals of a modern processor are completechaos”.

Anonymous RTS Professor

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 7: Evolving Power-Efficient RNGs - UCL

Standard Programming

Programmer Compiler Binary

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 8: Evolving Power-Efficient RNGs - UCL

Standard Programming: Limitations

Programmer Compiler Binary

No automated improvement at this level

Compiler limited by programmer's decisions

Platform and usage almost incidental

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 9: Evolving Power-Efficient RNGs - UCL

Standard Programming: Limitations

Programmer Compiler Binary

No automated improvement at this level

Compiler limited by programmer's decisions

Platform and usage almost incidental

Complex relationship between source and binary

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 10: Evolving Power-Efficient RNGs - UCL

Table of Contents

Introduction

Evolving RNGs with GP

Measuring Power Consumption and Functionality

Experimental Method

Results

Conclusions and Postscript

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 11: Evolving Power-Efficient RNGs - UCL

Why RNGs?

A common component; small and frequently executed.

We were interested in trade-offs, not solely optimisation.

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 12: Evolving Power-Efficient RNGs - UCL

Proof of Concept: Resource-Efficient PRNGs

Lamenca-Martinez et al. [2006] evolved PRNGs with a view toefficiency, building on work by Hernandez et al. [2004].

Tried to ensure efficiency through choice of function set.

See also Koza [1991], Jannink [1994], Sipper and Tomassini [1996].

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 13: Evolving Power-Efficient RNGs - UCL

Table of Contents

Introduction

Evolving RNGs with GP

Measuring Power Consumption and Functionality

Experimental Method

Results

Conclusions and Postscript

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 14: Evolving Power-Efficient RNGs - UCL

Measuring Fitness

Quality was measured using the Strict Avalanche Criterion as perLamenca-Martinez et al. [2006].

Power efficiency was measured using the Sim-Wattch Simulator[Brooks et al., 2000].

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 15: Evolving Power-Efficient RNGs - UCL

Wattch

Cycle-level power simulator based on SimpleScalar simulator.

Estimates power usage through approximation for each logic unit:

Pd = CV 2ddaf (1)

C is the load capacitance; Vdd the supply voltage, f the clockfrequency and a an activity that estimates the amount of transistorswitching.

Partly estimated, validation given by Brooks et al. [2000].

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 16: Evolving Power-Efficient RNGs - UCL

Problems

Simulation is (allegedly) inaccurate and expensive.

For our purposes it only has to be relatively accurate, most of thetime.

We reduced the sample size compared to previous work, to increasespeed.

Could we have just used execution time as a proxy?

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 17: Evolving Power-Efficient RNGs - UCL

Measuring Randomness: Strict Avalanche Criterion

Trying to create a function r(a0 . . . a7)

Maximise nonlinearity of this function:

1. Create a random input a0 . . . a7

2. Evaluate o1 = r(a0 . . . a7)

3. Flip one bit of input to create b0 . . . b7

4. Evaluate o2 = r(b0 . . . b7)

5. Record hamming distance H(o1, o2)

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 18: Evolving Power-Efficient RNGs - UCL

Measuring Randomness: Strict Avalanche Criterion II

Compare the distribution of bit flips to the binomial distribution:

n∑i=0

(Ci − Ei )2

Ei

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 19: Evolving Power-Efficient RNGs - UCL

Our Objective Space

Resource (Power)

Err

or (

SA

C)

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 20: Evolving Power-Efficient RNGs - UCL

A Single Program

Resource (Power)

Err

or (

SA

C)

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 21: Evolving Power-Efficient RNGs - UCL

Table of Contents

Introduction

Evolving RNGs with GP

Measuring Power Consumption and Functionality

Experimental Method

Results

Conclusions and Postscript

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 22: Evolving Power-Efficient RNGs - UCL

Experimental Method

Replicated work by Hernandez et al. [2004] and achieved similarresults.

Used reduced sample size.

Searched using ECJ and SPEA2.

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 23: Evolving Power-Efficient RNGs - UCL

Variance of Fitness Measures

0 2 4 6 8 10 12 140

1

2

3

4

5

6

7

8

9

10

Log2 (Sample Size)

log 10

(χ2 F

itnes

s / S

ampl

e S

ize)

Repeated for other programs and power consumption measure.

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 24: Evolving Power-Efficient RNGs - UCL

Experimental Framework

Raw Fitness Values

ECJGP & SPEA2

PRNGsource

Test Harnesssource

Mersenne Twister source

GCC Object Code

Sim-Wattch

Power Statistics

Test Harness Output

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 25: Evolving Power-Efficient RNGs - UCL

Parameter Settings

Function set MULT, AND, SUM, NOT, OR, XOR, Logical ShiftLeft (LSL), LSR, Circular Shift Left (CSL), CSR

Parameter settings left to their defaults in ECJ, as specified bykoza.params.

All non-default settings taken from previous work, except forMOO-specific settings.

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 26: Evolving Power-Efficient RNGs - UCL

Table of Contents

Introduction

Evolving RNGs with GP

Measuring Power Consumption and Functionality

Experimental Method

Results

Conclusions and Postscript

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 27: Evolving Power-Efficient RNGs - UCL

Evolution of the Pareto Front

Animation

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 28: Evolving Power-Efficient RNGs - UCL

Example Pareto Front

x xxxxx xxx

x

xx

x

xxxx

xxxxx xx

x

xx xxxx

xxxxx

x xxx x

x

xxx

x

x

x xx

x xxx

x

xx

x

xx

xxxxx

x x

x

x

x

x x

x

x

x

xx

x

xx

x

x

x

x

x

xxxxx

xxx

xx

x

xx

x

x

2.95e+08 3.05e+08 3.15e+08 3.25e+08

46

810

12

Power Consumption (Sim-Wattch Units)

log10(

Χ2 Fitness)

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 29: Evolving Power-Efficient RNGs - UCL

A Fantastically Low Power RNG

int genRand (int a0, int a1, int a2, int a3, int a4, int a5, int a6, inta7)

return ¬(¬(1997453768ul));

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 30: Evolving Power-Efficient RNGs - UCL

A Middle Ranking Low Power RNG

int genRand (int a0, int a1, int a2, int a3, int a4, int a5, int a6, inta7)

return a2 ∨ ¬(((a2 + a0) ∗ ((a4⊕ ((a6 + a5)⊕ a7)) + (a1⊕a3))) ∧ ¬(¬(1997453768ul)));

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 31: Evolving Power-Efficient RNGs - UCL

An Excellent Low Power RNG

int genRand (int a0, int a1, int a2, int a3, int a4, int a5, int a6, inta7) (2307363674ul ⊕ (a2 ∗ a6)) + ((¬((((((a2 ∗ a6)⊕ (a7⊕ a1)) ∗(a0⊕ a3))⊕ (a2 ∗ a6)) + (a5 ∗ a4)) >> 2307363674ul)⊕ (a0⊕a3)) + ¬((a5 ∗ a4) ∗ ((2307363674ul ⊕ (a7⊕ a1)) + (a0⊕ a3))));

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 32: Evolving Power-Efficient RNGs - UCL

Bit Flip Distribution for Best Individual

0 5 10 15 20 25 30 350

500

1000

1500

2000

2500

Number of Bit Flips

Fre

quen

cy

IdealBest Program

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 33: Evolving Power-Efficient RNGs - UCL

The Impact of the Mult Function

x xxxxxxxx

x

xx

x

xxxx

xxxxx xx

x

xxxxxx

xxxxx

x xxxx

x

x xx

xx

x xx

x xxx

x

xx

x

xx

xxxxx

x x

x

x

x

x x

x

x

x

xx

x

xx

x

x

x

x

xxxxxx

xxx

xx

x

xx

x

x

2.9e+08 3.0e+08 3.1e+08 3.2e+08 3.3e+08 3.4e+08 3.5e+08

02

46

810

12

14

Power Consumption (Sim-Wattch Units)

log10 (

Χ2 Fitness )

ooo oooooooo oooooooooooooooooooooo

o oooo ooo ooo

ooooo oo

ooooooo

ooo

o

ooo

o

o

oooo

o

oo

oo

o

o

o o o

oo

oo

o

oo

o

ooooo

Multiply IncludedMultiply Omitted

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 34: Evolving Power-Efficient RNGs - UCL

Table of Contents

Introduction

Evolving RNGs with GP

Measuring Power Consumption and Functionality

Experimental Method

Results

Conclusions and Postscript

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 35: Evolving Power-Efficient RNGs - UCL

Conclusions

This is about more than straightforward optimisation.

Multiple solutions vs a single, tunable, scalable algorithm.

More radically, consider manipulation rather than optimisation.

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 36: Evolving Power-Efficient RNGs - UCL

Postscript: Time Avalanche Criterion

0 2 4 6 8 10 13 16 19 22 25 28 31

ActualExpected

Bit Flips

Fre

qu

en

cy

02

00

40

06

00

80

01

00

01

20

01

40

0

0 1 2 3 4 5

ActualExpected

Bit Flips

Fre

qu

en

cy

05

00

100

01

50

02

00

02

50

03

00

0

See White et al. [2010]

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 37: Evolving Power-Efficient RNGs - UCL

Acknowledgements

My coauthors John Clark, Jeremy Jacob and Simon Poulding.

Andrea Arcuri for his collaboration.

Juan E. Tapiador and Julio Cesar Hernandez-Castro, for inspirationand creative discussion.

[email protected]

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 38: Evolving Power-Efficient RNGs - UCL

Genetic Improvement Workshop (at GECCO 2015)

Submission deadline: April 3, 2015 geneticimprovement2015.com

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 39: Evolving Power-Efficient RNGs - UCL

References I

David Brooks, Vivek Tiwari, and Margaret Martonosi. Wattch: a framework forarchitectural-level power analysis and optimizations. In ISCA, pages 83–94,2000. URL http://www.cs.ucr.edu/~harry/classes_files/CS269_

02/papers/Brooks_ISCA_00.pdf.

Julio Cesar Hernandez, Pedro Isasi, and Andre Seznec. On the design ofstate-of-the-art pseudorandom number generators by means of geneticprogramming. In Proceedings of the 2004 IEEE Congress on EvolutionaryComputation, pages 1510–1516, 2004. ISBN 0-7803-8515-2.

Jan Jannink. Cracking and Co-Evolving Randomizers. Advances in GeneticProgramming, pages 425–443, 1994. URLciteseer.ist.psu.edu/jannink94cracking.html.

John R. Koza. Evolving a computer program to generate random numbersusing the genetic programming paradigm. In Proceedings of the FourthInternational Conference on Genetic Algorithms, pages 37–44. MorganKaufmann, 1991. URLhttp://citeseer.ist.psu.edu/john91evolving.html.

David R. White University of Glasgow Evolving Power-Efficient RNGs

Page 40: Evolving Power-Efficient RNGs - UCL

References II

Carlos Lamenca-Martinez, Julio Cesar Hernandez-Castro, Juan M.Estevez-Tapiador, and Arturo Ribagorda. Lamar: A new pseudorandomnumber generator evolved by means of genetic programming. In ParallelProblem Solving from Nature IX, volume 4193, pages 850–859.Springer-Verlag, 2006. URLhttp://ppsn2006.raunvis.hi.is/proceedings/202.pdf.

Moshe Sipper and Marco Tomassini. Co-evolving parallel random numbergenerators. In Parallel Problem Solving from Nature – PPSN IV, pages950–959. Springer, 1996.

DavidR. White, Juan M.E. Tapiador, Julio Cesar Hernandez-Castro, andJohnA. Clark. Fine-grained timing using genetic programming. In EuroGP2010. 2010. doi: 10.1007/978-3-642-12148-7 28.

David R. White University of Glasgow Evolving Power-Efficient RNGs