PyOpenCL: Pythonic Access to OpenCL, with Arrays and Algorithms
PyOpenCL lets you access GPUs and other massively parallel compute devices from Python. It tries to offer computing goodness in the spirit of its sister project PyCUDA:
- Object cleanup tied to lifetime of objects. This idiom, often called RAII in C++, makes it much easier to write correct, leak- and crash-free code.
- Completeness. PyOpenCL puts the full power of OpenCL's API at
your disposal, if you wish. Every obscure
get_info()
query and all CL calls are accessible. - Automatic Error Checking. All CL errors are automatically translated into Python exceptions.
- Speed. PyOpenCL's base layer is written in C++, so all the niceties above are virtually free.
- Helpful and complete Documentation as well as a Wiki.
- Liberal license. PyOpenCL is open-source under the MIT license and free for commercial, academic, and private use.
- Broad support. PyOpenCL was tested and works with Apple's, AMD's, and Nvidia's CL implementations.
Simple 4-step install instructions using Conda on Linux and macOS (that also install a working OpenCL implementation!) can be found in the documentation.
What you'll need if you do not want to use the convenient instructions above and instead build from source:
- gcc/g++ new enough to be compatible with pybind11 (see their FAQ)
- numpy, and
- an OpenCL implementation. (See this howto for how to get one.)
Links
- Documentation (read how things work)
- Conda Forge (download binary packages for Linux, macOS, Windows)
- Python package index (download releases)
- C. Gohlke's Windows binaries (download Windows binaries)
- Github (get latest source code, file bugs)