www.cs.rochester.edu/u/scott/ Dagstuhl, January 2015 MLS ! 1 ! Whe - - PowerPoint PPT Presentation

cs rochester edu u scott dagstuhl january 2015 mls 1 whe
SMART_READER_LITE
LIVE PREVIEW

www.cs.rochester.edu/u/scott/ Dagstuhl, January 2015 MLS ! 1 ! Whe - - PowerPoint PPT Presentation

Dete term rministic inistic P Paralle llel Sc l Scripting: ripting: Ma Making the ing the Ea Easy C sy Case se Ea Easy sy Michael L. Scott www.cs.rochester.edu/u/scott/ Dagstuhl, January 2015 MLS ! 1 ! Whe Where re in the in


slide-1
SLIDE 1

MLS! 1!

Dete term rministic inistic P Paralle llel Sc l Scripting: ripting: Ma Making the ing the Ea Easy C sy Case se Ea Easy sy Michael L. Scott

www.cs.rochester.edu/u/scott/ Dagstuhl, January 2015

slide-2
SLIDE 2

MLS! 2!

Whe Where re in the in the C Curric urriculum ulum?

languages, SW engg., sci. comp. graphics, HCI, web computing computer literacy data structures networks,

  • dist. comp.

OS, arch., par. comp., DBMS

slide-3
SLIDE 3

MLS! 3!

Wha What La t Langua nguage ge D Do We

  • We U

Use se?

  • Lamport: This is the wrong question.

» Imagine an art historian answering how would you describe impressionist painting? by saying in French.

  • MLS: This is the

wrong analogy.

» Imagine an art teacher answering how would you introduce pointillism? by saying in oils.

  • Notation matters!
slide-4
SLIDE 4

MLS! 4!

Whe Where re D Doe

  • es Ea

s Easine siness Ma ss Matte tter? r?

  • Dynamic (scripting) languages!

» Increasing share of modern programs in Python, Ruby, PHP, Matlab, R, JavaScript, . . . » Increasing share of introductory curricula » Ease of programming trumps performance » But concurrency can still make a difference on multicore machine

  • Deterministic Parallel Ruby (DPR)

» Thesis work of Li Lu (now at Hortonworks)\ » Emphasis on independence & proper nesting

slide-5
SLIDE 5

MLS! 5!

DPR PR C Construc

  • nstructs (1

ts (1)

  • Independent blocks (co operator):

def qsort(a) return a if a.length <= 1 m = a.length/2 pivot = a[m] left = qsort(a.select{|v| v < pivot}) mid = a.select{|v| v == pivot} right = qsort(a.select{|v| v > pivot}) return left + mid + right end

slide-6
SLIDE 6

MLS! 6!

DPR PR C Construc

  • nstructs (1

ts (1)

  • Independent blocks (co operator):

def qsort(a) return a if a.length <= 1 m = a.length/2 pivot = a[m] left = qsort(a.select{|v| v < pivot}) mid = a.select{|v| v == pivot} right = qsort(a.select{|v| v > pivot}) return left + mid + right end

slide-7
SLIDE 7

MLS! 7!

DPR PR C Construc

  • nstructs (1

ts (1)

  • Independent blocks (co operator):

def qsort(a) return a if a.length <= 1 m = a.length/2 pivot = a[m] co ->{ left = qsort(a.select{|v| v < pivot}) }, },

  • >{ mid = a.select{|v| v == pivot} },
  • >{ right = qsort(a.select{|v| v > pivot}) }

return left + mid + right end

slide-8
SLIDE 8

MLS! 8!

DPR PR C Construc

  • nstructs (2

ts (2)

  • Independent unordered iteration:

myset.all {|e| op }

  • Reductions:

sum = Reduction.new(IntegerAdd) myset.all {|e| sum.push(1) if P(e) } count = sum.get

slide-9
SLIDE 9

MLS! 9!

DPR PR C Construc

  • nstructs (3

ts (3)

  • Atomic commutative operations — consider:

sum = Reduction.new(IntegerAdd) myset.all {|e| sum.push(f(e)) }

where f is a very expensive function. Instead, do:

mtab = new MemoTable(f) sum = Reduction.new(IntegerAdd) myset.all {|e| sum.push(mtab.eval(e)) }

where MemoTable is defined (in advance, by an expert) as ...

slide-10
SLIDE 10

MLS! 10!

DPR PR C Construc

  • nstructs (3

ts (3)

class MemoTable def initialize(f) @f = f @table = Hash.new end self.setACOps :eval end def eval(key) atomic val = @table[key] end if val == nil val = @f.call(key) atomic @table[key] = val end end return val end

slide-11
SLIDE 11

MLS! 11!

DPR PR C Construc

  • nstructs (4

ts (4)

  • Pure futures:

f = Future.new(->{|x1, x2, ...| op }, arg1, arg2, ...) ... v = f.get()

  • Pipelines

p = ->{|x| s1} >> ->{|x| s2} >> ->{|x| s3} p.setInStream(MyInStream.new) p.setOutStream(MyOutStream.new) p.run

» Stage i on object n must be independent of stage j on object m

if (and only if) i+n = j+m

slide-12
SLIDE 12

MLS! 12!

DPR PR Im Imple plementa ntation tion

  • Tiny sequential library (few dozen lines);

(larger) parallel library

» Both run on any Ruby VM

  • Built-in version on JRuby

» Thread pool with Cilk-like work stealing scheduler » Modest scalability: 2-6x on 12 cores

  • Independence treated as an assertion

» Checked at run-time: TARDIS determinism checker [PLDI’14] » Cf. subscript or type checking

  • Not solid enough to use for teaching yet !

» But I really think something along these lines is what we need

slide-13
SLIDE 13

www.cs.rochester.edu/u/scott/