diff --git a/.github/workflows/generate-coverage.yaml b/.github/workflows/generate-coverage.yaml index 776c1316fb..d21da02645 100644 --- a/.github/workflows/generate-coverage.yaml +++ b/.github/workflows/generate-coverage.yaml @@ -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 @@ -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: | @@ -39,7 +39,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v2 with: - python-version: '3.8' + python-version: '3.9' architecture: x64 - name: Cache Gtest @@ -47,8 +47,8 @@ jobs: 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- @@ -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 @@ -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 @@ -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 }} diff --git a/.github/workflows/generate-docs.yml b/.github/workflows/generate-docs.yml index 3f81a5eadc..052a82a304 100644 --- a/.github/workflows/generate-docs.yml +++ b/.github/workflows/generate-docs.yml @@ -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: @@ -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} diff --git a/.github/workflows/os-llvm-sycl-build.yml b/.github/workflows/os-llvm-sycl-build.yml index 47b183cd7e..8268bd0683 100644 --- a/.github/workflows/os-llvm-sycl-build.yml +++ b/.github/workflows/os-llvm-sycl-build.yml @@ -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 @@ -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 diff --git a/.gitignore b/.gitignore index 97cccfe031..ae22979595 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ __pycache__/ # CMake build and local install directory build +_skbuild build_cmake install diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000..8aff7d1d70 --- /dev/null +++ b/CMakeLists.txt @@ -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() diff --git a/cmake/IntelDPCPPConfig.cmake b/cmake/IntelDPCPPConfig.cmake new file mode 100644 index 0000000000..2b73830f1e --- /dev/null +++ b/cmake/IntelDPCPPConfig.cmake @@ -0,0 +1,293 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +IntelDPCPPConfig +------- + +DPCPP Library to verify DPCPP/SYCL compatability of CMAKE_CXX_COMPILER +and passes relevant compiler flags. + +Result Variables +^^^^^^^^^^^^^^^^ + +This will define the following variables: + +``IntelDPCPP_FOUND`` + True if the system has the DPCPP library. +``SYCL_LANGUAGE_VERSION`` + The SYCL language spec version by Compiler. +``SYCL_INCLUDE_DIR`` + Include directories needed to use SYCL. +``SYCL_IMPLEMENTATION_ID`` + The SYCL compiler variant. +``SYCL_FLAGS`` + SYCL specific flags for the compiler. + +Cache Variables +^^^^^^^^^^^^^^^ + +The following cache variables may also be set: + +``SYCL_INCLUDE_DIR`` + The directory containing ``sycl.hpp``. +``SYCL_LIBRARY_DIR`` + The path to the SYCL library. +``SYCL_FLAGS`` + SYCL specific flags for the compiler. +``SYCL_LANGUAGE_VERSION`` + The SYCL language spec version by Compiler. + + +.. note:: + + For now, user needs to set -DCMAKE_CXX_COMPILER or environment of + CXX pointing to SYCL compatible compiler ( eg: icx, clang++, icpx) + + Note: do not set to DPCPP compiler. If set to a Compiler family + that supports dpcpp ( eg: IntelLLVM) both DPCPP and SYCL + features are enabled. + + And add this package to user's Cmake config file. + + .. code-block:: cmake + + find_package(IntelDPCPP REQUIRED) + +#]=======================================================================] + +include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) + +find_package(PkgConfig QUIET) +if(PKG_CONFIG_FOUND) + # TODO add dependency package module checks, if any +endif() + + +# TODO: can't use find_program to override the CMAKE_CXX_COMPILER as +# Platform/ files are executed, potentially for a different compiler. +# Safer approach is to make user to define CMAKE_CXX_COMPILER. + +string(COMPARE EQUAL "${CMAKE_CXX_COMPILER}" "" nocmplr) +if(nocmplr) + set(IntelDPCPP_FOUND False) + set(SYCL_REASON_FAILURE "SYCL: CMAKE_CXX_COMPILER not set!!") + set(IntelDPCPP_NOT_FOUND_MESSAGE "${SYCL_REASON_FAILURE}") +endif() + +# Check for known compiler family that supports SYCL + +if( NOT "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang" AND + NOT "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xIntelLLVM") + set(IntelDPCPP_FOUND False) + set(SYCL_REASON_FAILURE "Unsupported compiler family ${CMAKE_CXX_COMPILER_ID} and compiler ${CMAKE_CXX_COMPILER}!!") + set(IntelDPCPP_NOT_FOUND_MESSAGE "${SYCL_REASON_FAILURE}") + return() +endif() + +# Assume that CXX Compiler supports SYCL and then test to verify. +set(SYCL_COMPILER ${CMAKE_CXX_COMPILER}) + + +# Function to write a test case to verify SYCL features. + +function(SYCL_FEATURE_TEST_WRITE src) + + set(pp_if "#if") + set(pp_endif "#endif") + + set(SYCL_TEST_CONTENT "") + string(APPEND SYCL_TEST_CONTENT "#include \nusing namespace std;\n") + string(APPEND SYCL_TEST_CONTENT "int main(){\n") + + # Feature tests goes here + + string(APPEND SYCL_TEST_CONTENT "${pp_if} defined(SYCL_LANGUAGE_VERSION)\n") + string(APPEND SYCL_TEST_CONTENT "cout << \"SYCL_LANGUAGE_VERSION=\"<=3.21 - python - make # [unix] - ninja # [win] + - scikit-build - numpy 1.19 - wheel run: - python - {{ pin_compatible('numpy') }} - - dpcpp-cpp-rt >=2021.2 + - dpcpp-cpp-rt >=2022.0 test: requires: diff --git a/docs/docfiles/user_guides/QuickStart.rst b/docs/docfiles/user_guides/QuickStart.rst index 37d6097e4b..8c58acd15a 100644 --- a/docs/docfiles/user_guides/QuickStart.rst +++ b/docs/docfiles/user_guides/QuickStart.rst @@ -50,7 +50,7 @@ Dpctl can also be istalled from Pypi. .. code-block:: bash - python -m pip install --index-url https://pypi.anaconda.org/intel/simple --extra-index-url https://pypi.org/simple dpctl + python -m pip install --index-url https://pypi.anaconda.org/intel/simple dpctl .. note:: @@ -133,33 +133,41 @@ After building the conda package you may install it by executing: 3.18 instead. -Build and install with setuptools -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Build and install with scikit-build +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -To build using Python ``setuptools``, the following packages should be +To build using Python ``setuptools`` and ``scikit-build``, the following Python packages should be installed: - ``cython`` - ``numpy`` - ``cmake`` + - ``scikit-build`` - ``ninja`` (only on Windows) - ``gtest`` (optional to run C API tests) + - ``gmock`` (optional to run C API tests) - ``pytest`` (optional to run Python API tests) -Once the prerequisites are installed, building using ``setuptools`` involves The -usual steps +Once the prerequisites are installed, building using ``scikit-build`` involves the usual steps, to build and install: + +.. code-block:: bash -to build and install + python setup.py install -- -G Unix\ Makefiles -DCMAKE_C_COMPILER:PATH=icx -DCMAKE_CXX_COMPILER:PATH=icpx -DDPCTL_ENABLE_LO_PROGRAM_CREATION=ON + +, and to develop: .. code-block:: bash - python setup.py install + python setup.py develop -G Unix\ Makefiles -DCMAKE_C_COMPILER:PATH=icx -DCMAKE_CXX_COMPILER:PATH=icpx -DDPCTL_ENABLE_LO_PROGRAM_CREATION=ON + +On Windows, use ``icx`` for both C and CXX compilers, and use :code:`-G Ninja` for cmake generator. -, and to develop. +Developing on Linux can also be done using driver script: .. code-block:: bash - python setup.py develop + python scripts/build_locally.py --oneapi + Building using custom dpcpp --------------------------- @@ -168,12 +176,17 @@ It is possible to build dpctl from source using .. _DPC++ toolchain: https://git instead of the DPC++ compiler that comes with oneAPI. One reason for doing this may be to enable support for CUDA devices. -Following steps in `Build and install with setuptools`_ use command line -option :code:`--sycl-compiler-prefix`, for example: +Following steps in `Build and install with scikit-build`_ use command line option to set relevant cmake variables, for example: + +.. code-block:: bash + + 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 + +Alterantively, the driver script can be used .. code-block:: bash - python setup.py develop --sycl-compiler-prefix=${DPCPP_ROOT}/llvm/build + python scripts/build_locally.py --c-compiler=clang --cxx-compiler=clang++ --compiler-root=${DPCPP_ROOT}/llvm/build Available options and their descriptions can be retrieved using option :code:`--help`. diff --git a/dpctl/CMakeLists.txt b/dpctl/CMakeLists.txt new file mode 100644 index 0000000000..275fe83f80 --- /dev/null +++ b/dpctl/CMakeLists.txt @@ -0,0 +1,148 @@ + +find_package(PythonExtensions REQUIRED) +find_package(NumPy REQUIRED) +find_package(Cython REQUIRED) + +if(WIN32) + string(CONCAT WARNING_FLAGS + "-Wall " + "-Wextra " + "-Winit-self " + "-Wunused-function " + "-Wuninitialized " + "-Wmissing-declarations " + "-Wno-unused-parameter " + ) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Ox ${WARNING_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Ox ${WARNING_FLAGS}") + set(CMAKE_C_FLAGS_DEBUG + "${CMAKE_C_FLAGS_DEBUG} ${WARNING_FLAGS} -ggdb3 -DDEBUG" + ) + set(CMAKE_CXX_FLAGS_DEBUG + "${CMAKE_CXX_FLAGS_DEBUG} ${WARNING_FLAGS} -ggdb3 -DDEBUG" + ) + set(DPCTL_LDFLAGS "/NXCompat /DynamicBase") +elseif(UNIX) + string(CONCAT WARNING_FLAGS + "-Wall " + "-Wextra " + "-Winit-self " + "-Wunused-function " + "-Wuninitialized " + "-Wmissing-declarations " + "-fdiagnostics-color=auto " + "-Wno-deprecated-declarations " + ) + string(CONCAT SDL_FLAGS + "-fstack-protector " + "-fstack-protector-all " + "-fpic " + "-fPIC " + "-D_FORTIFY_SOURCE=2 " + "-Wformat " + "-Wformat-security " + "-fno-strict-overflow " + "-fno-delete-null-pointer-checks " + ) + string(CONCAT CFLAGS + "${WARNING_FLAGS}" + "${SDL_FLAGS}" + ) + string(CONCAT CXXFLAGS + "${WARNING_FLAGS}" + "${SDL_FLAGS}" + "-fsycl " + ) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 ${CFLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 ${CXXFLAGS}") + set(CMAKE_C_FLAGS_DEBUG + "${CMAKE_C_FLAGS_DEBUG} ${CFLAGS} -ggdb3 -DDEBUG" + ) + set(CMAKE_CXX_FLAGS_DEBUG + "${CMAKE_CXX_FLAGS_DEBUG} ${CXXFLAGS} -ggdb3 -DDEBUG" + ) + set(DPCTL_LDFLAGS "-z,noexecstack,-z,relro,-z,now") +else() + message(FATAL_ERROR "Unsupported system.") +endif() + +# at build time create include/ directory and copy header files over +set(DPCTL_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include) +add_custom_target(_build_time_create_dpctl_include ALL + COMMAND ${CMAKE_COMMAND} -E make_directory ${DPCTL_INCLUDE_DIR} + COMMAND ${CMAKE_COMMAND} -E make_directory ${DPCTL_INCLUDE_DIR}/syclinterface + COMMAND ${CMAKE_COMMAND} -E make_directory ${DPCTL_INCLUDE_DIR}/syclinterface/Support + COMMAND ${CMAKE_COMMAND} -E make_directory ${DPCTL_INCLUDE_DIR}/syclinterface/Config + DEPENDS DPCTLSyclInterface +) + +file(GLOB _syclinterface_h ${CMAKE_SOURCE_DIR}/libsyclinterface/include/*.h) +foreach(hf ${_syclinterface_h}) + add_custom_command(TARGET _build_time_create_dpctl_include + COMMAND ${CMAKE_COMMAND} -E copy ${hf} ${DPCTL_INCLUDE_DIR}/syclinterface + ) +endforeach() + +file(GLOB _syclinterface_Support_h ${CMAKE_SOURCE_DIR}/libsyclinterface/include/Support/*.h) +foreach(hf ${_syclinterface_Support_h}) + add_custom_command(TARGET _build_time_create_dpctl_include + COMMAND ${CMAKE_COMMAND} -E copy ${hf} ${DPCTL_INCLUDE_DIR}/syclinterface/Support + ) +endforeach() + +file(GLOB _syclinterface_Config_h ${CMAKE_SOURCE_DIR}/libsyclinterface/include/Config/*.h) +foreach(hf ${_syclinterface_Config_h}) + add_custom_command(TARGET _build_time_create_dpctl_include + COMMAND ${CMAKE_COMMAND} -E copy ${hf} ${DPCTL_INCLUDE_DIR}/syclinterface/Config + ) +endforeach() + +file(GLOB _apis_h ${CMAKE_CURRENT_SOURCE_DIR}/apis/include/*) +foreach(hf ${_apis_h}) + add_custom_command(TARGET _build_time_create_dpctl_include + COMMAND ${CMAKE_COMMAND} -E copy ${hf} ${DPCTL_INCLUDE_DIR} + ) +endforeach() + +set(CMAKE_INSTALL_RPATH "$ORIGIN") + +function(build_dpctl_ext _trgt _src _dest) + add_cython_target(${_trgt} ${_src} CXX OUTPUT_VAR _generated_src) + add_library(${_trgt} MODULE ${_generated_src}) + target_include_directories(${_trgt} PRIVATE ${NumPy_INCLUDE_DIR} ${DPCTL_INCLUDE_DIR}) + add_dependencies(${_trgt} _build_time_create_dpctl_include) + target_link_libraries(${_trgt} DPCTLSyclInterface) + target_link_options(${_trgt} PRIVATE "LINKER:${DPCTL_LDFLAGS}") + python_extension_module(${_trgt}) + get_filename_component(_name_wle ${_generated_src} NAME_WLE) + get_filename_component(_generated_src_dir ${_generated_src} DIRECTORY) + set(_generated_public_h "${_generated_src_dir}/${_name_wle}.h") + set(_generated_api_h "${_generated_src_dir}/${_name_wle}_api.h") + set(_copy_trgt "${_trgt}_copy_capi_include") + add_custom_target( + ${_copy_trgt} ALL + COMMAND ${CMAKE_COMMAND} + -DSOURCE_FILE=${_generated_public_h} + -DDEST=${CMAKE_CURRENT_SOURCE_DIR} + -P ${CMAKE_SOURCE_DIR}/dpctl/cmake/copy_generated_headers.cmake + COMMAND ${CMAKE_COMMAND} + -DSOURCE_FILE=${_generated_api_h} + -DDEST=${CMAKE_CURRENT_SOURCE_DIR} + -P ${CMAKE_SOURCE_DIR}/dpctl/cmake/copy_generated_headers.cmake + DEPENDS ${_trgt} + VERBATIM + COMMENT "Copying Cython-generated headers to destination" + ) + install(TARGETS ${_trgt} LIBRARY DESTINATION ${_dest}) +endfunction() + +file(GLOB _cython_sources *.pyx) +foreach(_cy_file ${_cython_sources}) + get_filename_component(_trgt ${_cy_file} NAME_WLE) + build_dpctl_ext(${_trgt} ${_cy_file} "dpctl") +endforeach() + +add_subdirectory(program) +add_subdirectory(memory) +add_subdirectory(tensor) +add_subdirectory(utils) diff --git a/dpctl/cmake/copy_generated_headers.cmake b/dpctl/cmake/copy_generated_headers.cmake new file mode 100644 index 0000000000..242dc29257 --- /dev/null +++ b/dpctl/cmake/copy_generated_headers.cmake @@ -0,0 +1,3 @@ +if (EXISTS ${SOURCE_FILE}) + configure_file(${SOURCE_FILE} ${DEST} COPYONLY) +endif() diff --git a/dpctl/memory/CMakeLists.txt b/dpctl/memory/CMakeLists.txt new file mode 100644 index 0000000000..c4f6d8469f --- /dev/null +++ b/dpctl/memory/CMakeLists.txt @@ -0,0 +1,6 @@ + +file(GLOB _cython_sources *.pyx) +foreach(_cy_file ${_cython_sources}) + get_filename_component(_trgt ${_cy_file} NAME_WLE) + build_dpctl_ext(${_trgt} ${_cy_file} "dpctl/memory") +endforeach() diff --git a/dpctl/program/CMakeLists.txt b/dpctl/program/CMakeLists.txt new file mode 100644 index 0000000000..f10706ed9d --- /dev/null +++ b/dpctl/program/CMakeLists.txt @@ -0,0 +1,6 @@ + +file(GLOB _cython_sources *.pyx) +foreach(_cy_file ${_cython_sources}) + get_filename_component(_trgt ${_cy_file} NAME_WLE) + build_dpctl_ext(${_trgt} ${_cy_file} "dpctl/program") +endforeach() diff --git a/dpctl/tensor/CMakeLists.txt b/dpctl/tensor/CMakeLists.txt new file mode 100644 index 0000000000..855bba7e8a --- /dev/null +++ b/dpctl/tensor/CMakeLists.txt @@ -0,0 +1,6 @@ +file(GLOB _cython_sources *.pyx) +foreach(_cy_file ${_cython_sources}) + get_filename_component(_trgt ${_cy_file} NAME_WLE) + build_dpctl_ext(${_trgt} ${_cy_file} "dpctl/tensor") + target_include_directories(${_trgt} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include) +endforeach() diff --git a/dpctl/tensor/_dlpack.pxd b/dpctl/tensor/_dlpack.pxd index 439880f7d2..58176ceb84 100644 --- a/dpctl/tensor/_dlpack.pxd +++ b/dpctl/tensor/_dlpack.pxd @@ -21,7 +21,7 @@ from ._usmarray cimport usm_ndarray -cdef extern from './include/dlpack/dlpack.h' nogil: +cdef extern from 'dlpack/dlpack.h' nogil: int device_CPU 'kDLCPU' int device_oneAPI 'kDLOneAPI' int device_OpenCL 'kDLOpenCL' diff --git a/dpctl/tensor/_dlpack.pyx b/dpctl/tensor/_dlpack.pyx index 7d4ebfa0c3..fe762a016a 100644 --- a/dpctl/tensor/_dlpack.pyx +++ b/dpctl/tensor/_dlpack.pyx @@ -39,7 +39,7 @@ import dpctl import dpctl.memory as dpmem -cdef extern from './include/dlpack/dlpack.h' nogil: +cdef extern from 'dlpack/dlpack.h' nogil: cdef int DLPACK_VERSION cdef enum DLDeviceType: diff --git a/dpctl/utils/CMakeLists.txt b/dpctl/utils/CMakeLists.txt new file mode 100644 index 0000000000..11b0930052 --- /dev/null +++ b/dpctl/utils/CMakeLists.txt @@ -0,0 +1,6 @@ + +file(GLOB _cython_sources *.pyx) +foreach(_cy_file ${_cython_sources}) + get_filename_component(_trgt ${_cy_file} NAME_WLE) + build_dpctl_ext(${_trgt} ${_cy_file} "dpctl/utils") +endforeach() diff --git a/libsyclinterface/CMakeLists.txt b/libsyclinterface/CMakeLists.txt index 3362e2b2a3..fd78f215a2 100644 --- a/libsyclinterface/CMakeLists.txt +++ b/libsyclinterface/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10 FATAL_ERROR) +cmake_minimum_required(VERSION 3.10...3.22 FATAL_ERROR) project( "libDPCTLSYCLInterface" @@ -84,6 +84,7 @@ if(WIN32) "-Wunused-function " "-Wuninitialized " "-Wmissing-declarations " + "-Wno-deprecated-declarations " ) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS}") @@ -125,7 +126,7 @@ elseif(UNIX) "-fsycl " ) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CFLAGS}") - set(CMAKE_CXX_FLAGS "${CXXFLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXXFLAGS}") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${CFLAGS} -ggdb3 -DDEBUG" ) @@ -157,8 +158,11 @@ add_library(DPCTLSyclInterface ) target_include_directories(DPCTLSyclInterface - PRIVATE + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include/ + ${CMAKE_CURRENT_SOURCE_DIR}/include/Support + ${CMAKE_CURRENT_SOURCE_DIR}/include/Config + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/helper/include/ ${IntelSycl_SYCL_INCLUDE_DIR} ) @@ -186,29 +190,46 @@ if(DPCTL_ENABLE_LO_PROGRAM_CREATION) ) endif() +# Install all headers + +file(GLOB MAIN_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h") +file(GLOB SUPPORT_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/include/Support/*.h") +file(GLOB CONFIG_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/include/Config/*.h") + +set_target_properties(DPCTLSyclInterface + PROPERTIES PUBLIC_HEADER + "${MAIN_HEADERS}" +) + +if (SKBUILD) + set(_lib_destination dpctl) + set(_include_destination dpctl/include/syclinterface) +else() + set(_lib_destination ${CMAKE_INSTALL_PREFIX}/lib) + set(_include_destination ${CMAKE_INSTALL_PREFIX}/include) +endif() + install(TARGETS DPCTLSyclInterface LIBRARY - DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/ + DESTINATION ${_lib_destination} + ARCHIVE + DESTINATION ${_lib_destination} + RUNTIME + DESTINATION ${_lib_destination} + PUBLIC_HEADER + DESTINATION ${_include_destination} +) +install( + FILES ${SUPPORT_HEADERS} + DESTINATION ${_include_destination}/Support + COMPONENT SupportHeaders +) +install( + FILES ${CONFIG_HEADERS} + DESTINATION ${_include_destination}/Config + COMPONENT ConfigHeaders ) - -# Install all headers -file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h") -foreach(HEADER ${HEADERS}) - install(FILES "${HEADER}" DESTINATION include) -endforeach() - -# Install all headers in include/Support -file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/include/Support/*.h") -foreach(HEADER ${HEADERS}) - install(FILES "${HEADER}" DESTINATION include/Support) -endforeach() - -# Install all headers in include/Config -file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/include/Config/*.h") -foreach(HEADER ${HEADERS}) - install(FILES "${HEADER}" DESTINATION include/Config) -endforeach() # Enable code coverage related settings if(DPCTL_GENERATE_COVERAGE) diff --git a/libsyclinterface/cmake/modules/GetLevelZeroHeaders.cmake b/libsyclinterface/cmake/modules/GetLevelZeroHeaders.cmake index 83bb8e61a5..1b1cca582e 100644 --- a/libsyclinterface/cmake/modules/GetLevelZeroHeaders.cmake +++ b/libsyclinterface/cmake/modules/GetLevelZeroHeaders.cmake @@ -32,7 +32,7 @@ function(get_level_zero_headers) COMMAND ${GIT_EXECUTABLE} fetch RESULT_VARIABLE result ERROR_VARIABLE error - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/level-zero + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/level-zero OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE ) @@ -65,7 +65,7 @@ function(get_level_zero_headers) RESULT_VARIABLE result OUTPUT_VARIABLE latest_tag ERROR_VARIABLE error - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/level-zero + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/level-zero OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE ) @@ -81,7 +81,7 @@ function(get_level_zero_headers) COMMAND ${GIT_EXECUTABLE} checkout ${latest_tag} RESULT_VARIABLE result ERROR_VARIABLE error - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/level-zero + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/level-zero OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE ) @@ -95,7 +95,7 @@ function(get_level_zero_headers) # Populate the path to the headers find_path(LEVEL_ZERO_INCLUDE_DIR NAMES zet_api.h - PATHS ${CMAKE_CURRENT_BINARY_DIR}/level-zero/include + PATHS ${CMAKE_BINARY_DIR}/level-zero/include NO_DEFAULT_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_PATH diff --git a/libsyclinterface/helper/include/dpctl_utils_helper.h b/libsyclinterface/helper/include/dpctl_utils_helper.h index e789c73517..57a308f5f0 100644 --- a/libsyclinterface/helper/include/dpctl_utils_helper.h +++ b/libsyclinterface/helper/include/dpctl_utils_helper.h @@ -24,8 +24,8 @@ #pragma once -#include "../include/dpctl_sycl_enum_types.h" #include "Support/DllExport.h" +#include "dpctl_sycl_enum_types.h" #include /*! diff --git a/libsyclinterface/helper/source/dpctl_utils_helper.cpp b/libsyclinterface/helper/source/dpctl_utils_helper.cpp index 212a5634fa..bf3f590bc6 100644 --- a/libsyclinterface/helper/source/dpctl_utils_helper.cpp +++ b/libsyclinterface/helper/source/dpctl_utils_helper.cpp @@ -96,6 +96,8 @@ backend DPCTL_DPCTLBackendTypeToSyclBackend(DPCTLSyclBackendType BeTy) return backend::level_zero; case DPCTLSyclBackendType::DPCTL_OPENCL: return backend::opencl; + case DPCTLSyclBackendType::DPCTL_ALL_BACKENDS: + return backend::all; default: throw std::runtime_error("Unsupported backend type"); } diff --git a/libsyclinterface/tests/CMakeLists.txt b/libsyclinterface/tests/CMakeLists.txt index c4926ffa2d..dc180ec70d 100644 --- a/libsyclinterface/tests/CMakeLists.txt +++ b/libsyclinterface/tests/CMakeLists.txt @@ -4,7 +4,7 @@ find_package(Threads REQUIRED) # Emulate autotools like make check target to build tests set(CMAKE_CTEST_COMMAND ctest --progress --output-on-failure -j 4) -add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) +add_custom_target(check COMMAND ${CMAKE_COMMAND} -E env DPCTL_VERBOSITY=warning ${CMAKE_CTEST_COMMAND}) enable_testing() include_directories( @@ -35,12 +35,11 @@ if(DPCTL_GENERATE_COVERAGE) list(REMOVE_ITEM dpctl_sources "${CMAKE_CURRENT_SOURCE_DIR}/../source/dpctl_vector_templ.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../source/dpcpp_kernels.cpp" ) # Add profiling flags set(CMAKE_CXX_FLAGS - "${CMAKE_CXX_FLAGS} -fprofile-instr-generate -fcoverage-mapping -DDPCTL_COVERAGE" + "${CMAKE_CXX_FLAGS} -fprofile-instr-generate -fcoverage-mapping -fno-sycl-use-footer -DDPCTL_COVERAGE" ) # Add all dpctl sources into a single executable so that we can run coverage @@ -51,6 +50,10 @@ if(DPCTL_GENERATE_COVERAGE) ${dpctl_sources} ${helper_sources} ) + target_include_directories(dpctl_c_api_tests + PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../helper/include" + PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../include" + ) target_link_libraries(dpctl_c_api_tests ${CMAKE_THREAD_LIBS_INIT} GTest::GTest @@ -90,10 +93,6 @@ if(DPCTL_GENERATE_COVERAGE) WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) else() - add_library(dpcpp_kernels - STATIC - ${CMAKE_CURRENT_SOURCE_DIR}/dpcpp_kernels.cpp - ) file(GLOB_RECURSE sources ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) add_executable(dpctl_c_api_tests EXCLUDE_FROM_ALL ${sources}) target_link_libraries(dpctl_c_api_tests @@ -101,7 +100,6 @@ else() GTest::GTest DPCTLSyclInterface ${LEVEL_ZERO_LIBRARY} - dpcpp_kernels ) endif() diff --git a/libsyclinterface/tests/dpcpp_kernels.cpp b/libsyclinterface/tests/dpcpp_kernels.cpp deleted file mode 100644 index 897aa86de4..0000000000 --- a/libsyclinterface/tests/dpcpp_kernels.cpp +++ /dev/null @@ -1,89 +0,0 @@ -#include "dpcpp_kernels.hpp" -#include -#include - -template sycl::kernel -dpcpp_kernels::get_fill_kernel(sycl::queue &, size_t, int *, int); - -template sycl::kernel -dpcpp_kernels::get_fill_kernel(sycl::queue &, - size_t, - unsigned int *, - unsigned int); - -template sycl::kernel -dpcpp_kernels::get_fill_kernel(sycl::queue &, size_t, double *, double); - -template sycl::kernel -dpcpp_kernels::get_fill_kernel(sycl::queue &, size_t, float *, float); - -template sycl::kernel -dpcpp_kernels::get_range_kernel(sycl::queue &, size_t, int *); - -template sycl::kernel -dpcpp_kernels::get_range_kernel(sycl::queue &, - size_t, - unsigned int *); - -template sycl::kernel -dpcpp_kernels::get_range_kernel(sycl::queue &, size_t, float *); - -template sycl::kernel -dpcpp_kernels::get_range_kernel(sycl::queue &, size_t, double *); - -template sycl::kernel dpcpp_kernels::get_mad_kernel(sycl::queue &, - size_t, - int *, - int *, - int *, - int); - -template sycl::kernel -dpcpp_kernels::get_mad_kernel(sycl::queue &, - size_t, - unsigned int *, - unsigned int *, - unsigned int *, - unsigned int); - -template sycl::kernel dpcpp_kernels::get_local_sort_kernel(sycl::queue &, - size_t, - size_t, - int *, - size_t); - -template sycl::kernel -dpcpp_kernels::get_local_count_exceedance_kernel(sycl::queue &, - size_t, - size_t, - int *, - size_t, - int, - int *); - -template sycl::kernel -dpcpp_kernels::get_local_count_exceedance_kernel(sycl::queue &, - size_t, - size_t, - unsigned int *, - size_t, - unsigned int, - int *); - -template sycl::kernel -dpcpp_kernels::get_local_count_exceedance_kernel(sycl::queue &, - size_t, - size_t, - float *, - size_t, - float, - int *); - -template sycl::kernel -dpcpp_kernels::get_local_count_exceedance_kernel(sycl::queue &, - size_t, - size_t, - double *, - size_t, - double, - int *); diff --git a/libsyclinterface/tests/dpcpp_kernels.hpp b/libsyclinterface/tests/dpcpp_kernels.hpp index 099ea1a2da..f4c0934d78 100644 --- a/libsyclinterface/tests/dpcpp_kernels.hpp +++ b/libsyclinterface/tests/dpcpp_kernels.hpp @@ -1,4 +1,8 @@ #pragma once +#ifndef __SYCL_INTERNAL_API +// make sure that sycl::program is defined and implemented +#define __SYCL_INTERNAL_API +#endif #include namespace dpcpp_kernels diff --git a/libsyclinterface/tests/test_helper.cpp b/libsyclinterface/tests/test_helper.cpp index 76c8d50932..ae4f60b75c 100644 --- a/libsyclinterface/tests/test_helper.cpp +++ b/libsyclinterface/tests/test_helper.cpp @@ -24,8 +24,8 @@ /// //===----------------------------------------------------------------------===// -#include "../helper/include/dpctl_utils_helper.h" #include "Config/dpctl_config.h" +#include "dpctl_utils_helper.h" #include #include #include diff --git a/libsyclinterface/tests/test_sycl_device_aspects.cpp b/libsyclinterface/tests/test_sycl_device_aspects.cpp index 8fdc1b34f6..90b29a8bac 100644 --- a/libsyclinterface/tests/test_sycl_device_aspects.cpp +++ b/libsyclinterface/tests/test_sycl_device_aspects.cpp @@ -1,8 +1,8 @@ -#include "../helper/include/dpctl_utils_helper.h" #include "Support/CBindingWrapping.h" #include "dpctl_sycl_device_interface.h" #include "dpctl_sycl_device_selector_interface.h" #include "dpctl_sycl_enum_types.h" +#include "dpctl_utils_helper.h" #include #include #include diff --git a/libsyclinterface/tests/test_sycl_device_interface.cpp b/libsyclinterface/tests/test_sycl_device_interface.cpp index b33e2c566f..a55bacecd7 100644 --- a/libsyclinterface/tests/test_sycl_device_interface.cpp +++ b/libsyclinterface/tests/test_sycl_device_interface.cpp @@ -24,11 +24,11 @@ /// //===----------------------------------------------------------------------===// -#include "../helper/include/dpctl_utils_helper.h" #include "dpctl_sycl_device_interface.h" #include "dpctl_sycl_device_selector_interface.h" #include "dpctl_sycl_platform_interface.h" #include "dpctl_utils.h" +#include "dpctl_utils_helper.h" #include #include diff --git a/libsyclinterface/tests/test_sycl_device_manager.cpp b/libsyclinterface/tests/test_sycl_device_manager.cpp index a7ca5ef6e1..77b7a21b07 100644 --- a/libsyclinterface/tests/test_sycl_device_manager.cpp +++ b/libsyclinterface/tests/test_sycl_device_manager.cpp @@ -24,11 +24,11 @@ /// //===----------------------------------------------------------------------===// -#include "../helper/include/dpctl_utils_helper.h" #include "dpctl_sycl_device_interface.h" #include "dpctl_sycl_device_manager.h" #include "dpctl_sycl_device_selector_interface.h" #include "dpctl_utils.h" +#include "dpctl_utils_helper.h" #include #include @@ -139,18 +139,30 @@ INSTANTIATE_TEST_SUITE_P( struct TestGetNumDevicesForDTy : public ::testing::TestWithParam { - size_t nDevices = 0; + int param; + sycl::info::device_type sycl_dty; + TestGetNumDevicesForDTy() { - cl::sycl::info::device_type sycl_dty = - DPCTL_DPCTLDeviceTypeToSyclDeviceType( - DPCTLSyclDeviceType(GetParam())); - - auto devices = cl::sycl::device::get_devices(sycl_dty); - EXPECT_TRUE(devices.size() == DPCTLDeviceMgr_GetNumDevices(GetParam())); + param = GetParam(); + DPCTLSyclDeviceType DTy = DPCTLSyclDeviceType(param); + sycl_dty = DPCTL_DPCTLDeviceTypeToSyclDeviceType(DTy); } }; +TEST_P(TestGetNumDevicesForDTy, ChkGetNumDevices) +{ + auto devices = sycl::device::get_devices(sycl_dty); + size_t nDevices = 0; + sycl::default_selector mRanker; + for (const sycl::device &d : devices) { + if (mRanker(d) < 0) + continue; + ++nDevices; + } + EXPECT_TRUE(nDevices == DPCTLDeviceMgr_GetNumDevices(param)); +} + INSTANTIATE_TEST_SUITE_P( GetDevices, TestGetNumDevicesForDTy, @@ -162,22 +174,33 @@ INSTANTIATE_TEST_SUITE_P( struct TestGetNumDevicesForBTy : public ::testing::TestWithParam { - size_t nDevices = 0; + int param; + sycl::backend sycl_bty; TestGetNumDevicesForBTy() { - cl::sycl::backend sycl_bty = DPCTL_DPCTLBackendTypeToSyclBackend( - DPCTLSyclBackendType(GetParam())); - - auto platforms = cl::sycl::platform::get_platforms(); - for (const auto &P : platforms) { - if (P.get_backend() == sycl_bty) { - auto devices = P.get_devices(); - EXPECT_TRUE(devices.size() == - DPCTLDeviceMgr_GetNumDevices(GetParam())); + param = GetParam(); + sycl_bty = + DPCTL_DPCTLBackendTypeToSyclBackend(DPCTLSyclBackendType(param)); + } +}; + +TEST_P(TestGetNumDevicesForBTy, ChkGetNumDevices) +{ + auto platforms = cl::sycl::platform::get_platforms(); + size_t nDevices = 0; + sycl::default_selector mRanker; + for (const auto &P : platforms) { + if ((P.get_backend() == sycl_bty) || (sycl_bty == sycl::backend::all)) { + auto devices = P.get_devices(); + for (const sycl::device &d : devices) { + if (mRanker(d) < 0) + continue; + ++nDevices; } } } -}; + EXPECT_TRUE(nDevices == DPCTLDeviceMgr_GetNumDevices(param)); +} INSTANTIATE_TEST_SUITE_P( GetDevices, diff --git a/libsyclinterface/tests/test_sycl_device_subdevices.cpp b/libsyclinterface/tests/test_sycl_device_subdevices.cpp index 14252bdc88..41cef23784 100644 --- a/libsyclinterface/tests/test_sycl_device_subdevices.cpp +++ b/libsyclinterface/tests/test_sycl_device_subdevices.cpp @@ -25,13 +25,13 @@ /// //===----------------------------------------------------------------------===// -#include "../helper/include/dpctl_utils_helper.h" #include "Support/CBindingWrapping.h" #include "dpctl_sycl_device_interface.h" #include "dpctl_sycl_device_selector_interface.h" #include "dpctl_sycl_enum_types.h" #include "dpctl_sycl_platform_interface.h" #include "dpctl_utils.h" +#include "dpctl_utils_helper.h" #include #include diff --git a/scripts/build_for_develop.bat b/scripts/build_for_develop.bat deleted file mode 100644 index 0273a9d62a..0000000000 --- a/scripts/build_for_develop.bat +++ /dev/null @@ -1,66 +0,0 @@ -REM check if oneAPI has been activated, only try activating if not -dpcpp.exe --version >nul 2>&1 -IF %ERRORLEVEL% NEQ 0 ( - set ERRORLEVEL= - call "%ONEAPI_ROOT%\compiler\latest\env\vars.bat" - IF ERRORLEVEL 1 exit /b 1 -) -REM conda uses %ERRORLEVEL% but FPGA scripts can set it. So it should be reseted. -set ERRORLEVEL= - -rmdir /S /Q build_cmake -mkdir build_cmake - -rmdir /S /Q install -mkdir install -cd install -set "INSTALL_PREFIX=%cd%" - -cd ..\build_cmake - -set "DPCPP_ROOT=%ONEAPI_ROOT%\compiler\latest\windows" - -if defined USE_GTEST ( - set "_BUILD_CAPI_TEST=ON" -) else ( - set "_BUILD_CAPI_TEST=OFF" -) -cmake -G Ninja ^ - -DCMAKE_BUILD_TYPE=Release ^ - "-DCMAKE_CXX_FLAGS=-Wno-unused-function /EHa" ^ - "-DCMAKE_INSTALL_PREFIX=%INSTALL_PREFIX%" ^ - "-DCMAKE_PREFIX_PATH=%INSTALL_PREFIX%" ^ - "-DDPCPP_ROOT=%DPCPP_ROOT%" ^ - "-DCMAKE_C_COMPILER:PATH=%DPCPP_ROOT%\bin\icx.exe" ^ - "-DCMAKE_CXX_COMPILER:PATH=%DPCPP_ROOT%\bin\dpcpp.exe" ^ - "-DBUILD_CAPI_TESTS=%_BUILD_CAPI_TEST%" ^ - "%cd%\..\dpctl-capi" -IF %ERRORLEVEL% NEQ 0 exit /b 1 - -ninja -n -IF %ERRORLEVEL% NEQ 0 exit /b 1 -if defined USE_GTEST ( - ninja check - IF %ERRORLEVEL% NEQ 0 exit /b 1 -) -ninja install -IF %ERRORLEVEL% NEQ 0 exit /b 1 - -cd .. -xcopy install\lib\*.lib dpctl /E /Y -xcopy install\bin\*.dll dpctl /E /Y - -mkdir dpctl\include -xcopy dpctl-capi\include dpctl\include /E /Y - - -REM required by _sycl_core(dpctl) -set "DPCTL_SYCL_INTERFACE_LIBDIR=dpctl" -set "DPCTL_SYCL_INTERFACE_INCLDIR=dpctl\include" -set "CC=icx.exe" -set "CXX=dpcpp.exe" - -python setup.py clean --all -python setup.py build_ext --inplace develop -python -m unittest dpctl.tests -IF %ERRORLEVEL% NEQ 0 exit /b 1 diff --git a/scripts/build_for_develop.sh b/scripts/build_for_develop.sh deleted file mode 100755 index 530c2a2991..0000000000 --- a/scripts/build_for_develop.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -set +xe - -python setup.py clean --all -python setup.py develop --coverage=True -pytest -q -ra --disable-warnings --cov dpctl --cov-report term-missing --pyargs dpctl -vv diff --git a/scripts/build_locally.py b/scripts/build_locally.py new file mode 100644 index 0000000000..049079cc37 --- /dev/null +++ b/scripts/build_locally.py @@ -0,0 +1,115 @@ +import os +import subprocess +import sys + + +def run( + use_oneapi=True, + c_compiler=None, + cxx_compiler=None, + level_zero=True, + compiler_root=None, + cmake_executable=None, +): + IS_LIN = False + + if "linux" in sys.platform: + IS_LIN = True + elif sys.platform in ["win32", "cygwin"]: + pass + else: + assert False, sys.platform + " not supported" + + if not IS_LIN: + raise RuntimeError( + "This scripts only supports coverage collection on Linux" + ) + setup_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + cmake_args = [ + sys.executable, + "setup.py", + "develop", + ] + if cmake_executable: + cmake_args += [ + "--cmake-executable=" + cmake_executable, + ] + cmake_args += [ + "--", + "-G", + "Unix Makefiles", + "-DCMAKE_BUILD_TYPE=Debug", + "-DCMAKE_C_COMPILER:PATH=" + c_compiler, + "-DCMAKE_CXX_COMPILER:PATH=" + cxx_compiler, + "-DDPCTL_ENABLE_LO_PROGRAM_CREATION=" + ("ON" if level_zero else "OFF"), + "-DDPCTL_DPCPP_FROM_ONEAPI:BOOL=" + ("ON" if use_oneapi else "OFF"), + ] + if compiler_root: + cmake_args += [ + "-DDPCTL_DPCPP_HOME_DIR:PATH=" + compiler_root, + ] + subprocess.check_call( + cmake_args, shell=False, cwd=setup_dir, env=os.environ + ) + + +if __name__ == "__main__": + import argparse + + parser = argparse.ArgumentParser( + description="Driver to build dpctl for in-place installation" + ) + driver = parser.add_argument_group(title="Coverage driver arguments") + driver.add_argument("--c-compiler", help="Name of C compiler", default=None) + driver.add_argument( + "--cxx-compiler", help="Name of C++ compiler", default=None + ) + driver.add_argument( + "--oneapi", + help="Is one-API installation", + dest="oneapi", + action="store_true", + ) + driver.add_argument( + "--compiler-root", type=str, help="Path to compiler home directory" + ) + driver.add_argument( + "--cmake-executable", type=str, help="Path to cmake executable" + ) + driver.add_argument( + "--no-level-zero", + help="Enable Level Zero support", + dest="level_zero", + action="store_false", + ) + args = parser.parse_args() + + if args.oneapi: + args.c_compiler = "icx" + args.cxx_compiler = "icpx" + args.compiler_root = None + else: + args_to_validate = [ + "c_compiler", + "cxx_compiler", + "compiler_root", + ] + for p in args_to_validate: + arg = getattr(args, p, None) + if not isinstance(arg, str): + opt_name = p.replace("_", "-") + raise RuntimeError( + f"Option {opt_name} must be provided is " + "using non-default DPC++ layout" + ) + if not os.path.exists(arg): + raise RuntimeError(f"Path {arg} must exist") + + run( + use_oneapi=args.oneapi, + c_compiler=args.c_compiler, + cxx_compiler=args.cxx_compiler, + level_zero=args.level_zero, + compiler_root=args.compiler_root, + cmake_executable=args.cmake_executable, + ) diff --git a/scripts/environment.yml b/scripts/environment.yml deleted file mode 100644 index 0a063c0a95..0000000000 --- a/scripts/environment.yml +++ /dev/null @@ -1,5 +0,0 @@ -channels: - - defaults -dependencies: - - python=3.7 - - conda-build diff --git a/scripts/gen_coverage.py b/scripts/gen_coverage.py new file mode 100644 index 0000000000..68ad75ea52 --- /dev/null +++ b/scripts/gen_coverage.py @@ -0,0 +1,157 @@ +import os +import subprocess +import sys + + +def run( + use_oneapi=True, + c_compiler=None, + cxx_compiler=None, + level_zero=True, + compiler_root=None, + run_pytest=False, + bin_llvm=None, +): + IS_LIN = False + + if "linux" in sys.platform: + IS_LIN = True + elif sys.platform in ["win32", "cygwin"]: + pass + else: + assert False, sys.platform + " not supported" + + if not IS_LIN: + raise RuntimeError( + "This scripts only supports coverage collection on Linux" + ) + setup_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + cmake_args = [ + sys.executable, + "setup.py", + "develop", + "--", + "-G", + "Unix Makefiles", + "-DCMAKE_BUILD_TYPE=Debug", + "-DCMAKE_C_COMPILER:PATH=" + c_compiler, + "-DCMAKE_CXX_COMPILER:PATH=" + cxx_compiler, + "-DDPCTL_ENABLE_LO_PROGRAM_CREATION=" + ("ON" if level_zero else "OFF"), + "-DDPCTL_GENERATE_COVERAGE=ON", + "-DDPCTL_BUILD_CAPI_TESTS=ON", + "-DDPCTL_COVERAGE_REPORT_OUTPUT_DIR=" + setup_dir, + "-DDPCTL_DPCPP_FROM_ONEAPI:BOOL=" + ("ON" if use_oneapi else "OFF"), + ] + if compiler_root: + cmake_args += [ + "-DDPCTL_DPCPP_HOME_DIR:PATH=" + compiler_root, + ] + env = None + if bin_llvm: + env = { + "PATH": ":".join((os.environ.get("PATH", ""), bin_llvm)), + } + env.update({k: v for k, v in os.environ.items() if k != "PATH"}) + subprocess.check_call(cmake_args, shell=False, cwd=setup_dir, env=env) + test_dir = ( + subprocess.check_output( + ["find", "_skbuild", "-name", "tests"], cwd=setup_dir + ) + .decode("utf-8") + .strip("\n") + ) + subprocess.check_call( + ["make", "-C", test_dir, "lcov-genhtml"], cwd=setup_dir + ) + subprocess.check_call( + [ + "pytest", + "-q", + "-ra", + "--disable-warnings", + "--cov-config", + "pyproject.toml", + "--cov", + "dpctl", + "--cov-report", + "term-missing", + "--pyargs", + "dpctl", + "-vv", + ], + cwd=setup_dir, + shell=False, + ) + + +if __name__ == "__main__": + import argparse + + parser = argparse.ArgumentParser( + description="Driver to build dpctl and generate coverage" + ) + driver = parser.add_argument_group(title="Coverage driver arguments") + driver.add_argument("--c-compiler", help="Name of C compiler", default=None) + driver.add_argument( + "--cxx-compiler", help="Name of C++ compiler", default=None + ) + driver.add_argument( + "--not-oneapi", + help="Is one-API installation", + dest="oneapi", + action="store_false", + ) + driver.add_argument( + "--compiler-root", type=str, help="Path to compiler home directory" + ) + driver.add_argument( + "--no-level-zero", + help="Enable Level Zero support", + dest="level_zero", + action="store_false", + ) + driver.add_argument( + "--skip-pytest", + help="Run pytest and collect coverage", + dest="run_pytest", + action="store_false", + ) + driver.add_argument( + "--bin-llvm", help="Path to folder where llvm-cov can be found" + ) + args = parser.parse_args() + + if args.oneapi: + args.c_compiler = "icx" + args.cxx_compiler = "icpx" + args.compiler_root = None + icx_path = subprocess.check_output(["which", "icx"]) + bin_dir = os.path.dirname(os.path.dirname(icx_path)) + args.bin_llvm = os.path.join(bin_dir.decode("utf-8"), "bin-llvm") + else: + args_to_validate = [ + "c_compiler", + "cxx_compiler", + "compiler_root", + "bin_llvm", + ] + for p in args_to_validate: + arg = getattr(args, p, None) + if not isinstance(arg, str): + opt_name = p.replace("_", "-") + raise RuntimeError( + f"Option {opt_name} must be provided is " + "using non-default DPC++ layout" + ) + if not os.path.exists(arg): + raise RuntimeError(f"Path {arg} must exist") + + run( + use_oneapi=args.oneapi, + c_compiler=args.c_compiler, + cxx_compiler=args.cxx_compiler, + level_zero=args.level_zero, + compiler_root=args.compiler_root, + run_pytest=args.run_pytest, + bin_llvm=args.bin_llvm, + ) diff --git a/setup.py b/setup.py index d88580e242..c660f01180 100644 --- a/setup.py +++ b/setup.py @@ -14,463 +14,72 @@ # See the License for the specific language governing permissions and # limitations under the License. -import glob -import os import os.path +import pathlib import shutil -import sys -import numpy as np -import setuptools.command.build_ext as orig_build_ext -import setuptools.command.develop as orig_develop -import setuptools.command.install as orig_install -from Cython.Build import cythonize -from setuptools import Extension, find_packages, setup +import skbuild +import skbuild.setuptools_wrap +import skbuild.utils +from setuptools import find_packages import versioneer -IS_WIN = False -IS_LIN = False - -if "linux" in sys.platform: - IS_LIN = True -elif sys.platform in ["win32", "cygwin"]: - IS_WIN = True -else: - assert False, "We currently do not build for " + sys.platform - -# global variable used to pass value of --coverage option of develop command -# to build_ext command -_coverage = False -dpctl_sycl_interface_lib = "dpctl" -dpctl_sycl_interface_include = os.path.join("dpctl", "include") - # Get long description with open("README.md", "r", encoding="utf-8") as file: long_description = file.read() -def remove_empty(li): - return [el for el in li if el] - - -def get_sdl_cflags(): - cflags = [] - if IS_LIN: - cflags = [ - "-fstack-protector", - "-fPIC", - "-D_FORTIFY_SOURCE=2", - "-Wformat", - "-Wformat-security", - ] - # Add cflags from environment - cflags += remove_empty(os.getenv("CFLAGS", "").split(" ")) - - return cflags - - -def get_sdl_ldflags(): - ldflags = [] - if IS_LIN: - ldflags = ["-Wl,-z,noexecstack,-z,relro,-z,now"] - elif IS_WIN: - ldflags = [r"/NXCompat", r"/DynamicBase"] - # Add ldflags from environment - ldflags += remove_empty(os.getenv("LDFLAGS", "").split(" ")) - - return ldflags - - -def get_other_cxxflags(): - if IS_LIN: - return ["-O3", "-std=c++17"] - elif IS_WIN: - # FIXME: These are specific to MSVC and we should first make sure - # what compiler we are using. - return [r"/Ox", r"/std:c++17"] - - -def get_suppressed_warning_flags(): - if IS_LIN: - # PEP 590 renamed "tp_print" to "tp_vectorcall" and this causes a flood - # of deprecation warnings in the Cython generated module. This flag - # temporarily suppresses the warnings. The flag should not be needed - # once we move to Python 3.9 and/or Cython 0.30. - return ["-Wno-deprecated-declarations"] - elif IS_WIN: - return [] - - -def build_backend(l0_support, coverage, sycl_compiler_prefix): - import os.path - from importlib.util import module_from_spec, spec_from_file_location - - spec = spec_from_file_location( - "build_backend", os.path.join("scripts", "build_backend.py") - ) - builder_module = module_from_spec(spec) - spec.loader.exec_module(builder_module) - builder_module.build_backend( - l0_support=l0_support, - code_coverage=coverage, - sycl_compiler_prefix=sycl_compiler_prefix, - ) - - -def extensions(): - # Security flags - eca = get_sdl_cflags() - ela = get_sdl_ldflags() - libs = [] - libraries = [] - - if IS_LIN: - libs += ["rt", "DPCTLSyclInterface"] - libraries = [dpctl_sycl_interface_lib] - runtime_library_dirs = ["$ORIGIN"] - elif IS_WIN: - libs += ["DPCTLSyclInterface"] - libraries = [dpctl_sycl_interface_lib] - runtime_library_dirs = [] - - extension_args = { - "depends": [ - dpctl_sycl_interface_include, - ], - "include_dirs": [np.get_include(), dpctl_sycl_interface_include], - "extra_compile_args": ( - eca + get_other_cxxflags() + get_suppressed_warning_flags() - ), - "extra_link_args": ela, - "libraries": libs, - "library_dirs": libraries, - "runtime_library_dirs": runtime_library_dirs, - "language": "c++", - "define_macros": [], - } - - extensions = [ - Extension( - "dpctl._sycl_context", - [ - os.path.join("dpctl", "_sycl_context.pyx"), - ], - **extension_args, - ), - Extension( - "dpctl._sycl_device", - [ - os.path.join("dpctl", "_sycl_device.pyx"), - ], - **extension_args, - ), - Extension( - "dpctl._sycl_device_factory", - [ - os.path.join("dpctl", "_sycl_device_factory.pyx"), - ], - **extension_args, - ), - Extension( - "dpctl._sycl_event", - [ - os.path.join("dpctl", "_sycl_event.pyx"), - ], - **extension_args, - ), - Extension( - "dpctl._sycl_platform", - [ - os.path.join("dpctl", "_sycl_platform.pyx"), - ], - **extension_args, - ), - Extension( - "dpctl._sycl_queue", - [ - os.path.join("dpctl", "_sycl_queue.pyx"), - ], - **extension_args, - ), - Extension( - "dpctl._sycl_queue_manager", - [ - os.path.join("dpctl", "_sycl_queue_manager.pyx"), - ], - **extension_args, - ), - Extension( - "dpctl.memory._memory", - [ - os.path.join("dpctl", "memory", "_memory.pyx"), - ], - **extension_args, - ), - Extension( - "dpctl.program._program", - [ - os.path.join("dpctl", "program", "_program.pyx"), - ], - **extension_args, - ), - Extension( - "dpctl.utils._compute_follows_data", - [ - os.path.join("dpctl", "utils", "_compute_follows_data.pyx"), - ], - **extension_args, - ), - Extension( - "dpctl.tensor._usmarray", - [ - os.path.join("dpctl", "tensor", "_usmarray.pyx"), - ], - depends=extension_args["depends"] - + [os.path.join("libtensor", "include", "usm_array.hpp")], - language="c++", - include_dirs=( - extension_args["include_dirs"] - + [os.path.join("libtensor", "include")] - ), - extra_compile_args=extension_args["extra_compile_args"], - extra_link_args=extension_args["extra_link_args"], - libraries=extension_args["libraries"], - library_dirs=extension_args["library_dirs"], - runtime_library_dirs=extension_args["runtime_library_dirs"], - define_macros=extension_args["define_macros"], - ), - Extension( - "dpctl.tensor._dlpack", - [ - os.path.join("dpctl", "tensor", "_dlpack.pyx"), - ], - depends=extension_args["depends"], - language="c++", - include_dirs=extension_args["include_dirs"] - + [ - os.path.join("dpctl", "tensor"), - ], - extra_compile_args=extension_args["extra_compile_args"], - extra_link_args=extension_args["extra_link_args"], - libraries=extension_args["libraries"], - library_dirs=extension_args["library_dirs"], - runtime_library_dirs=extension_args["runtime_library_dirs"], - define_macros=extension_args["define_macros"], - ), - ] - return extensions - - -class build_ext(orig_build_ext.build_ext): - description = "Build dpctl native extensions" - - def finalize_options(self): - if _coverage: - pre_d = getattr(self, "define", None) - if pre_d is None: - self.define = "CYTHON_TRACE" - else: - self.define = ",".join((pre_d, "CYTHON_TRACE")) - super().finalize_options() - - def run(self): - return super().run() - - -def get_build_py(orig_build_py): - class build_py(orig_build_py): - def run(self): - dpctl_src_dir = self.get_package_dir("dpctl") - dpctl_build_dir = os.path.join(self.build_lib, "dpctl") - os.makedirs(dpctl_build_dir, exist_ok=True) - if IS_LIN: - for fn in glob.glob(os.path.join(dpctl_src_dir, "*.so*")): - # Check if the file already exists before copying. - # The check is needed when dealing with symlinks. - if not os.path.exists( - os.path.join(dpctl_build_dir, os.path.basename(fn)) - ): - shutil.copy( - src=fn, - dst=dpctl_build_dir, - follow_symlinks=False, - ) - elif IS_WIN: - for fn in glob.glob(os.path.join(dpctl_src_dir, "*.lib")): - shutil.copy(src=fn, dst=dpctl_build_dir) - - for fn in glob.glob(os.path.join(dpctl_src_dir, "*.dll")): - shutil.copy(src=fn, dst=dpctl_build_dir) - else: - raise NotImplementedError("Unsupported platform") - return super().run() - - return build_py - - -class install(orig_install.install): - description = "Installs dpctl into Python prefix" - user_options = orig_install.install.user_options + [ - ( - "level-zero-support=", - None, - "Whether to enable support for program creation " - "for Level-zero backend", - ), - ( - "sycl-compiler-prefix=", - None, - "Path to SYCL compiler installation. None means " - "read it off ONEAPI_ROOT environment variable or fail.", - ), - ] - - def initialize_options(self): - super().initialize_options() - self.level_zero_support = "True" - self.sycl_compiler_prefix = None +def _get_cmdclass(): + cmdclass = versioneer.get_cmdclass() + return cmdclass - def finalize_options(self): - if isinstance(self.level_zero_support, str): - self.level_zero_support = self.level_zero_support.capitalize() - if self.level_zero_support in ["True", "False", "0", "1"]: - self.level_zero_support = bool(eval(self.level_zero_support)) - else: - raise ValueError( - "--level-zero-support value is invalid, use True/False" - ) - if isinstance(self.sycl_compiler_prefix, str): - if not os.path.exists(os.path.join(self.sycl_compiler_prefix)): - raise ValueError( - "--sycl-compiler-prefix expects a path " - "to an existing directory" - ) - elif self.sycl_compiler_prefix is None: - pass - else: - raise ValueError( - "--sycl-compiler-prefix value is invalid, use a " - "path to compiler installation. To use oneAPI, use the " - "default value, but remember to activate the compiler " - "environment" - ) - super().finalize_options() - def run(self): - build_backend(self.level_zero_support, False, self.sycl_compiler_prefix) - if _coverage: - pre_d = getattr(self, "define", None) - if pre_d is None: - self.define = "CYTHON_TRACE" - else: - self.define = ",".join((pre_d, "CYTHON_TRACE")) - cythonize(self.distribution.ext_modules) - ret = super().run() - if IS_LIN: - dpctl_build_dir = os.path.join( - os.path.dirname(__file__), self.build_lib, "dpctl" - ) - dpctl_install_dir = os.path.join(self.install_libbase, "dpctl") - for fn in glob.glob( - os.path.join(dpctl_install_dir, "*DPCTLSyclInterface.so*") - ): - os.remove(fn) - shutil.copy( - src=os.path.join(dpctl_build_dir, os.path.basename(fn)), - dst=dpctl_install_dir, - follow_symlinks=False, - ) - return ret +def cleanup_destination(cmake_manifest): + """Delete library files from dpctl/ folder before + letting skbuild copy them over to avoid errors. + """ + _to_unlink = [] + for fn in cmake_manifest: + bn = os.path.basename(fn) + # delete + if "DPCTLSyclInterface" in bn: + lib_fn = os.path.join("dpctl", bn) + if os.path.exists(lib_fn): + _to_unlink.append(lib_fn) + for fn in _to_unlink: + pathlib.Path(fn).unlink() + return cmake_manifest -class develop(orig_develop.develop): - description = "Installs dpctl in place" - user_options = orig_develop.develop.user_options + [ - ( - "level-zero-support=", - None, - "Whether to enable support for program creation " - "for Level-zero backend", - ), - ( - "sycl-compiler-prefix=", - None, - "Path to SYCL compiler installation. None means " - "read it off ONEAPI_ROOT environment variable or fail.", - ), - ( - "coverage=", - None, - "Whether to generate coverage report " - "when building the backend library", - ), - ] +def _patched_copy_file(src_file, dest_file, hide_listing=True): + """Copy ``src_file`` to ``dest_file`` ensuring parent directory exists. - def initialize_options(self): - super().initialize_options() - self.level_zero_support = "True" - self.coverage = "False" - self.sycl_compiler_prefix = None + By default, message like `creating directory /path/to/package` and + `copying directory /src/path/to/package -> path/to/package` are displayed + on standard output. Setting ``hide_listing`` to False avoids message from + being displayed. - def finalize_options(self): - if isinstance(self.level_zero_support, str): - self.level_zero_support = self.level_zero_support.capitalize() - if self.level_zero_support in ["True", "False", "0", "1"]: - self.level_zero_support = bool(eval(self.level_zero_support)) - else: - raise ValueError( - "--level-zero-support value is invalid, use True/False" - ) - if isinstance(self.coverage, str): - self.coverage = self.coverage.capitalize() - if self.coverage in ["True", "False", "0", "1"]: - self.coverage = bool(eval(self.coverage)) - global _coverage - _coverage = self.coverage - else: - raise ValueError("--coverage value is invalid, use True/False") - if isinstance(self.sycl_compiler_prefix, str): - if not os.path.exists(os.path.join(self.sycl_compiler_prefix)): - raise ValueError( - "--sycl-compiler-prefix expects a path " - "to an existing directory" - ) - elif self.sycl_compiler_prefix is None: - pass - else: - raise ValueError( - "--sycl-compiler-prefix value is invalid, use a " - "path to compiler installation. To use oneAPI, use the " - "default value, but remember to activate the compiler " - "environment" - ) - super().finalize_options() + NB: Patched here to not follows symbolic links + """ + # Create directory if needed + dest_dir = os.path.dirname(dest_file) + if dest_dir != "" and not os.path.exists(dest_dir): + if not hide_listing: + print("creating directory {}".format(dest_dir)) + skbuild.utils.mkdir_p(dest_dir) - def run(self): - build_backend( - self.level_zero_support, self.coverage, self.sycl_compiler_prefix - ) - if _coverage: - pre_d = getattr(self, "define", None) - if pre_d is None: - self.define = "CYTHON_TRACE" - else: - self.define = ",".join((pre_d, "CYTHON_TRACE")) - cythonize(self.distribution.ext_modules) - return super().run() + # Copy file + if not hide_listing: + print("copying {} -> {}".format(src_file, dest_file)) + shutil.copyfile(src_file, dest_file, follow_symlinks=False) + shutil.copymode(src_file, dest_file, follow_symlinks=False) -def _get_cmdclass(): - cmdclass = versioneer.get_cmdclass() - cmdclass["build_py"] = get_build_py(cmdclass["build_py"]) - cmdclass["install"] = install - cmdclass["develop"] = develop - cmdclass["build_ext"] = build_ext - return cmdclass +skbuild.setuptools_wrap._copy_file = _patched_copy_file -setup( +skbuild.setup( name="dpctl", version=versioneer.get_version(), cmdclass=_get_cmdclass(), @@ -481,14 +90,24 @@ def _get_cmdclass(): author="Intel Corporation", url="https://github.com/IntelPython/dpctl", packages=find_packages(include=["*"]), - package_data={"dpctl": ["tests/*", "tests/helper/*.py"]}, + package_data={"dpctl": ["tests/*.*", "tests/helper/*.py"]}, include_package_data=True, - ext_modules=extensions(), zip_safe=False, setup_requires=["Cython"], install_requires=[ "numpy", ], + extra_require={ + "docs": [ + "Cython", + "sphinx", + "sphinx_rtd_theme", + "pydot", + "graphviz", + "sphinxcontrib-programoutput", + ], + "coverage": ["Cython", "pytest", "pytest-cov", "coverage", "tomli"], + }, keywords="dpctl", classifiers=[ "Development Status :: 3 - Alpha", @@ -496,4 +115,5 @@ def _get_cmdclass(): "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", ], + cmake_process_manifest_hook=cleanup_destination, )