Implementation closely following https://github.com/soda-inria/sklearn-numba-dpex to
compare performance of numba_dpex
-based implementation and DPC++ implementation.
DPC++ implementation can be compiled using intel/llvm open-source DPC++ compiler targeting CUDA, or HIP backends.
This is a work-in-progress work.
- Create a Python 3.9 conda environment with
ninja
as a build system.
conda create -n env_name python=3.9 cmake ninja
- Activate this environment.
conda activate env_name
- Install packages from PyPi
pip install --no-cache-dir packaging setuptools distro scikit-build pytest numpy
- Activate oneAPI compiler and TBB by exporting environment variables:
source /opt/intel/oneapi/compiler/latest/env/vars.sh
source /opt/intel/oneapi/tbb/latest/env/vars.sh
-
Install
dpctl
-
Build it from source
git clone https://github.com/IntelPython/dpctl pushd dpctl python scripts/build_locally.py popd
-
Alternatively you can also install
dpctl
from thedppy/label/dev
conda channel, but you need to ensure that oneAPI compiler's version matches the version of thedpcpp-cpp-rt
conda package installed as dependency of thedpctl
conda package.
-
-
Install
kmeans_dpcpp
(this project) from source
git clone https://github.com/oleksandr-pavlyk/kmeans_dpcpp.git
cd kmeans_dpcpp
python setup.py develop -- -DCMAKE_CXX_COMPILER:PATH=$(which icpx) -DDPCTL_MODULE_PATH=$(python -m dpctl --cmakedir)
Notice that -DCMAKE_CXX_COMPILER
setting is necessary for find_package(IntelDPCPP REQUIRED)
to work.
One can alternatively use CXX
environment variable to specify the compiler:
CXX=icpx python setup.py develop -- -DDPCTL_MODULE_PATH=$(python -m dpctl --cmakedir)
python -m pytest -s tests/
Assuming that CodePlay's plugin enabling support of NVidia GPUs is installed, as well as CUDAToolkit and the drivers:
CXX=icpx python setup.py develop -- -DDPCTL_MODULE_PATH=$(python -m dpctl --cmakedir) -DCUDA=ON
dpctl
compiled with CUDA support is also needed.