motivation for multi language cnc
play

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


  1. 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

  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! 2

  3. Babel – language interoperability tool  LLNL's language interoperability toolkit for high- performance computing  designed for fast, in-process communication  handles generation of all glue-code 3

  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 4

  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 { } } 5

  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 6

  7. Babel – method invocation scheme  Example flow while calling from Java into Python Java Python 7

  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 8

  9. HJ-CnC Runtime – current design Tag Collections (Scheduling) HJ-CNC Step Runtime Instances Item Collections (Data + Scheduling) HJ 9

  10. HJ-CnC-Babel – multi-language runtime Tag Collections (Scheduling) Step Step HJ-CNC Instances Instances Runtime (server) (client) Item Item Collection Collection ( Scheduling ) ( Data ) Java/Python/C/C++/Fortran Java/Python/C/C++/Fortran HJ 10

  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) 11

  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 12

  13. HJ-CnC-Babel – partition string example Input Singleton Input ItemCol. ItemCol. TagCol. CreateSpanStep (server) CreateSpanStep (client) HJ-CNC Span Span Span ItemCol. ItemCol. TagCol. ProcessSpanStep (server) ProcessSpanStep (client) Results ItemCol. Results ItemCol. C++ Python HJ/Java 13

  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) 14

  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 15

  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 16

  17. Questions 17

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend