Skip to content

cournape/parakeet

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Parakeet: Runtime accelerator for numerical Python

If you have intolerably slow numerical algorithms written in Python, Parakeet may be able to significantly speed up your bottleneck through type specialization and native code generation.

To accelerate a function, wrap it with Parakeet's @jit decorator:

   import numpy as np 
   
   def slow(x, alpha = 0.5, beta = 0.3):
     y = np.empty_like(x)
     for i in xrange(len(x)):
       y[i] = np.tanh(x[i] * alpha + beta)
     return y
     
  from parakeet import jit 
  @jit
  def fast(x, alpha = 0.5, beta = 0.3):
    y = np.empty_like(x)
    for i in xrange(len(x)):
      y[i] = np.tanh(x[i] * alpha + beta)
    return x 
    
  @jit
  def fast_comprehension(x, alpha = 0.5, beta = 0.3):
    return [np.tanh(xi*alpha + beta) for xi in x] 

Parakeet cannot accelerate arbitrary Python code, it only supports a limited subset of the language:

  • Scalar operations (i.e. addition, multiplication, etc...)
  • Control flow (if-statements, loops, etc...)
  • Tuples
  • Slices
  • NumPy arrays (and some NumPy library functions)
  • List literals (interpreted as array construction)
  • List comprehensions (interpreted as array comprehensions)
  • Parakeet's "adverbs" (higher order array operations like parakeet.map, parakeet.reduce)

Parakeet is written for Python 2.7 (sorry internet) and depends on:

If you have any questions about the project either check out our HotPar slides from last year or contact the main developer.

About

Runtime compiler for numerical Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published