Presentation is loading. Please wait.

Presentation is loading. Please wait.

Selective, Embedded Just-in- Time Specialization (SEJITS) As a platform for implementing communication-avoiding algorithms accessible from Python.

Similar presentations


Presentation on theme: "Selective, Embedded Just-in- Time Specialization (SEJITS) As a platform for implementing communication-avoiding algorithms accessible from Python."— Presentation transcript:

1 Selective, Embedded Just-in- Time Specialization (SEJITS) As a platform for implementing communication-avoiding algorithms accessible from Python

2 Traditional deployment C/C++ libraries – LAPACK – MKL Accessible from high-level languages like Python using C bindings – Most execution time spent in the library, so it’s fast

3 Problems: Static source code C/C++ library has static source code – Cannot adapt to different architectures – Cannot adapt to different input data – Optimizations and functionality are mixed together SEJITS solves these problems with runtime code generation

4 Problems: Composition

5 Complex operations are formed by combining simpler ones – Application programmer interface consists of an awkward sequence of low-level operations – User doesn’t know how to choose best sequence – Library can’t see future operations SEJITS solves these problems by providing a rich fluent interface and giving you access to the entire expression

6 SEJITS architecture Applications are written in Python, a high- level productivity language When certain functions are called, a specializer is invoked which compiles that function down to C/C++ and executes it on- the-fly Specializers written in Python, supported by Asp infrastructure

7 .so cc/ld SEJITS architecture.py OS/HW f() h() Specializer.c PLL Interp Productivity app $ $ ASP.py

8 Implementation methods Templates – Static C/C++ code with “holes” filled in at runtime for (int i=0; i < ${num_items}; i++) { arr[i] *= 2.0; } – Facilitates compiler optimizations – Allows adapting to machine parameters – Allows choosing among implementations based on architecture

9 Implementation methods Tree transformations – Input/output code expressed as abstract syntax tree – Specializer walks over tree and translates nodes – Facilitates complex transformations and optimizations – Can be used together with templates

10 A k x specializer Built by Jeffrey Morlan Uses a communication-avoiding algorithm to compute A k x for many values of k Building block in other algorithms like Conjugate Gradient Generates different code depending on dimensions of the input matrices as well as their contents

11 A k x specializer Conjugate Gradient solver performance using communication-avoiding matrix powers kernel. A matrix labeled 141K/7.3M has 141K rows and 7.3M nonzero elements. The dark part of each bar shows time spent on matrix powers while the light part shows time in the remainder of the solver.

12 Live exercise SSH to: moonflare.com Log in as username “cs294-76”, password “2xyb3pex” Do: – mkdir yourname – cp *.py *.mako yourname – cd yourname Run with: python double.py View generated C++ in “cache” subdirectory

13 Live exercise Edit double_template.mako – Use your favorite editor or “nano” if you don’t have one Try changing it to multiply the vector by 3.0 instead of 2.0 – Then run “python double.py” again Don’t worry about assertion failure (sorry!)

14 Live exercise Next we’ll make it so you can multiply by any scalar you want Replace constant in double_template.mako with a placeholder ${scalar} Edit double.py – Add a parameter to double_using_template for the scalar multiple – Pass it to mytemplate.render – Update test_generated to add the argument Then run “python double.py” again

15 Download / Questions? Download SEJITS at: – https://github.com/shoaibkamil/asp https://github.com/shoaibkamil/asp – Or just Google “SEJITS” Contact parlab-sejits@lists.eecs for support Questions?


Download ppt "Selective, Embedded Just-in- Time Specialization (SEJITS) As a platform for implementing communication-avoiding algorithms accessible from Python."

Similar presentations


Ads by Google