Getting Started
Installation
Numba-dpex depends on following components:
numba 0.54.* or 0.55.* (Numba)
dpctl 0.13.* (Intel Python dpctl)
dpnp 0.10.1 (Intel Python DPNP)
dpcpp-llvm-spirv (SPIRV generation from LLVM IR)
llvmdev (LLVM IR generation)
scipy (for testing)
pytest (for testing)
It is recommended to use conda packages from Intel Distribution for Python channel or anaconda.org/intel channel. Intel Distribution for Python is available from Intel oneAPI.
Create conda environment:
export ONEAPI_ROOT=/opt/intel/oneapi
conda create -n numba-dpex-env numba-dpex dpnp -c ${ONEAPI_ROOT}/conda_channel
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_ROOT and build conda package:
export ONEAPI_ROOT=/opt/intel/oneapi
conda build conda-recipe -c ${ONEAPI_ROOT}/conda_channel
Install conda package:
conda install numba-dpex
Build and Install with setuptools
setup.py requires environment variable ONEAPI_ROOT and following packages
installed in conda environment:
export ONEAPI_ROOT=/opt/intel/oneapi
conda create -n numba-dpex-env -c ${ONEAPI_ROOT}/conda_channel python=3.7 dpctl dpnp numba spirv-tools dpcpp-llvm-spirv llvmdev pytest
conda activate numba-dpex-env
Activate DPC++ compiler:
source ${ONEAPI_ROOT}/compiler/latest/env/vars.sh
For installing:
python setup.py install
For development:
python setup.py develop
Build and Install with docker
docker run --rm -it \
-v /path/to/numba-dpex/source:/build \
-v /path/to/dist:/dist
ghcr.io/intelpython/numba-dpex/builder:0.20.0-py3.10
python setup.py develop
python setup.py bdist_wheel
cp dist/numba_dpex*.whl /dist/
Now you can install numba-dpex wheel in whatever compatible environment with pip.
You will find numba_dpex*.whl file in the /path/to/dist location in
your host system.
You can check what dpctl and dpnp is shipped with builder by running pip list.
In case you need another version, consider building builder target with necessary
build args. Refer to Docker section for more details.
Testing
See folder numba_dpex/tests.
To run the tests:
python -m pytest --pyargs numba_dpex.tests
Examples
See folder numba_dpex/examples.
To run the examples:
python numba_dpex/examples/sum.py
Docker
An easy way you can try numba_dpex is by using docker. To try out numba dpex simply run:
docker run --rm -it ghcr.io/intelpython/numba-dpex/runtime:0.20.0-py3.10
import dpctl
dpctl.lsplatform()
Refer to Docker section for more options.