Skip to content

Commit 8b17f1c

Browse files
Merge pull request #746 from IntelPython/feature/build_with_scikit-build_and_cmake
Change of build system for dpctl to scikit-build and cmake. Build with DPC++ using its integration with cmake added in cmake=3.21
2 parents a2b6a9c + 9170510 commit 8b17f1c

36 files changed

+996
-704
lines changed

.github/workflows/generate-coverage.yaml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111

1212
env:
1313
ONEAPI_ROOT: /opt/intel/oneapi
14-
GTEST_ROOT: /home/runner/work/googletest-release-1.10.0/install
14+
GTEST_ROOT: /home/runner/work/googletest-release-1.11.0/install
1515

1616
steps:
1717
- name: Cancel Previous Runs
@@ -29,8 +29,8 @@ jobs:
2929
3030
- name: Install Intel OneAPI
3131
run: |
32-
sudo apt-get install intel-oneapi-compiler-dpcpp-cpp=2021.3.0-3350
33-
sudo apt-get install intel-oneapi-tbb=2021.3.0-511
32+
sudo apt-get install intel-oneapi-compiler-dpcpp-cpp
33+
sudo apt-get install intel-oneapi-tbb
3434
3535
- name: Install CMake
3636
run: |
@@ -39,16 +39,16 @@ jobs:
3939
- name: Setup Python
4040
uses: actions/setup-python@v2
4141
with:
42-
python-version: '3.8'
42+
python-version: '3.9'
4343
architecture: x64
4444

4545
- name: Cache Gtest
4646
id: cache-gtest
4747
uses: actions/cache@v2
4848
with:
4949
path: |
50-
/home/runner/work/googletest-release-1.10.0/install
51-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('/home/runner/work/googletest-release-1.10.0/install/include/gtest/*') }}
50+
/home/runner/work/googletest-release-1.11.0/install
51+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('/home/runner/work/googletest-release-1.11.0/install/include/gtest/*') }}
5252
restore-keys: |
5353
${{ runner.os }}-build-${{ env.cache-name }}-
5454
${{ runner.os }}-build-
@@ -59,12 +59,12 @@ jobs:
5959
shell: bash -l {0}
6060
run: |
6161
cd /home/runner/work
62-
wget https://github.com/google/googletest/archive/refs/tags/release-1.10.0.tar.gz
63-
tar xf release-1.10.0.tar.gz
64-
cd googletest-release-1.10.0
62+
wget https://github.com/google/googletest/archive/refs/tags/release-1.11.0.tar.gz
63+
tar xf release-1.11.0.tar.gz
64+
cd googletest-release-1.11.0
6565
mkdir build
6666
cd build
67-
cmake .. -DCMAKE_INSTALL_PREFIX=/home/runner/work/googletest-release-1.10.0/install
67+
cmake .. -DCMAKE_INSTALL_PREFIX=/home/runner/work/googletest-release-1.11.0/install
6868
make && make install
6969
7070
- name: Checkout repo
@@ -79,14 +79,19 @@ jobs:
7979
- name: Install dpctl dependencies
8080
shell: bash -l {0}
8181
run: |
82-
pip install numpy cython setuptools pytest pytest-cov coverage[toml]
82+
pip install numpy cython setuptools pytest pytest-cov scikit-build coverage[toml]
8383
8484
- name: Build dpctl with coverage
8585
shell: bash -l {0}
8686
run: |
8787
source /opt/intel/oneapi/setvars.sh
88-
python setup.py develop --coverage=True
89-
python -c "import dpctl; print(dpctl.__version__); dpctl.lsplatform()"
88+
export _SAVED_PATH=${PATH}
89+
export PATH=$(dirname $(dirname $(which icx)))/bin-llvm:${PATH}
90+
python setup.py develop -- -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER:PATH=icx -DCMAKE_CXX_COMPILER:PATH=icpx -DDPCTL_ENABLE_LO_PROGRAM_CREATION=ON -DDPCTL_GENERATE_COVERAGE=ON -DDPCTL_BUILD_CAPI_TESTS=ON -DDPCTL_COVERAGE_REPORT_OUTPUT_DIR=$(pwd)
91+
make -C $(find _skbuild -name tests) lcov-genhtml
92+
export PATH=${_SAVED_PATH}
93+
unset _SAVED_PATH
94+
python -c "import dpctl; print(dpctl.__version__); dpctl.lsplatform()" || exit 1
9095
pytest -q -ra --disable-warnings --cov-config pyproject.toml --cov dpctl --cov-report term-missing --pyargs dpctl -vv
9196
9297
- name: Install coverall dependencies
@@ -96,8 +101,9 @@ jobs:
96101
pip install coveralls==3.2.0
97102
98103
- name: Upload coverage data to coveralls.io
104+
shell: bash -l {0}
99105
run: |
100-
coveralls-lcov -v -n build_cmake/tests/dpctl.lcov > dpctl-c-api-coverage.json
106+
coveralls-lcov -v -n $(find _skbuild -name tests)/dpctl.lcov > dpctl-c-api-coverage.json
101107
coveralls --service=github --merge=dpctl-c-api-coverage.json
102108
env:
103109
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/generate-docs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
if: ${{ !github.event.pull_request || github.event.action != 'closed' }}
5050
shell: bash -l {0}
5151
run: |
52-
pip install numpy cython setuptools sphinx sphinx_rtd_theme pydot graphviz sphinxcontrib-programoutput
52+
pip install numpy cython setuptools scikit-build sphinx sphinx_rtd_theme pydot graphviz sphinxcontrib-programoutput
5353
- name: Checkout repo
5454
uses: actions/checkout@v2
5555
with:
@@ -60,8 +60,8 @@ jobs:
6060
shell: bash -l {0}
6161
run: |
6262
source /opt/intel/oneapi/setvars.sh
63-
python setup.py develop
64-
python -c "import dpctl; print(dpctl.__version__)"
63+
python setup.py develop -- -DCMAKE_C_COMPILER:PATH=icx -DCMAKE_CXX_COMPILER:PATH=icpx -DDPCTL_ENABLE_LO_PROGRAM_CREATION=ON -DDPCTL_DPCPP_HOME_DIR=${BUILD_PREFIX}
64+
python -c "import dpctl; print(dpctl.__version__)" || exit 1
6565
- name: Build docs
6666
if: ${{ !github.event.pull_request || github.event.action != 'closed' }}
6767
shell: bash -l {0}

