diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..5ace460 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 27b0fb1..96c65af 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -4,14 +4,16 @@ on: push: branches: [main] +permissions: read-all + jobs: - setup_develop: - name: Build packages with DPC++ + build_and_test_kde_setuptools: + name: Build kde_setuptools with DPC++ runs-on: Ubuntu-latest steps: - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.11.0 + uses: styfle/cancel-workflow-action@0.12.1 with: access_token: ${{ github.token }} @@ -32,14 +34,16 @@ jobs: run: echo $CONDA/bin >> $GITHUB_PATH - name: Checkout repo - uses: actions/checkout@v2 + uses: actions/checkout@v4.1.1 with: fetch-depth: 0 - name: Install dependencies run: | - conda install python=3.10 dpctl -c dppy/label/dev -c intel -c conda-forge --override-channels - pip install --no-cache-dir cython scikit-build pybind11 pytest cmake ninja + source $CONDA/etc/profile.d/conda.sh + conda create -n build_kde_setuptools python=3.10 dpctl -c dppy/label/dev -c intel -c conda-forge --override-channels + conda activate build_kde_setuptools + pip install --no-cache-dir cython pybind11 pytest cmake ninja conda list - name: Build kde_setuptools @@ -47,17 +51,60 @@ jobs: source /opt/intel/oneapi/setvars.sh export OCL_ICD_FILENAMES=libintelocl.so pushd kde_setuptools + source $CONDA/etc/profile.d/conda.sh + conda activate build_kde_setuptools python setup.py develop python -m pytest tests popd + + build_and_test_kde_skbuild: + name: Build kde_skbuild with DPC++ + runs-on: Ubuntu-latest + + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.12.1 + with: + access_token: ${{ github.token }} + + - name: Add Intel repository + run: | + wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB + sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB + rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB + sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main" + sudo apt-get update + + - name: Install Intel OneAPI + run: | + sudo apt-get install intel-oneapi-compiler-dpcpp-cpp + sudo apt-get install intel-oneapi-tbb + + - name: Add conda to system path + run: echo $CONDA/bin >> $GITHUB_PATH + + - name: Checkout repo + uses: actions/checkout@v4.1.1 + with: + fetch-depth: 0 + + - name: Install dependencies + run: | + source $CONDA/etc/profile.d/conda.sh + conda create -n build_kde_skbuild python=3.10 dpctl -c dppy/label/dev -c intel -c conda-forge --override-channels + conda activate build_kde_skbuild + pip install --no-cache-dir cython scikit-build pybind11 pytest cmake ninja + conda list + - name: Build kde_skbuild run: | source /opt/intel/oneapi/setvars.sh export OCL_ICD_FILENAMES=libintelocl.so pushd kde_skbuild + source $CONDA/etc/profile.d/conda.sh + conda activate build_kde_skbuild CC=icx CXX=icpx python setup.py develop -G Ninja \ - -- -DCMAKE_VERBOSE_MAKEFILE=ON \ - -DDPCTL_MODULE_PATH=$(python -m dpctl --cmakedir) + -- -DCMAKE_VERBOSE_MAKEFILE=ON python -m pytest tests popd diff --git a/common_ext/cy_kde.pyx b/common_ext/cy_kde.pyx index 078424e..3dca3ee 100644 --- a/common_ext/cy_kde.pyx +++ b/common_ext/cy_kde.pyx @@ -1,4 +1,4 @@ -# Copyright 2022 Intel Corporation +# Copyright 2022-2024 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/common_ext/py_kde.cpp b/common_ext/py_kde.cpp index 293e310..dc00629 100644 --- a/common_ext/py_kde.cpp +++ b/common_ext/py_kde.cpp @@ -1,4 +1,4 @@ -// Copyright 2022 Intel Corporation +// Copyright 2022-2024 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/common_src/kde.hpp b/common_src/kde.hpp index d2d3a51..67ec3ae 100644 --- a/common_src/kde.hpp +++ b/common_src/kde.hpp @@ -1,4 +1,4 @@ -// Copyright 2022 Intel Corporation +// Copyright 2022-2024 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/common_src/main.cpp b/common_src/main.cpp deleted file mode 100644 index 1fc674e..0000000 --- a/common_src/main.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2022 Intel Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This is auxiliary file used to test kde.hpp - -#include -#include -#include "kde.hpp" - -int main(void) { - sycl::queue q; - - using T = double; - - size_t n = 4; - size_t n_data = 16253; - - T *x = new T[n]; - T *f = new T[n]; - T *x_data = new T[n_data]; - - for(size_t i=0; i < n; ++i) { - x[i] = T(i+2)/T(n+4); - } - - std::random_device r; - std::default_random_engine e(r()); - std::uniform_real_distribution uniform_d(T(0), T(1)); - - for(size_t i=0; i < n_data; ++i) { - x_data[i] = uniform_d(e); - } - - example::kernel_density_estimate( - q, - static_cast(1), - const_cast(x), - f, n, - const_cast(x_data), - n_data, 0.2 - ); - - for(size_t i=0; i < n; ++i) { - std::cout << "f(" << x[i] << ")=" << f[i] << std::endl; - } - - return 0; -} diff --git a/kde_setuptools/kde_setuptools/__init__.py b/kde_setuptools/kde_setuptools/__init__.py index 2c15bf1..7c2abba 100644 --- a/kde_setuptools/kde_setuptools/__init__.py +++ b/kde_setuptools/kde_setuptools/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2022 Intel Corporation +# Copyright 2022-2024 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/kde_setuptools/setup.py b/kde_setuptools/setup.py index 8546824..ece3824 100644 --- a/kde_setuptools/setup.py +++ b/kde_setuptools/setup.py @@ -1,4 +1,4 @@ -# Copyright 2022 Intel Corporation +# Copyright 2022-2024 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/kde_setuptools/tests/test_cy_kde.py b/kde_setuptools/tests/test_cy_kde.py index 4427393..775fcf5 100644 --- a/kde_setuptools/tests/test_cy_kde.py +++ b/kde_setuptools/tests/test_cy_kde.py @@ -1,4 +1,4 @@ -# Copyright 2022 Intel Corporation +# Copyright 2022-2024 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/kde_setuptools/tests/test_py_kde.py b/kde_setuptools/tests/test_py_kde.py index f8b8c51..c7966e3 100644 --- a/kde_setuptools/tests/test_py_kde.py +++ b/kde_setuptools/tests/test_py_kde.py @@ -1,4 +1,4 @@ -# Copyright 2022 Intel Corporation +# Copyright 2022-2024 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/kde_skbuild/CMakeLists.txt b/kde_skbuild/CMakeLists.txt index 0be5e81..7f61900 100644 --- a/kde_skbuild/CMakeLists.txt +++ b/kde_skbuild/CMakeLists.txt @@ -2,21 +2,11 @@ cmake_minimum_required(VERSION 3.22...3.27 FATAL_ERROR) project(oneapi_kde_skbuild VERSION 0.1 LANGUAGES C CXX DESCRIPTION "Example of DPC++-based Python extension") -if (NOT DEFINED DPCTL_MODULE_PATH) - if (DEFINED ENV{DPCTL_MODULE_PATH}) - set(DPCTL_MODULE_PATH $ENV{DPCTL_MODULE_PATH}) - else () - message(FATAL_ERROR "Specify DPCTL_MODULE_PATH, either via cmake or as environment varibale") - endif() -endif() - -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${DPCTL_MODULE_PATH}) find_package(IntelSYCL REQUIRED) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED True) - # Define CMAKE_INSTALL_xxx: LIBDIR, INCLUDEDIR include(GNUInstallDirs) diff --git a/kde_skbuild/README.md b/kde_skbuild/README.md index bfd0d4c..05533e8 100644 --- a/kde_skbuild/README.md +++ b/kde_skbuild/README.md @@ -1,18 +1,17 @@ # Building this extension -Assuming `numpy`, `Cython`, `pybind11`, `pytest`, `scikit-build`, `cmake >=3.21`, and `ninja` are installed -and DCP++ has been activated: +Assuming `numpy`, `Cython`, `pybind11`, `pytest`, `scikit-build`, `cmake >=3.21`, `dpctl`, and `ninja` are +installed and DCP++ has been activated: ```bash -CC=icx CXX=icpx python setup.py develop -G Ninja -- -DDPCTL_MODULE_PATH=$(python -m dpctl --cmakedir) +CC=icx CXX=icpx python setup.py develop -G Ninja pytest -m tests ``` Scikit-build enables building Python native extensions using CMake. This package leverage integration DPC++ with CMake [dpcpp-cmake-integration] as well as integration of `dpctl` with CMake. -**Note**: Building this package requires the using latest development version of `dpctl`. -This can be installed using conda package manager using +The latest version of `dpctl` can be installed using conda package manager using ```bash conda install -c dppy/label/dev dpctl