Python bindings for CLBlast, the tuned OpenCL BLAS library
Project description
PyCLBlast: Python wrappers for the tuned OpenCL BLAS library CLBlast
This Python package provides a straightforward wrapper for CLBast based on PyOpenCL. CLBlast is a modern, lightweight, performant and tunable OpenCL BLAS library written in C++11. It is designed to leverage the full performance potential of a wide variety of OpenCL devices from different vendors, including desktop and laptop GPUs, embedded GPUs, and other accelerators. CLBlast implements BLAS routines: basic linear algebra subprograms operating on vectors and matrices.
See the CLBlast repository and the CLBlast website for more information about CLBlast.
Prerequisites
Non-Python requirements:
- OpenCL
- CLBlast
Getting started
After installing OpenCL and CLBlast, simply use pip to install PyCLBlast, e.g.:
pip install --user pyclblast
To start using the library, browse the CLBlast documentation or check out the PyCLBlast samples provided in the samples
subfolder.
For developers, install CLBlast and cython (e.g. in a Python3 virtualenv):
pip install Cython
And then compile the bindings from this location using pip:
pip install .
Detecting CLBlast
The CLBlast library should be present and detectable to your system, to successfully install the PyCLBlast bindings. In some systems, this is done automatically. But if the CLBlast library cannot be detected, the PyCLBlast installation will fail. To ensure detection, one can apply either of the following:
-
Add the CLBLast root directory to the environment path.
-
Create the environment variable
CLBLAST_ROOT
that holds the path to the CLBLast root directory. -
Define the
cmake
variablesCMAKE_PREFIX_PATH
or theCLBLAST_ROOT
variable that point to the CLBlast root directory, as:pip install . -C skbuild.cmake.args="-DCMAKE_PREFIX_PATH=/root/path/to/clblast"
-
Create the environment variable
CLBlast_DIR
that holds the path to the directory where either of theCLBlastConfig.cmake
orclblast-config.cmake
files reside.
Note that the aforementioned environment variables should be set only during the installation of PyCLBlast and can be unset during normal use.
Testing PyCLBlast
The main exhaustive tests are the main CLBlast test binaries. Apart from that, you can also run the PyCLBlast smoke tests from the test
subfolder, e.g. as follows:
python -m unittest discover
How to release a new version on PyPi
Following the guide, in essence doing (after changing the version number in setup.py
):
python3 -m build
python3 -m twine upload --repository pypi dist/pyclblast-1.4.0.tar.gz
# use '__token__' as username and supply the token from your PyPi account
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file pyclblast-1.4.0.tar.gz
.
File metadata
- Download URL: pyclblast-1.4.0.tar.gz
- Upload date:
- Size: 1.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/51.3.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1763d699b2dbe6fbde83c041d272cb5811a12def79d2b7a28d38e3706ef98463 |
|
MD5 | 6834d5dd38948ecafb24e00f22ede05f |
|
BLAKE2b-256 | 39f84ba993bb0dbe9f0041386bc716a4e8dd4711ea765294d24945593a556da9 |