.github/workflows/os-llvm-sycl-build.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
- name: Install dpctl dependencies
8080
shell: bash -l {0}
8181
run: |
82-
pip install numpy cython setuptools pytest
82+
pip install numpy cython setuptools pytest scikit-build
8383
8484
- name: Checkout repo
8585
uses: actions/checkout@v2
@@ -97,5 +97,6 @@ jobs:
9797
export OCL_ICD_FILENAMES=libintelocl.so:libintelocl_emu.so
9898
clang++ --version
9999
sycl-ls
100-
python setup.py develop --sycl-compiler-prefix=$(dirname $(dirname `which clang++`))
101-
python -m pytest -v dpctl/tests
100+
python setup.py develop -- -G "Unix Makefiles" -DCMAKE_C_COMPILER:PATH=clang -DCMAKE_CXX_COMPILER:PATH=clang++ -DDPCTL_ENABLE_LO_PROGRAM_CREATION=ON -DDPCTL_DPCPP_HOME_DIR=$(dirname $(dirname $(which clang))) -DDPCTL_DPCPP_FROM_ONEAPI=OFF
101+
python -c "import dpctl; dpctl.lsplatform()" || exit 1
102+
SYCL_ENABLE_HOST_DEVICE=1 python -m pytest -v dpctl/tests

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ __pycache__/
1313

1414
# CMake build and local install directory
1515
build
16+
_skbuild
1617
build_cmake
1718
install
1819

CMakeLists.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
cmake_minimum_required(VERSION 3.21...3.22 FATAL_ERROR)
2+
3+
project(dpctl
4+
LANGUAGES CXX
5+
DESCRIPTION "Python interface for XPU programming"
6+
)
7+
8+
set(CMAKE_CXX_STANDARD 17)
9+
set(CMAKE_CXX_STANDARD_REQUIRED True)
10+
11+
find_package(IntelDPCPP REQUIRED PATHS ${CMAKE_SOURCE_DIR}/cmake NO_DEFAULT_PATH)
12+
13+
add_subdirectory(libsyclinterface)
14+
15+
file(GLOB _dpctl_capi_headers dpctl/apis/include/*.h*)
16+
install(FILES ${_dpctl_capi_headers}
17+
DESTINATION dpctl/include
18+
COMPONENT DpctlCAPIHeaders
19+
)
20+
21+
add_subdirectory(dpctl)
22+
23+
if (DPCTL_GENERATE_DOCS)
24+
add_subdirectory(docs)
25+
endif()

0 commit comments

Comments
 (0)