Skip to main content

A lightweight Python wrapper for a subset of SYCL.

Project description

Code style: black Imports: isort Coverage Status

About dpctl

oneAPI logo

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
  • Install OpenCL HD graphics drivers

Build and Install Conda Package

  1. Create and activate conda build environment
conda create -n build-env conda-build
conda activate build-env
  1. Set environment variable ONEAPI_ROOT and 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!

  1. 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:

  • cython
  • numpy
  • cmake - for building C API
  • ninja - 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

  1. 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.

  1. 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=clang 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

dpctl-0.11.0-0-cp39-cp39-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.9Windows x86-64

dpctl-0.11.0-0-cp39-cp39-manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.9

dpctl-0.11.0-0-cp38-cp38-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.8Windows x86-64

dpctl-0.11.0-0-cp38-cp38-manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.8

dpctl-0.11.0-0-cp37-cp37m-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.7mWindows x86-64

dpctl-0.11.0-0-cp37-cp37m-manylinux2014_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.7m

File details

Details for the file dpctl-0.11.0-0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: dpctl-0.11.0-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.4.2 importlib_metadata/4.6.4 pkginfo/1.6.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9

File hashes

Hashes for dpctl-0.11.0-0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 458302c99b600db218093de7dfd424c0791c8024fc8b98ad0d925e350b53983e
MD5 0c2bc14cb42fe3dfabb06208a5c4f05c
BLAKE2b-256 c1aeb682b6d7f002e713943f8f99989d163550e993d46e49e818898a3628d82f

See more details on using hashes here.

File details

Details for the file dpctl-0.11.0-0-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

  • Download URL: dpctl-0.11.0-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.4.2 importlib_metadata/4.6.4 pkginfo/1.6.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9

File hashes

Hashes for dpctl-0.11.0-0-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 40ed75d29043439027157e3c24a0eb33cd278d6f258863dc488ae7d845cc2893
MD5 dd7755bdf6d38d09e26fad52f27d90a5
BLAKE2b-256 faf488c0330cc99c8bb41b04b86f433667d034f942d5f6cc8427451819f76d01

See more details on using hashes here.

File details

Details for the file dpctl-0.11.0-0-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: dpctl-0.11.0-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.4.2 importlib_metadata/4.6.4 pkginfo/1.6.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9

File hashes

Hashes for dpctl-0.11.0-0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 79a1b7163eaba1605096de51f975eed13d8945dda3f2a31702918422059a49ff
MD5 964961a5b8e88b6026a40d2f18d167dd
BLAKE2b-256 720a9894642f5f6138669ac2e7f2ffa1351b652d575dbdddcdc52a5fd6d3b761

See more details on using hashes here.

File details

Details for the file dpctl-0.11.0-0-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

  • Download URL: dpctl-0.11.0-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.4.2 importlib_metadata/4.6.4 pkginfo/1.6.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9

File hashes

Hashes for dpctl-0.11.0-0-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 740a6d463ecaf49385929bec1b9588b4f158f1372475739d323ecf376b79a839
MD5 d60986ba94a433df6fbbd7ab848b400d
BLAKE2b-256 4b430c193ee29307002c9e7d4ffd70da744b653817796d7882f0e449f55f80ab

See more details on using hashes here.

File details

Details for the file dpctl-0.11.0-0-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: dpctl-0.11.0-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.4.2 importlib_metadata/4.6.4 pkginfo/1.6.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9

File hashes

Hashes for dpctl-0.11.0-0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 f69963edb3345d6e3168306c3b0c32d83c2edbde04552f0dadec8686a0d2d3c5
MD5 41c7bbfe15a3216886de40899ebf4541
BLAKE2b-256 5678a6ba85b323c660dfb26a307510ee181f1e0b4f597138bcd5b14249e7a502

See more details on using hashes here.

File details

Details for the file dpctl-0.11.0-0-cp37-cp37m-manylinux2014_x86_64.whl.

File metadata

  • Download URL: dpctl-0.11.0-0-cp37-cp37m-manylinux2014_x86_64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.6.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.9

File hashes

Hashes for dpctl-0.11.0-0-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8bf495ec2bb635a69bb45ce47869cbe3f6c799f36876efc6511b2f4874467998
MD5 e50f6499d5a3909ffc714e8416504b44
BLAKE2b-256 2ad6855802767f0971c5b605cdb22ef65f86d3144952cd1bca9ccc7110248910

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page