haskell in green land: analyzing the energy behavior of a purely functional language

35
Haskell in Green Land: Analyzing the Energy Behavior of a Purely Functional Language Luís Gabriel Lima 1 , Gilberto Melfe 2 , Francisco Soares-Neto 1 , Paulo Lieuthier 1 , João Paulo Fernandes 2 , and Fernando Castor 1 1 {lgnfl, fmssn, pvjl, castor }@cin.ufpe.br 2 [email protected], [email protected] 1

Upload: greenlabatdi

Post on 23-Jan-2018

151 views

Category:

Software


0 download

TRANSCRIPT

Haskell in Green Land: Analyzing the Energy Behavior of a Purely Functional Language

Luís Gabriel Lima1, Gilberto Melfe2, Francisco Soares-Neto1, Paulo Lieuthier1, João Paulo Fernandes2, and Fernando Castor1

1 {lgnfl, fmssn, pvjl, castor}@cin.ufpe.br2 [email protected], [email protected]

1

Global energy system is unsustainable

2

3

4

Haskell has feelings too!

5

rq

6

Can we save energy by refactoring Haskell

programs to use different data structure

implementations or concurrent

programming constructs?

Experimental Setup

2x10-core Intel Xeon E5-2660 v2 processors (Ivy Bridge) 256GB of DDR3 1600MHz RAM

Criterion

RAPL

7

Study 1: Purely functional data structures

8

RQ1. How do different implementations of

the same abstractions compare in terms of

run time and energy efficiency?

9

RQ2. For concrete operations, what is the

relationship between their performance

and energy consumption?

10

Study 1: Edison Library

Collections Associative Collections Sequences

EnumSet

StandardSet

UnbalancedSet

LazyPairingHeap

LeftistHeap

MinHeap

SkewHeap

SplayHeap

AssocList

PatriciaLoMap

StandardMap

TernaryTrie

BankersQueue

SimpleQueue

BinaryRandList

JoinList

RandList

BraunSeq

FingerSeq

ListSeq

RevSeq

SizedSeq

MyersStack

11

Study 1: Benchmark

iters operation base aux

1

1000

1

1000

5000

1

10000

10

5000

10

add

addAll

clear

contains

containsAll

iterator

remove

removeAll

toArray

retainAll

100000

100000

100000

100000

100000

100000

100000

100000

100000

100000

100000

1000

n.a.

1

1000

n.a.

1

1000

n.a.

1000

12

13

iters = 0; while iters < 10

retainAll base aux;iters++;

640 configurations6000+ executions

14

Study 2: Results

15

http://green-haskell.github.io

Study 1: Results

16

Study 1: Findings

17

RQ1. How do different implementations of the same abstractions

compare in terms of runtime and energy efficiency?

RQ2. For concrete operations, what is the relationship between their

performance and their energy consumption?

Energy is proportional to execution time.

Full details on green-haskell.github.io.

Study 2: Concurrent programming constructs

18

19

RQ1. Do alternative thread management

constructs have different impacts on energy

consumption?

20

RQ2. Do alternative data-sharing primitives

have different impacts on energy

consumption?

Study 2: Concurrency Primitives

Thread management: forkIO, forkOn,

forkOS

22

Study 2: Concurrency Primitives

Data sharing: MVar, TVar, TMVar

23

9 benchmarks: IO, memory, synchronization bound

Up to 9 variants per benchmark

9 configurations for # of processors

24

Study 2: Results

25

http://green-haskell.github.io

26

Small changes can produce big savings

Faster is not always greener

27

28

There is no overall winner

29

Made two tools energy-aware:

Haskell profiler

Criterion

31

fsklsdfnjdsfjsadfhjksdhflkjsdhflkjsah

32

fsklsdfnjdsfjsadfhjksdhflkjsdhflkjsah

33

Population: 56483 (2013)

Haskell programmers: 0 (est.)

34

http://green-haskell.github.io

35

http://green-haskell.github.io

36

http://green-haskell.github.io

37

http://green-haskell.github.io