Skip to content

Commit 0690d49

Browse files
Merge remote-tracking branch 'origin/master' into gold/2021
2 parents 5166e25 + 335fb23 commit 0690d49

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1231
-600
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dpctl/_version.py export-subst

.github/workflows/generate-coverage.yaml

+15-5
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ jobs:
3232
sudo apt-get install intel-oneapi-compiler-dpcpp-cpp
3333
sudo apt-get install intel-oneapi-tbb
3434
35-
- name: Install CMake
35+
- name: Install CMake and Ninja
3636
run: |
37-
sudo apt-get install cmake
37+
sudo apt-get install cmake ninja-build
3838
3939
- name: Setup Python
4040
uses: actions/setup-python@v2
@@ -87,8 +87,18 @@ jobs:
8787
source /opt/intel/oneapi/setvars.sh
8888
export _SAVED_PATH=${PATH}
8989
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
90+
python setup.py develop -- \
91+
-G "Ninja" \
92+
-DCMAKE_BUILD_TYPE=Debug \
93+
-DCMAKE_C_COMPILER:PATH=icx \
94+
-DCMAKE_CXX_COMPILER:PATH=icpx \
95+
-DDPCTL_ENABLE_LO_PROGRAM_CREATION=ON \
96+
-DDPCTL_GENERATE_COVERAGE=ON \
97+
-DDPCTL_BUILD_CAPI_TESTS=ON \
98+
-DDPCTL_COVERAGE_REPORT_OUTPUT_DIR=$(pwd)
99+
pushd $(find _skbuild -name cmake-build)
100+
cmake --build . --target lcov-genhtml || exit 1
101+
popd
92102
export PATH=${_SAVED_PATH}
93103
unset _SAVED_PATH
94104
python -c "import dpctl; print(dpctl.__version__); dpctl.lsplatform()" || exit 1
@@ -98,7 +108,7 @@ jobs:
98108
shell: bash -l {0}
99109
run: |
100110
sudo gem install coveralls-lcov
101-
pip install coveralls==3.2.0
111+
pip install coveralls
102112
103113
- name: Upload coverage data to coveralls.io
104114
shell: bash -l {0}

.github/workflows/generate-docs.yml

+16-19
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ jobs:
3535
if: ${{ !github.event.pull_request || github.event.action != 'closed' }}
3636
run: |
3737
sudo apt-get install doxygen
38-
- name: Install CMake
38+
- name: Install CMake and Ninja
3939
if: ${{ !github.event.pull_request || github.event.action != 'closed' }}
4040
run: |
41-
sudo apt-get install cmake
41+
sudo apt-get install cmake ninja-build
4242
- name: Setup Python
4343
if: ${{ !github.event.pull_request || github.event.action != 'closed' }}
4444
uses: actions/setup-python@v2
@@ -55,31 +55,28 @@ jobs:
5555
with:
5656
fetch-depth: 0
5757
persist-credentials: false
58-
- name: Build dpctl
59-
if: ${{ !github.event.pull_request || github.event.action != 'closed' }}
60-
shell: bash -l {0}
61-
run: |
62-
source /opt/intel/oneapi/setvars.sh
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
65-
- name: Build docs
58+
- name: Build dpctl+docs
6659
if: ${{ !github.event.pull_request || github.event.action != 'closed' }}
6760
shell: bash -l {0}
6861
run: |
6962
# Ensure that SYCL libraries are on LD_LIBRARY_PATH
7063
source /opt/intel/oneapi/setvars.sh
71-
cd docs
72-
mkdir -p build && cd build && rm -rf *
7364
wget https://github.com/vovkos/doxyrest/releases/download/doxyrest-2.1.2/doxyrest-2.1.2-linux-amd64.tar.xz
7465
tar xf doxyrest-2.1.2-linux-amd64.tar.xz
75-
cmake .. -DDPCTL_USE_MULTIVERSION_TEMPLATE=ON \
76-
-DDPCTL_ENABLE_DOXYREST=ON \
77-
-DDoxyrest_DIR=`pwd`/doxyrest-2.1.2-linux-amd64
78-
make Sphinx || exit 1
79-
cd ..
80-
mv generated_docs/docs ~/docs
66+
python setup.py develop -- \
67+
-G "Ninja" \
68+
-DCMAKE_BUILD_TYPE=Debug \
69+
-DCMAKE_C_COMPILER:PATH=icx \
70+
-DCMAKE_CXX_COMPILER:PATH=icpx \
71+
-DDPCTL_ENABLE_LO_PROGRAM_CREATION=ON \
72+
-DDPCTL_GENERATE_DOCS=ON \
73+
-DDPCTL_ENABLE_DOXYREST=ON \
74+
-DDoxyrest_DIR=`pwd`/doxyrest-2.1.2-linux-amd64
75+
python -c "import dpctl; print(dpctl.__version__)" || exit 1
76+
cd "$(find _skbuild -name cmake-build)" || exit 1
77+
cmake --build . --target Sphinx || exit 1
78+
mv ../cmake-install/docs/docs ~/docs
8179
git clean -dfx
82-
cd ..
8380
- name: Publish docs
8481
if: ${{ github.ref == 'refs/heads/master' }}
8582
shell: bash -l {0}

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
- name: Install system components
6969
shell: bash -l {0}
7070
run: |
71-
sudo apt-get install cmake libtinfo5
71+
sudo apt-get install cmake ninja-build libtinfo5
7272
7373
- name: Setup Python
7474
uses: actions/setup-python@v2
@@ -97,6 +97,6 @@ jobs:
9797
export OCL_ICD_FILENAMES=libintelocl.so:libintelocl_emu.so
9898
clang++ --version
9999
sycl-ls
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
100+
python setup.py develop -- -G Ninja -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
101101
python -c "import dpctl; dpctl.lsplatform()" || exit 1
102102
SYCL_ENABLE_HOST_DEVICE=1 python -m pytest -v dpctl/tests

CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ add_subdirectory(libsyclinterface)
1515
file(GLOB _dpctl_capi_headers dpctl/apis/include/*.h*)
1616
install(FILES ${_dpctl_capi_headers}
1717
DESTINATION dpctl/include
18-
COMPONENT DpctlCAPIHeaders
1918
)
2019

2120
add_subdirectory(dpctl)

MANIFEST.in

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
include versioneer.py
21
recursive-include dpctl/include *.h
32
include dpctl/include/dpctl4pybind11.hpp
43
recursive-include dpctl *.pxd

conda-recipe/build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
export LDFLAGS="$LDFLAGS -Wl,-rpath,$PREFIX/lib"
77

88
${PYTHON} setup.py clean --all
9-
export CMAKE_GENERATOR="Unix Makefiles"
9+
export CMAKE_GENERATOR="Ninja"
1010
SKBUILD_ARGS="-- -DCMAKE_C_COMPILER:PATH=icx -DCMAKE_CXX_COMPILER:PATH=icpx -DDPCTL_ENABLE_LO_PROGRAM_CREATION=ON -DDPCTL_DPCPP_HOME_DIR=${BUILD_PREFIX}"
1111
echo "${PYTHON} setup.py install ${SKBUILD_ARGS}"
1212

conda-recipe/meta.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ requirements:
2020
- cython
2121
- cmake >=3.21
2222
- python
23-
- make # [unix]
24-
- ninja # [win]
23+
- ninja
2524
- scikit-build
2625
- numpy 1.19
2726
- wheel

docs/CMakeLists.txt

+1-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
2-
project("Data-parallel Control (dpctl)")
3-
41
# Option to generate rst for C API and add to Sphinx documentation
52
option(DPCTL_ENABLE_DOXYREST
63
"Enable generation of rst files for C API"
@@ -55,7 +52,6 @@ function(_setup_doxygen)
5552
# Target to generate only Doxygen documentation
5653
add_custom_target(
5754
Doxygen
58-
ALL
5955
DEPENDS ${DOXYGEN_INDEX_FILE}
6056
)
6157
endfunction()
@@ -95,7 +91,6 @@ function(_setup_doxyrest)
9591
# Target to generate rst from Doxygen XML using Doxyrest
9692
add_custom_target(
9793
Doxyrest
98-
ALL
9994
DEPENDS Doxygen ${DOXYREST_OUTPUT}
10095
)
10196
endfunction()
@@ -147,7 +142,6 @@ function(_setup_sphinx)
147142
# important, we want the rst files to generate prior to sphinx build.
148143
add_custom_target(
149144
Sphinx
150-
ALL
151145
DEPENDS
152146
${DEPEND_ON_DOXYREST}
153147
${DPCTL_PYAPI_RST_FILE}
@@ -196,12 +190,7 @@ if (DPCTL_ENABLE_DOXYREST)
196190
endif()
197191

198192
# Set the location where the generated docs are saved
199-
if(DPCTL_DOCGEN_PREFIX)
200-
message(STATUS "Generating dpctl documents in " ${DPCTL_DOCGEN_PREFIX})
201-
set(DOC_OUTPUT_DIR ${DPCTL_DOCGEN_PREFIX})
202-
else()
203-
set(DOC_OUTPUT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/generated_docs)
204-
endif()
193+
set(DOC_OUTPUT_DIR ${CMAKE_INSTALL_PREFIX}/docs)
205194

206195
set(INDEX_NO_DOXYREST_IN ${CMAKE_CURRENT_SOURCE_DIR}/index_no_doxyrest.rst.in)
207196
set(INDEX_DOXYREST_IN ${CMAKE_CURRENT_SOURCE_DIR}/index_doxyrest.rst.in)

docs/README.md

+6-51
Original file line numberDiff line numberDiff line change
@@ -32,58 +32,13 @@ sudo apt-get install liblua5.2-dev
3232
Generating the docs
3333
===================
3434

35-
The documentation should be generated using the provided `Cmake` build script.
36-
There are a few configurable options that can be used to select the type of
37-
documentation to generate.
35+
The helper script ``scripts/gen_docs.py`` is the preferred way to generate the
36+
documentation. The generated documentation html pages will be installed to the
37+
``CMAKE_INSTALL_PREFIX/docs`` directory.
3838

39-
Build only Doxygen for C API
4039
----------------------------
4140
```bash
42-
cd dpctl/docs
43-
mkdir -p build
44-
cd build
45-
cmake ..
46-
make Doxygen
41+
python scripts/gen_docs.py --doxyrest-root=<PATH to Doxyrest installation>
4742
```
48-
The above steps will generate the `Doxygen` files at
49-
`dpctl/docs/generated_docs/doxygen/html`. The documentation can also be
50-
generated at a custom location by providing the optional flag
51-
52-
```bash
53-
cd dpctl/docs
54-
mkdir -p build
55-
cd build
56-
cmake .. -DDPCTL_DOCGEN_PREFIX=<WHERE_YOU_WANT_DOCS_TO_BE_GENERATED>
57-
make Doxygen
58-
```
59-
60-
Build only Sphinx for Python API
61-
--------------------------------
62-
```bash
63-
cd dpctl/docs
64-
mkdir -p build
65-
cd build
66-
cmake .. -DDPCTL_DOCGEN_PREFIX=<WHERE_YOU_WANT_DOCS_TO_BE_GENERATED>
67-
make Sphinx
68-
```
69-
70-
The `make Sphinx` command will generate only the Python API docs for dpctl.
71-
72-
Build consolidated docs
73-
-----------------------
74-
It is possible to generate a single site with both Python and C API docs. As
75-
mentioned before, `Doxyrest` and `Lua` are required to generate the consolidated
76-
site.
77-
78-
```bash
79-
cd dpctl/docs
80-
mkdir -p build
81-
cd build
82-
cmake .. \
83-
-DDPCTL_ENABLE_DOXYREST=ON \
84-
-DDoxyrest_DIR=<PATH_TO_DOXYREST_INSTALL_DIR> \
85-
-DDPCTL_DOCGEN_PREFIX=<WHERE_YOU_WANT_DOCS_TO_BE_GENERATED>
86-
make Sphinx
87-
```
88-
The `Doxyrest_DIR` flag is optional, but is needed when Doxyrest is installed in
89-
a non-system location.
43+
To skip generating the documentation for ``libsyclinterface``, the
44+
``--doxyrest-root`` option should be omitted.

docs/docfiles/user_guides/QuickStart.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ installed:
143143
- ``numpy``
144144
- ``cmake``
145145
- ``scikit-build``
146-
- ``ninja`` (only on Windows)
146+
- ``ninja``
147147
- ``gtest`` (optional to run C API tests)
148148
- ``gmock`` (optional to run C API tests)
149149
- ``pytest`` (optional to run Python API tests)
@@ -152,15 +152,15 @@ Once the prerequisites are installed, building using ``scikit-build`` involves t
152152

153153
.. code-block:: bash
154154
155-
python setup.py install -- -G Unix\ Makefiles -DCMAKE_C_COMPILER:PATH=icx -DCMAKE_CXX_COMPILER:PATH=icpx -DDPCTL_ENABLE_LO_PROGRAM_CREATION=ON
155+
python setup.py install -- -G Ninja -DCMAKE_C_COMPILER:PATH=icx -DCMAKE_CXX_COMPILER:PATH=icpx -DDPCTL_ENABLE_LO_PROGRAM_CREATION=ON
156156
157157
, and to develop:
158158

159159
.. code-block:: bash
160160
161-
python setup.py develop -G Unix\ Makefiles -DCMAKE_C_COMPILER:PATH=icx -DCMAKE_CXX_COMPILER:PATH=icpx -DDPCTL_ENABLE_LO_PROGRAM_CREATION=ON
161+
python setup.py develop -G Ninja -DCMAKE_C_COMPILER:PATH=icx -DCMAKE_CXX_COMPILER:PATH=icpx -DDPCTL_ENABLE_LO_PROGRAM_CREATION=ON
162162
163-
On Windows, use ``icx`` for both C and CXX compilers, and use :code:`-G Ninja` for cmake generator.
163+
On Windows, use ``icx`` for both C and CXX compilers.
164164

165165
Developing on Linux can also be done using driver script:
166166

@@ -180,7 +180,7 @@ Following steps in `Build and install with scikit-build`_ use command line optio
180180

181181
.. code-block:: bash
182182
183-
python setup.py develop -- -G Unix\ Makefiles -DCMAKE_C_COMPILER:PATH=clang -DCMAKE_CXX_COMPILER:PATH=clang++ -DDPCTL_ENABLE_LO_PROGRAM_CREATION=ONE -DDPCTL_DPCPP_HOME_DIR=${DPCPP_ROOT}/llvm/build -DDPCTL_DPCPP_FROM_ONEAPI=OFF
183+
python setup.py develop -- -G Ninja -DCMAKE_C_COMPILER:PATH=clang -DCMAKE_CXX_COMPILER:PATH=clang++ -DDPCTL_ENABLE_LO_PROGRAM_CREATION=ONE -DDPCTL_DPCPP_HOME_DIR=${DPCPP_ROOT}/llvm/build -DDPCTL_DPCPP_FROM_ONEAPI=OFF
184184
185185
Alterantively, the driver script can be used
186186

dpctl/CMakeLists.txt

+37-14
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
find_package(PythonExtensions REQUIRED)
33
find_package(NumPy REQUIRED)
44

5-
set(CYTHON_FLAGS "-w ${CMAKE_SOURCE_DIR}")
5+
set(CYTHON_FLAGS "-t -w ${CMAKE_SOURCE_DIR}")
66
find_package(Cython REQUIRED)
77

88
if(WIN32)
@@ -78,41 +78,64 @@ add_custom_target(_build_time_create_dpctl_include ALL
7878
DEPENDS DPCTLSyclInterface
7979
)
8080

81+
set(_copied_header_files)
8182
file(GLOB _syclinterface_h ${CMAKE_SOURCE_DIR}/libsyclinterface/include/*.h)
8283
foreach(hf ${_syclinterface_h})
83-
add_custom_command(TARGET _build_time_create_dpctl_include
84-
COMMAND ${CMAKE_COMMAND} -E copy ${hf} ${DPCTL_INCLUDE_DIR}/syclinterface
85-
)
84+
get_filename_component(_header_name ${hf} NAME)
85+
set(_target_header_file ${DPCTL_INCLUDE_DIR}/syclinterface/${_header_name})
86+
list(APPEND _copied_header_files ${_target_header_file})
87+
add_custom_command(OUTPUT ${_target_header_file}
88+
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${hf} ${_target_header_file}
89+
DEPENDS ${hf} _build_time_create_dpctl_include
90+
VERBATIM
91+
)
8692
endforeach()
8793

8894
file(GLOB _syclinterface_Support_h ${CMAKE_SOURCE_DIR}/libsyclinterface/include/Support/*.h)
8995
foreach(hf ${_syclinterface_Support_h})
90-
add_custom_command(TARGET _build_time_create_dpctl_include
91-
COMMAND ${CMAKE_COMMAND} -E copy ${hf} ${DPCTL_INCLUDE_DIR}/syclinterface/Support
92-
)
96+
get_filename_component(_header_name ${hf} NAME)
97+
set(_target_header_file ${DPCTL_INCLUDE_DIR}/syclinterface/Support/${_header_name})
98+
list(APPEND _copied_header_files ${_target_header_file})
99+
add_custom_command(OUTPUT ${_target_header_file}
100+
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${hf} ${_target_header_file}
101+
DEPENDS ${hf} _build_time_create_dpctl_include
102+
)
93103
endforeach()
94104

95105
file(GLOB _syclinterface_Config_h ${CMAKE_SOURCE_DIR}/libsyclinterface/include/Config/*.h)
96106
foreach(hf ${_syclinterface_Config_h})
97-
add_custom_command(TARGET _build_time_create_dpctl_include
98-
COMMAND ${CMAKE_COMMAND} -E copy ${hf} ${DPCTL_INCLUDE_DIR}/syclinterface/Config
99-
)
107+
get_filename_component(_header_name ${hf} NAME)
108+
set(_target_header_file ${DPCTL_INCLUDE_DIR}/syclinterface/Config/${_header_name})
109+
list(APPEND _copied_header_files ${_target_header_file})
110+
add_custom_command(OUTPUT ${_target_header_file}
111+
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${hf} ${_target_header_file}
112+
DEPENDS ${hf} _build_time_create_dpctl_include
113+
)
100114
endforeach()
101115

102116
file(GLOB _apis_h ${CMAKE_CURRENT_SOURCE_DIR}/apis/include/*)
103117
foreach(hf ${_apis_h})
104-
add_custom_command(TARGET _build_time_create_dpctl_include
105-
COMMAND ${CMAKE_COMMAND} -E copy ${hf} ${DPCTL_INCLUDE_DIR}
106-
)
118+
get_filename_component(_header_name ${hf} NAME)
119+
set(_target_header_file ${DPCTL_INCLUDE_DIR}/${_header_name})
120+
list(APPEND _copied_header_files ${_target_header_file})
121+
add_custom_command(OUTPUT ${_target_header_file}
122+
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${hf} ${_target_header_file}
123+
DEPENDS ${hf} _build_time_create_dpctl_include
124+
)
107125
endforeach()
108126

127+
add_custom_target(
128+
_build_time_create_dpctl_include_copy ALL
129+
DEPENDS ${_copied_header_files}
130+
)
131+
109132
set(CMAKE_INSTALL_RPATH "$ORIGIN")
110133

111134
function(build_dpctl_ext _trgt _src _dest)
112135
add_cython_target(${_trgt} ${_src} CXX OUTPUT_VAR _generated_src)
113136
add_library(${_trgt} MODULE ${_generated_src})
114137
target_include_directories(${_trgt} PRIVATE ${NumPy_INCLUDE_DIR} ${DPCTL_INCLUDE_DIR})
115-
add_dependencies(${_trgt} _build_time_create_dpctl_include)
138+
add_dependencies(${_trgt} _build_time_create_dpctl_include_copy)
116139
if (DPCTL_GENERATE_COVERAGE)
117140
target_compile_definitions(${_trgt} PRIVATE CYTHON_TRACE=1 CYTHON_TRACE_NOGIL=1)
118141
target_compile_options(${_trgt} PRIVATE -fno-sycl-use-footer)

dpctl/_backend.pxd

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ cdef extern from "syclinterface/dpctl_sycl_enum_types.h":
9393
_usm_host_allocations 'usm_host_allocations',
9494
_usm_shared_allocations 'usm_shared_allocations',
9595
_usm_restricted_shared_allocations 'usm_restricted_shared_allocations',
96-
_usm_system_allocator 'usm_system_allocator'
96+
_usm_system_allocations 'usm_system_allocations'
9797

9898
ctypedef enum _partition_affinity_domain_type 'DPCTLPartitionAffinityDomainType':
9999
_not_applicable 'not_applicable',

0 commit comments

Comments
 (0)