Skip to content

Feature/build with scikit build and cmake #746

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
5e56e8e
Changed building to use scikit-build and cmake to build dpctl
oleksandr-pavlyk Jan 7, 2022
8e957b1
Use CMAKE_BINARY_DIR not CMAKE_CURRENT_BINARY_DIR to refer to locatio…
oleksandr-pavlyk Jan 14, 2022
93f4d02
Activate internal API to make sycl::program available
oleksandr-pavlyk Jan 23, 2022
771af53
Replaced use of relative path in #include statements
oleksandr-pavlyk Jan 23, 2022
18727b3
Ensure Cython files are built with security flags like before
oleksandr-pavlyk Jan 24, 2022
1f6b40f
Target check launches ctest with DPCTL_VERBOSITY=warning
oleksandr-pavlyk Jan 24, 2022
49f111c
Use cmake_process_manifest_hook setup argument to clean destination f…
oleksandr-pavlyk Jan 24, 2022
4a51351
Add build-time dependency on scikit-build, change build scripts
oleksandr-pavlyk Jan 24, 2022
a83d25a
Fixed GetNumDevices tests, added support for conversion of DPCTL_ALL_…
oleksandr-pavlyk Jan 25, 2022
571fe43
Generate coverage workflow uses scikit-build
oleksandr-pavlyk Jan 24, 2022
25332b3
Vendor IntelDPCPPConfig.cmake
oleksandr-pavlyk Jan 25, 2022
c7f555d
os-llvm-sycl-build workload uses scikit-build
oleksandr-pavlyk Jan 25, 2022
2e3f5cd
Generate docs uses scikit-built setup command
oleksandr-pavlyk Jan 25, 2022
d6618d6
Make the build work on Windows
oleksandr-pavlyk Jan 26, 2022
f965456
Set extra_require keyword for setup.py
oleksandr-pavlyk Jan 26, 2022
1ccf193
Added scripts/get_coverage.py
oleksandr-pavlyk Jan 26, 2022
c7529c6
Added script to drive setup.py develop for use of OS DPC++ sycl bundle
oleksandr-pavlyk Jan 26, 2022
51b41b8
Updated quick start guide to reflect changes in setup
oleksandr-pavlyk Jan 27, 2022
9170510
Fixed driver scripts to use abspath for sanitation
oleksandr-pavlyk Jan 27, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 20 additions & 14 deletions .github/workflows/generate-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

env:
ONEAPI_ROOT: /opt/intel/oneapi
GTEST_ROOT: /home/runner/work/googletest-release-1.10.0/install
GTEST_ROOT: /home/runner/work/googletest-release-1.11.0/install

steps:
- name: Cancel Previous Runs
Expand All @@ -29,8 +29,8 @@ jobs:

- name: Install Intel OneAPI
run: |
sudo apt-get install intel-oneapi-compiler-dpcpp-cpp=2021.3.0-3350
sudo apt-get install intel-oneapi-tbb=2021.3.0-511
sudo apt-get install intel-oneapi-compiler-dpcpp-cpp
sudo apt-get install intel-oneapi-tbb

- name: Install CMake
run: |
Expand All @@ -39,16 +39,16 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
python-version: '3.9'
architecture: x64

- name: Cache Gtest
id: cache-gtest
uses: actions/cache@v2
with:
path: |
/home/runner/work/googletest-release-1.10.0/install
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('/home/runner/work/googletest-release-1.10.0/install/include/gtest/*') }}
/home/runner/work/googletest-release-1.11.0/install
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('/home/runner/work/googletest-release-1.11.0/install/include/gtest/*') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
Expand All @@ -59,12 +59,12 @@ jobs:
shell: bash -l {0}
run: |
cd /home/runner/work
wget https://github.com/google/googletest/archive/refs/tags/release-1.10.0.tar.gz
tar xf release-1.10.0.tar.gz
cd googletest-release-1.10.0
wget https://github.com/google/googletest/archive/refs/tags/release-1.11.0.tar.gz
tar xf release-1.11.0.tar.gz
cd googletest-release-1.11.0
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/home/runner/work/googletest-release-1.10.0/install
cmake .. -DCMAKE_INSTALL_PREFIX=/home/runner/work/googletest-release-1.11.0/install
make && make install

