Download PySKI: The Python Sparse Kernel Interface Motivation PySKI Ideas Relation to SEJITS

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

C Sharp syntax wikipedia , lookup

Stream processing wikipedia , lookup

Comment (computer programming) wikipedia , lookup

Abstraction (computer science) wikipedia , lookup

Library (computing) wikipedia , lookup

Object-relational impedance mismatch wikipedia , lookup

Error detection and correction wikipedia , lookup

Coding theory wikipedia , lookup

One-pass compiler wikipedia , lookup

Interpreter (computing) wikipedia , lookup

Program optimization wikipedia , lookup

Transcript
PySKI: The Python Sparse Kernel Interface
Erin Carson, Ben Carpenter, Armando Fox, and James Demmel

Efficiency: Low-level Auto-tuning libraries, such
as OSKI, enable better performance for
scientific computations









2-5x faster (P. Hudak and M. P. Jones, 1994)
Less efficiency
Can we combine the benefits of both?
A python sparse matrix package with some overlap with OSKI
OSKI maintains data structures plus "shadow" data structures for
tuning
Abstract datatypes wrap pointers to these structures


OSKI



1. Build for
Target
Arch.
2. Benchmark
Matrix
f()
$
def check_OSKI(*args):
if OSKI is installed:
if check_for_hint():
set_hints()
tune_mats()
else:
fall through to
scipy SpMV code
@check_OSKI
def _mul_(*args):
History
Benchmark
data
1. Evaluate
Models
2. Select
Data Struct.
& Code
Heuristic
models
PySKI and SEJITS will use the same
infrastructure



PySKI (OSKI) is just a first attempt





Mixed Tuning and Computation




When to change representation of a matrix?
When to do expensive "unmarshal" of a representation?
When to tune and re-tune?
 Setting explicit tuning hints
There are many other auto-tuning libraries that can
be incorporated into higher level languages
Broader goal: enable the user to write high
performance code productively

Must associate explicit tuning hints given by the user with
specific calls
Need to know when and where the call happens
 Current approach: using tags
How much should the user specify?
What if co-tuning is required?
Handling history



Currently OSKI records the calling arguments on every call.
This could in principle be saved across
multiple runs and time-stamped.
Future work: maintain tuning database
Future Work

Identification of the Call Site


All part of the PLL Interpreter
Specializer recognizes that OSKI has a tuned
version of the function being called
Challenges
Matrix handle
for kernel
calls
Currently: C/OSKI requires the user to mix
tuning and computation code – Not productive
perf.
counters
Conclusions and Future Work


tuned
.so
Figure: Flow of control for a PySKI application
To user:
Figure: Overview of the OSKI Auto-tuning Infrastructure
.so
Figure: PySKI as part of the SEJITS Infrastructure
perform matmul
Generated
code
variants
History
Specializer
call OSKI SpMV
gather profiling data
SCIPY SOURCE CODE
.c.c
.c
SEJITS
OS/HW
C = A*b
Workload
from program
monitoring
h()
cc/ld
DECORATOR CODE
A = csr_matrix()
b = array()
Application Run-Time
Library Install-Time (offline)
.c
changes to policy don't contaminate source
policy experimentation can proceed in parallel
Enables performance portability
import scipy.sparse
Optimal tuning choices are often non-obvious
j()
low-level OSKI objects become invisible to mainline computation
USER PROGRAM
C library used in solver libraries
BLAS-style interface (SpMV, SpTS, etc)
Provides automatically tuned kernels for sparse
matrices
g()
.py
Idea: separate tuning hints from main source code


Productivity app
Expose higher-level abstract datatypes & methods to
productivity programmer


Relation to SEJITS
Provide Python bindings for OSKI via scipy.sparse
Complex matrix tuning optimizations
C code enables near peak performance
Hard to write
Productivity: Higher level languages, such as
Python, enable faster/better code development



PySKI Ideas
Install-time
autotuning
Motivation
PLL Interp
Berkeley Parlab



Obtain experimental results for prototype
Implement and release fully functional version
of PySKI
 Integration with SEJITS
Investigate the problems of co-tuning and
maintaining databases for tuning results
Summary: The goal of the PySKI project is to
bridge the gap between the productivity and
efficiency layers of programming. PySKI can allow
scientists to write their code in an expressive,
simple language, while still taking advantage of the
increased performance that OSKI provides through
automated tuning.