Motivation for Multi-language CnC Current CnC runtimes require steps - - PowerPoint PPT Presentation

motivation for multi language cnc
SMART_READER_LITE
LIVE PREVIEW

Motivation for Multi-language CnC Current CnC runtimes require steps - - PowerPoint PPT Presentation

CnC-Babel A Multi-Language Implementation of the Concurrent Collections model Shams Imam, Vivek Sarkar Adrian Prantl adrian@llnl.gov adrian@llnl.gov shams@rice.edu, shams@rice.edu, vsarkar@rice.edu vsarkar@rice.edu LLNL Rice University 1


slide-1
SLIDE 1

1

CnC-Babel

A Multi-Language Implementation of the Concurrent Collections model

Adrian Prantl

adrian@llnl.gov adrian@llnl.gov

LLNL

Shams Imam, Vivek Sarkar

shams@rice.edu, shams@rice.edu, vsarkar@rice.edu vsarkar@rice.edu

Rice University

slide-2
SLIDE 2

2

Motivation for Multi-language CnC

 Current CnC runtimes require steps be written in

language chosen by the runtime

 Domain experts

 may prefer other dynamic languages like Python  may prefer reusing existing code (in another

language)

 Language interoperability issue!

slide-3
SLIDE 3

3

Babel – language interoperability tool

 LLNL's language

interoperability toolkit for high- performance computing

 designed for fast,

in-process communication

 handles generation

  • f all glue-code
slide-4
SLIDE 4

4

Babel – relevant features

 programming language-neutral interface

specification language – Scientific Interface Definition Language (SIDL)

 supports

– user-defined types (classes) – interface inheritance – dynamic multi-dimensional arrays

slide-5
SLIDE 5

5

Babel – SIDL interface definition

 First, define the interface in SIDL

import cncapi; package partitionstring version 1.0 { interface SpansInputCollection { string get(in CncTag tag); bool containsTag(in CncTag tag); } interface SpansOutputCollection { void put(in CncTag tag, in string value); } class SpansCollection implements-all SpansInputCollection, SpansOutputCollection { }

}

slide-6
SLIDE 6

6

Babel – generate server and client

 Next, use the Babel compiler with the SIDL file

as input to generate the server(callee) and client(caller) glue code:

~/ps/pyLib> babel --server=python spanc.sidl sidl

 generates code for skeleton and intermediate object

respresentation (IOR)

 generates empty blocks expecting user code

~/ps/javaClient> babel --client=java spanc.sidl sidl

 generates code for stub and IOR  user code uses the stub to make method calls into

the external language

slide-7
SLIDE 7

7

Babel – method invocation scheme

Java Python

 Example flow while calling from Java into Python

slide-8
SLIDE 8

8

HJ-CnC and Babel?

 HabaneroJava is a fork of IBM X10

– provides language constructs for parallel programming – uses these constructs for the HJ-CnC runtime – Steps and Item Collections are written in HJ

 Babel supports HJ!

– HJ is effectively Java and runs on the JVM – HJ has bidirectional interoperability with Babel supported languages

slide-9
SLIDE 9

9

HJ-CnC Runtime – current design

HJ-CNC Runtime Tag Collections (Scheduling) Item Collections (Data + Scheduling) Step Instances

HJ

slide-10
SLIDE 10

10

HJ-CnC-Babel – multi-language runtime

HJ-CNC Runtime Tag Collections (Scheduling) Item Collection (Scheduling) Step Instances (client)

HJ

Item Collection (Data) Step Instances (server)

Java/Python/C/C++/Fortran Java/Python/C/C++/Fortran

slide-11
SLIDE 11

11

HJ-CnC-Babel – implementation details

 wrap and expose HJ Tag and Item collections  require a well-defined type for a Tag for use in

SIDL files (we use a CnCTag interface)

 require a native version of ConcurrentMap for

ItemCollections

 get() and put() on native Item Collections need

well-defined signatures for use in SIDL

– void putString(in CncTag tag, in string value) – sidl.array<int, 2> getIntArray2d(in CncTag tag)

slide-12
SLIDE 12

12

HJ-CnC-Babel – Steps to write a program

 user writes textual description of CnC graph  user annotates graph with extra information to be

used by Babel – impl. language for Steps and Item Collections – types of items stored in the Item Collections

 user runs translator to generate code

– Babel generates Step template

 user writes Step code and initialization logic  user runs code using HJ

slide-13
SLIDE 13

13

HJ-CnC-Babel – partition string example

HJ-CNC

Span ItemCol. CreateSpanStep (client) Span ItemCol. CreateSpanStep (server) Input ItemCol. Input ItemCol. ProcessSpanStep (client) ProcessSpanStep (server) Results ItemCol. Results ItemCol. Singleton TagCol. Span TagCol.

HJ/Java Python C++

slide-14
SLIDE 14

14

HJ-CnC-Babel – initial results

 Babel reports less than one percent overhead in

common use cases

 HJ-CnC-Babel impl. of Cholesky [2000×2000]

– run on dual core machine – HJ configured to use 8 threads – HJ-CnC version runs in about 10.8 secs – Step and Item Collections rewritten in C++

  • runs in about 6.4 seconds (about 40% faster)
slide-15
SLIDE 15

15

Current Status

 HJ-CnC-Babel runtime available:

– Steps can be written in any Babel supported language as well as HJ – Item Collections available for Python and C++

 code generation in progress

– current examples implemented by manually modifying code generated by HJ-CnC

slide-16
SLIDE 16

16

Summary and Future Work

 extended CnC-HJ runtime via Babel to allow

CnC steps and item collections in multiple languages:

– Tuning expert tunes runtime using HJ and various Item Collection implementations – Domain expert uses Babel-supported language of personal choice to implement steps

  • plans in progress to use CnC-Babel to introduce

a CnC-Python in COMP 140 at Rice

slide-17
SLIDE 17

17

Questions