CLyther
Encyclopedia
CLyther is a Python
tool similar to Cython
. CLyther is a Python language extension that makes writing OpenCL code as easy as Python itself. CLyther currently only supports a subset of the Python language definition but adds many new features to OpenCL. CLyther was inspired by PyCUDA and its views on metaprogramming
.
CLyther exposes both the OpenCL C library as well as the OpenCL language to python.
function passed to reduce at runtime.
This example shows an extensible OpenCL reduction operation written with CLyther.
To use this example you may run something like.
External links
Python (programming language)
Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability. Python claims to "[combine] remarkable power with very clear syntax", and its standard library is large and comprehensive...
tool similar to Cython
Cython
Cython is a programming language to simplify writing C and C++ extension modules for the CPython Python runtime. Strictly speaking, Cython syntax is a superset of Python syntax additionally supporting:...
. CLyther is a Python language extension that makes writing OpenCL code as easy as Python itself. CLyther currently only supports a subset of the Python language definition but adds many new features to OpenCL. CLyther was inspired by PyCUDA and its views on metaprogramming
Metaprogramming
Metaprogramming is the writing of computer programs that write or manipulate other programs as their data, or that do part of the work at compile time that would otherwise be done at runtime...
.
CLyther exposes both the OpenCL C library as well as the OpenCL language to python.
Features
- Fast prototyping of OpenCL code
- Create OpenCL code using the Python language definition
- Strong object-oriented programmingObject-oriented programmingObject-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...
in OpenCL code - Passing functions as arguments to kernel functions
- Python emulation mode of OpenCL code
- Fancy indexing of arrays
- Device memory management
- Dynamic compilation at runtime
Example
This is an example of a generic OpenCL reduce operator. The arguments include oper which may be a Pythonfunction passed to reduce at runtime.
This example shows an extensible OpenCL reduction operation written with CLyther.
To use this example you may run something like.
External links