- name: Checkout repo
Expand All @@ -79,14 +79,19 @@ jobs:
- name: Install dpctl dependencies
shell: bash -l {0}
run: |
pip install numpy cython setuptools pytest pytest-cov coverage[toml]
pip install numpy cython setuptools pytest pytest-cov scikit-build coverage[toml]

- name: Build dpctl with coverage
shell: bash -l {0}
run: |
source /opt/intel/oneapi/setvars.sh
python setup.py develop --coverage=True
python -c "import dpctl; print(dpctl.__version__); dpctl.lsplatform()"
export _SAVED_PATH=${PATH}
export PATH=$(dirname $(dirname $(which icx)))/bin-llvm:${PATH}
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)
make -C $(find _skbuild -name tests) lcov-genhtml
export PATH=${_SAVED_PATH}
unset _SAVED_PATH
python -c "import dpctl; print(dpctl.__version__); dpctl.lsplatform()" || exit 1
pytest -q -ra --disable-warnings --cov-config pyproject.toml --cov dpctl --cov-report term-missing --pyargs dpctl -vv

- name: Install coverall dependencies
Expand All @@ -96,8 +101,9 @@ jobs:
pip install coveralls==3.2.0

- name: Upload coverage data to coveralls.io
shell: bash -l {0}
run: |
coveralls-lcov -v -n build_cmake/tests/dpctl.lcov > dpctl-c-api-coverage.json
coveralls-lcov -v -n $(find _skbuild -name tests)/dpctl.lcov > dpctl-c-api-coverage.json
coveralls --service=github --merge=dpctl-c-api-coverage.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/generate-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
if: ${{ !github.event.pull_request || github.event.action != 'closed' }}
shell: bash -l {0}
run: |
pip install numpy cython setuptools sphinx sphinx_rtd_theme pydot graphviz sphinxcontrib-programoutput
pip install numpy cython setuptools scikit-build sphinx sphinx_rtd_theme pydot graphviz sphinxcontrib-programoutput
- name: Checkout repo
uses: actions/checkout@v2
with:
Expand All @@ -60,8 +60,8 @@ jobs:
shell: bash -l {0}
run: |
source /opt/intel/oneapi/setvars.sh
python setup.py develop
python -c "import dpctl; print(dpctl.__version__)"
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}
python -c "import dpctl; print(dpctl.__version__)" || exit 1
- name: Build docs
if: ${{ !github.event.pull_request || github.event.action != 'closed' }}
shell: bash -l {0}
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/os-llvm-sycl-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
- name: Install dpctl dependencies
shell: bash -l {0}
run: |
pip install numpy cython setuptools pytest
pip install numpy cython setuptools pytest scikit-build

- name: Checkout repo
uses: actions/checkout@v2
Expand All @@ -97,5 +97,6 @@ jobs:
export OCL_ICD_FILENAMES=libintelocl.so:libintelocl_emu.so
clang++ --version
sycl-ls
python setup.py develop --sycl-compiler-prefix=$(dirname $(dirname `which clang++`))
python -m pytest -v dpctl/tests
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
python -c "import dpctl; dpctl.lsplatform()" || exit 1
SYCL_ENABLE_HOST_DEVICE=1 python -m pytest -v dpctl/tests
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ __pycache__/

# CMake build and local install directory
build
_skbuild
build_cmake
install

Expand Down
25 changes: 25 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 3.21...3.22 FATAL_ERROR)

project(dpctl
LANGUAGES CXX
DESCRIPTION "Python interface for XPU programming"
)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

find_package(IntelDPCPP REQUIRED PATHS ${CMAKE_SOURCE_DIR}/cmake NO_DEFAULT_PATH)

add_subdirectory(libsyclinterface)

file(GLOB _dpctl_capi_headers dpctl/apis/include/*.h*)
install(FILES ${_dpctl_capi_headers}
DESTINATION dpctl/include
COMPONENT DpctlCAPIHeaders
)

add_subdirectory(dpctl)

if (DPCTL_GENERATE_DOCS)
add_subdirectory(docs)
endif()
Loading