nunofernandes-plight / dpctl

A Python library to control XPU devices from Python

Home Page:https://intelpython.github.io/dpctl/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Code style: black Imports: isort pre-commit Coverage Status Generate Documentation

About

oneAPI logo

Data Parallel Control (dpctl) is a Python library that allows a user to control the execution placement of a compute kernel on an XPU. The compute kernel can be either a code written by the user, e.g., using numba-dppy, or a code that is part of a library like oneMKL. The dpctl library is built upon the SYCL standard and implements Python bindings for a subset of the standard runtime classes that allow users to query platforms, discover and represent devices and sub-devices, and construct contexts and queues. In addition, dpctl features classes for SYCL Unified Shared Memory (USM) management and implements a tensor array API.

The library also assists authors of Python native extensions written in C, Cython, or pybind11 to access dpctl objects representing SYCL devices, queues, memory, and tensors.

Dpctl is the core part of a larger family of data-parallel Python libraries and tools to program XPUs. The library is available via conda and pip. It is included in the Intel(R) Distribution for Python* (IDP).

Installing

From Intel oneAPI

dpctl is packaged as part of the quarterly Intel oneAPI releases. To get the library from the latest oneAPI release please follow the instructions from Intel's oneAPI installation guide. Note that you will need to install the Intel BaseKit toolkit to get IDP and dpctl.

From Conda

dpctl package is available on the Intel channel on Annaconda cloud. You an use the following to install dpctl from there:

conda install dpctl -c intel

From PyPi

dpctl is also available from PyPi and can be installed using:

pip3 install dpctl

Installing the bleeding edge

If you want to try out the current master, you can install it from our development channel on Anaconda cloud:

conda install dpctl -c dppy\label\dev

Building

Please refer our getting started user guide for more information on setting up a development environment and building dpctl from source.

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

Running Tests

Tests are located in folder dpctl/tests.

Run tests:

pytest --pyargs dpctl

About

A Python library to control XPU devices from Python

https://intelpython.github.io/dpctl/

License:Apache License 2.0


Languages

Language:C++ 40.3%Language:Python 31.0%Language:Cython 23.0%Language:CMake 3.7%Language:C 1.5%Language:Shell 0.2%Language:Batchfile 0.2%