A lightweight Python wrapper for a subset of SYCL.
Project description
About dpctl
dpctl (data parallel control) is a lightweight Python package exposing a
subset of the Intel(R) oneAPI DPC++ runtime classes
that is distributed as part of Intel(R) Distribution for Python* and
is included in Intel(R) oneAPI Base ToolKit.
dpctl lets Python users query SYCL platforms, discover and represent SYCL devices, and construct SYCL queues to control data-parallel code execution on Intel(R) XPUs from Python.
dpctl features classes representing SYCL unified shared memory
allocations as well as higher-level objects such as dpctl.tensor.usm_ndarray on top of USM allocations.
dpctl assists authors of Python native extensions written in C,
Cython, or pybind11 to use its dpctl.SyclQueue object to indicate the offload
target as well as objects in dpctl.memory and dpctl.tensor submodules to
represent USM allocations that are accessible from within data-parallel code executed
on the target queue.
dpctl.tensor submodule provides an array container representing an array in a
strided layout on top of a USM allocation. The submodule provides an array-API
conforming oneAPI DPC++ powered library to manipulate the array container.
Requirements
- Install Conda
- Install Intel oneAPI
- Set environment variable
ONEAPI_ROOT- Windows:
C:\Program Files (x86)\Intel\oneAPI\ - Linux:
/opt/intel/oneapi
- Windows:
- Set environment variable
- Install OpenCL HD graphics drivers
Build and Install Conda Package
- Create and activate conda build environment
conda create -n build-env conda-build
conda activate build-env
- Set environment variable
ONEAPI_ROOTand build conda package
export ONEAPI_ROOT=/opt/intel/oneapi
conda build conda-recipe -c ${ONEAPI_ROOT}/conda_channel
On Windows to cope with long file names
use croot with short folder path:
set "ONEAPI_ROOT=C:\Program Files (x86)\Intel\oneAPI\"
conda build --croot=C:/tmp conda-recipe -c "%ONEAPI_ROOT%\conda_channel"
:warning: You could face issues with conda-build=3.20: Use conda-build=3.18!
- Install conda package
conda install dpctl
Build and Install with setuptools
dpctl relies on DPC++ runtime. With Intel oneAPI installed you should activate it.
setup.py requires environment variable ONEAPI_ROOT and following packages
installed:
cythonnumpycmake- for building C APIninja- only on Windows
You need DPC++ to build dpctl. If you want to build using the DPC++ in a oneAPI distribution, activate DPC++ compiler as follows:
export ONEAPI_ROOT=/opt/intel/oneapi
source ${ONEAPI_ROOT}/compiler/latest/env/vars.sh
For install:
python setup.py install
For development:
python setup.py develop
It is also possible to build dpctl using DPC++ toolchain instead of oneAPI DPC++. Instead of activating the oneAPI environment, indicate the toolchain installation prefix with --sycl-compiler-prefix option, e.g.
python setup.py develop --sycl-compiler-prefix=${DPCPP_ROOT}/llvm/build
Please use python setup.py develop --help for more details.
Install Wheel Package from Pypi
- Install dpctl
python -m pip install --index-url https://pypi.anaconda.org/intel/simple --extra-index-url https://pypi.org/simple dpctl
Note: dpctl wheel package is placed on Pypi, but some of its dependencies (like Intel numpy) are in Anaconda Cloud. That is why install command requires additional intel Pypi channel from Anaconda Cloud.
- Set path to Performance Libraries in case of using venv or system Python: On Linux:
export LD_LIBRARY_PATH=<path_to_your_env>/lib
On Windows:
set PATH=<path_to_your_env>\bin;<path_to_your_env>\Library\bin;%PATH%
Using dpctl
dpctl relies on DPC++ runtime. With Intel oneAPI installed you could activate it.
On Windows:
call "%ONEAPI_ROOT%\compiler\latest\env\vars.bat"
On Linux:
source ${ONEAPI_ROOT}/compiler/latest/env/vars.sh
When dpctl is installed via conda package
then it uses DPC++ runtime from dpcpp_cpp_rt package
and it is not necessary to activate oneAPI DPC++ compiler environment.
dpcpp_cpp_rt package is provided by oneAPI conda_channel.
Examples
See examples in folder examples.
Run python examples:
for script in `ls examples/python/`; do echo "executing ${script}"; python examples/python/${script}; done
Examples of building Cython extensions with DPC++ compiler, that interoperate
with dpctl can be found in folder cython.
Each example in cython folder can be built using
CC=icx CXX=dpcpp python setup.py build_ext --inplace.
Please refer to run.py script in respective folders to execute extensions.
Tests
See tests in folder dpctl/tests.
Run tests:
pytest --pyargs dpctl
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dpctl-0.11.2-0-cp39-cp39-win_amd64.whl.
File metadata
- Download URL: dpctl-0.11.2-0-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.6.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c18848302e07fa331392e224562db1bbca2d508659f9f1581348f268ba2e1df
|
|
| MD5 |
1e0144a58b2cf01c17feebc8b7162dea
|
|
| BLAKE2b-256 |
906968c84e9e9857b447b802dbcd6dc8d43ae3ba2bb94dbee8bbce243db8ff08
|
File details
Details for the file dpctl-0.11.2-0-cp39-cp39-manylinux2014_x86_64.whl.
File metadata
- Download URL: dpctl-0.11.2-0-cp39-cp39-manylinux2014_x86_64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.9
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.6.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e461cae7f1553dcc5dd1bfd0c21a1cdb48ff302adf564c17ce83f285799105c
|
|
| MD5 |
dcfa351d41bf7cb15638601456c741e1
|
|
| BLAKE2b-256 |
bf56144c45317535e31b209671c8af8896a73f9ebc6e9a13bbe618590418a3bd
|
File details
Details for the file dpctl-0.11.2-0-cp38-cp38-win_amd64.whl.
File metadata
- Download URL: dpctl-0.11.2-0-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.6.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3521e497facfc6a34c3875a7538d2932e9365b33c35845ea676c049780e1d36
|
|
| MD5 |
836e9851e5a50713f99852d130aebe3d
|
|
| BLAKE2b-256 |
ab3acd8b20cc31bd7f6a58b00d6d197dc50020f179304a6c565967878ac63f09
|
File details
Details for the file dpctl-0.11.2-0-cp38-cp38-manylinux2014_x86_64.whl.
File metadata
- Download URL: dpctl-0.11.2-0-cp38-cp38-manylinux2014_x86_64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.6.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8eee490589f2e297a6f36316fab6f8b74f7aeffe4a9e3dccf2ed9481c9c1ea57
|
|
| MD5 |
7714c9925fce6c25e11678ee61f2bd23
|
|
| BLAKE2b-256 |
7850c3522b01167589814b2e18cfbb5315b5356c83d8b4b28e40f5d726098130
|
File details
Details for the file dpctl-0.11.2-0-cp37-cp37m-win_amd64.whl.
File metadata
- Download URL: dpctl-0.11.2-0-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.6.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b06280970041d83b2ce307812e610c9d24f38707b38fe936cabd797792288eb2
|
|
| MD5 |
68e31c4393ebba9d2ce6513120cfd632
|
|
| BLAKE2b-256 |
bf52b8cad6abce7c7a0d80d575e15b7f9ce82c8e3b5979d9c187fbd00de74dfc
|
File details
Details for the file dpctl-0.11.2-0-cp37-cp37m-manylinux2014_x86_64.whl.
File metadata
- Download URL: dpctl-0.11.2-0-cp37-cp37m-manylinux2014_x86_64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.7m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.6.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6269a12973ef0856f84373799471eac9207fc3878180aeebc0ee026717ebab33
|
|
| MD5 |
4c3dca2ab2559e5ab1542c5b9fc61978
|
|
| BLAKE2b-256 |
23b62b96249a541687cffbeca298304bf3b784b972ff107ee79fb679dedd9869
|