Top Banner
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
35

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

Jan 23, 2018

Download

Software

GreenLabAtDI
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Haskell in Green Land: Analyzing the Energy Behavior of a Purely Functional Language

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

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

Global energy system is unsustainable

2

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

3

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

4

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

Haskell has feelings too!

5

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

rq

6

Can we save energy by refactoring Haskell

programs to use different data structure

implementations or concurrent

programming constructs?

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

Experimental Setup

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

Criterion

RAPL

7

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

Study 1: Purely functional data structures

8

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

RQ1. How do different implementations of

the same abstractions compare in terms of

run time and energy efficiency?

9

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

RQ2. For concrete operations, what is the

relationship between their performance

and energy consumption?

10

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

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

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

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

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

13

iters = 0; while iters < 10

retainAll base aux;iters++;

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

640 configurations6000+ executions

14

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

Study 2: Results

15

http://green-haskell.github.io

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

Study 1: Results

16

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

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.

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

Study 2: Concurrent programming constructs

18

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

19

RQ1. Do alternative thread management

constructs have different impacts on energy

consumption?

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

20

RQ2. Do alternative data-sharing primitives

have different impacts on energy

consumption?

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

Study 2: Concurrency Primitives

Thread management: forkIO, forkOn,

forkOS

22

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

Study 2: Concurrency Primitives

Data sharing: MVar, TVar, TMVar

23

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

9 benchmarks: IO, memory, synchronization bound

Up to 9 variants per benchmark

9 configurations for # of processors

24

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

Study 2: Results

25

http://green-haskell.github.io

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

26

Small changes can produce big savings

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

Faster is not always greener

27

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

28

There is no overall winner

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

29

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

Made two tools energy-aware:

Haskell profiler

Criterion

31

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

fsklsdfnjdsfjsadfhjksdhflkjsdhflkjsah

32

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

fsklsdfnjdsfjsadfhjksdhflkjsdhflkjsah

33

Population: 56483 (2013)

Haskell programmers: 0 (est.)

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

34

http://green-haskell.github.io

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

35

http://green-haskell.github.io

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

36

http://green-haskell.github.io

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

37

http://green-haskell.github.io