{"id":17141473,"url":"https://github.com/iskandr/parakeet","last_synced_at":"2025-05-16T00:07:03.362Z","repository":{"id":4740481,"uuid":"5889813","full_name":"iskandr/parakeet","owner":"iskandr","description":"Runtime compiler for numerical Python ","archived":false,"fork":false,"pushed_at":"2025-01-31T16:10:38.000Z","size":8160,"stargazers_count":232,"open_issues_count":0,"forks_count":11,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-04-19T03:05:17.671Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iskandr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-09-20T16:54:18.000Z","updated_at":"2025-01-31T16:10:43.000Z","dependencies_parsed_at":"2025-02-19T16:00:49.624Z","dependency_job_id":"ea9bba9e-4ff0-419c-90f0-1d1a8379b2a6","html_url":"https://github.com/iskandr/parakeet","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iskandr%2Fparakeet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iskandr%2Fparakeet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iskandr%2Fparakeet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iskandr%2Fparakeet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iskandr","download_url":"https://codeload.github.com/iskandr/parakeet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254442854,"owners_count":22071878,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T20:25:30.839Z","updated_at":"2025-05-16T00:06:58.344Z","avatar_url":"https://github.com/iskandr.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Parakeet \n====\n\n**This project is no longer being maintained**. \n\nParakeet was a runtime accelerator for an array-oriented subset of Python. In retrospect, I don't think that whole-function type specialization at the AST level is a scalable approach to speeding up a sufficiently large subset of Python. General-purpose Python code should probably be accelerated using a bytecode JIT, whereas high-performance numerical code should use a DSL with explicit parallel operators. \n\n\n\n\nExample\n=======\n\n\nTo accelerate a function, wrap it with Parakeet's **@jit** decorator:\n\n```python \nimport numpy as np \nfrom parakeet import jit \n\nalpha = 0.5\nbeta = 0.3\nx = np.array([1,2,3])\ny = np.tanh(x * alpha) + beta\n   \n@jit\ndef fast(x, alpha = 0.5, beta = 0.3):\n  return np.tanh(x * alpha) + beta \n   \n@jit \ndef loopy(x, alpha = 0.5, beta = 0.3):\n  y = np.empty_like(x, dtype = float)\n  for i in xrange(len(x)):\n    y[i] = np.tanh(x[i] * alpha) + beta\n  return y\n     \n@jit\ndef comprehension(x, alpha = 0.5, beta = 0.3):\n  return np.array([np.tanh(xi*alpha) + beta for xi in x])\n  \nassert np.allclose(fast(x), y)\nassert np.allclose(loopy(x), y)\nassert np.allclose(comprehension(x), y)\n\n```\n\n\n\nInstall\n====\nYou should be able to install Parakeet from its [PyPI package](https://pypi.python.org/pypi/parakeet/) by running:\n\n    pip install parakeet\n\n\nDependencies\n====\n\nParakeet is written for Python 2.7 (sorry internet) and depends on:\n\n* [dsltools](https://github.com/iskandr/dsltools)\n* [nose](https://nose.readthedocs.org/en/latest/) for unit tests\n* [NumPy](http://www.scipy.org/install.html)\n* [appdirs](https://pypi.python.org/pypi/appdirs/)\n\nThe default backend (which uses OpenMP) requires `gcc` 4.4+. \n\n*Windows*: If you have a 32-bit Windows install, your compiler should come from [Cygwin](http://cygwin.com/install.html) or [MinGW](http://www.mingw.org/). Getting Parakeet working on 64-bit Windows is non-trivial and seems to require [colossal hacks](http://eli.thegreenplace.net/2008/06/28/compiling-python-extensions-with-distutils-and-mingw/).\n\n*Mac OS X*: By default, your machine probably either has only [clang](http://clang.llvm.org/) or an outdated version of `gcc`. You can get a more recent version using [HomeBrew](http://apple.stackexchange.com/questions/38222/how-do-i-install-gcc-via-homebrew)\n\nIf you want to use the CUDA backend, you need to have an NVIDIA graphics card and install both the [CUDA Toolkit](https://developer.nvidia.com/cuda-toolkit) and [PyCUDA](http://mathema.tician.de/software/pycuda/). \n\n\nHow does it work? \n====\nYour untyped function gets used as a template from which multiple *type specializations* are generated \n(for each distinct set of input types). \nThese typed functions are then churned through many optimizations before finally getting translated into native code. \n\nMore information\n===\n\n  * Ask questions on the [discussion group](http://groups.google.com/forum/#!forum/parakeet-python)\n  * Watch the [Parakeet presentation](https://vimeo.com/73895275) from this year's [PyData Boston](http://pydata.org/bos2013), look at the [HotPar slides](https://www.usenix.org/conference/hotpar12/parakeet-just-time-parallel-accelerator-python) from last year \n  * Contact the [main developer](http://www.rubinsteyn.com) directly\n\n\n\nSupported language features\n====\n\nParakeet cannot accelerate arbitrary Python code, it only supports a limited subset of the language:\n\n  * Scalar operations (i.e. `x + 3 * y`)\n  * Control flow (if-statements, loops, etc...)\n  * Nested functions and lambdas\n  * Tuples\n  * Slices\n  * NumPy array expressions (i.e. `x[1:, :] + 2 * y[:-1, ::2]`)\n  * Some NumPy library functions like `np.ones` and `np.sin` (look at the [mappings](https://github.com/iskandr/parakeet/blob/master/parakeet/mappings.py) module for a full list)\n  * List literals (interpreted as array construction)\n  * List comprehensions (interpreted as array comprehensions)\n  * Parakeet's higher order array operations like `parakeet.imap`, `parakeet.scan`, and `parakeet.allpairs`\n\nBackends\n===\nParakeet currently supports compilation to sequential C, multi-core C with OpenMP (default), or LLVM (deprecated). To switch between these options change `parakeet.config.backend` to one of:\n\n  * *\"openmp\"*: compiles with gcc, parallel operators run across multiple cores (default)\n  * *\"c\"*: lowers all parallel operators to loops, compile sequential code with gcc\n  * *\"cuda\"*: launch parallel operations on the GPU (experimental)\n  * *\"llvm\"*: older backend, has fallen behind and some programs may not work\n  * *\"interp\"* : pure Python intepreter used for debugging optimizations, only try this if you think CPython is about 10,000x too fast for your taste \n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiskandr%2Fparakeet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiskandr%2Fparakeet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiskandr%2Fparakeet/lists"}