Refactor dpnp includes and add extension example#2941
Conversation
Enables find_package(Dpnp) out of the box
move dpnp4pybind11.hpp and usm_ndarray_constants.h into a top-level include directory, similar to original dpctl layout
makes include explicit
serves to test dpnp cmake integration
|
View rendered docs @ https://intelpython.github.io/dpnp/pull/2941/index.html |
|
Array API standard conformance tests for dpnp=0.21.0dev0=py313h509198e_71 ran successfully. |
622aa32 to
c735f53
Compare
| @@ -0,0 +1,77 @@ | |||
| # ***************************************************************************** | |||
| # Copyright (c) 2016, Intel Corporation | |||
There was a problem hiding this comment.
| # Copyright (c) 2016, Intel Corporation | |
| # Copyright (c) 2026, Intel Corporation |
| @@ -0,0 +1,49 @@ | |||
| # ***************************************************************************** | |||
| # Copyright (c) 2016, Intel Corporation | |||
There was a problem hiding this comment.
| # Copyright (c) 2016, Intel Corporation | |
| # Copyright (c) 2026, Intel Corporation |
| @@ -0,0 +1,72 @@ | |||
| # -*- coding: utf-8 -*- | |||
| # ***************************************************************************** | |||
| # Copyright (c) 2023, Intel Corporation | |||
There was a problem hiding this comment.
| # Copyright (c) 2023, Intel Corporation | |
| # Copyright (c) 2026, Intel Corporation |
| @@ -0,0 +1,38 @@ | |||
| # ***************************************************************************** | |||
| # Copyright (c) 2016, Intel Corporation | |||
There was a problem hiding this comment.
| # Copyright (c) 2016, Intel Corporation | |
| # Copyright (c) 2026, Intel Corporation |
| # may be used to endorse or promote products derived from this software | ||
| # without specific prior written permission. | ||
| # | ||
| # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"ad |
There was a problem hiding this comment.
| # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"ad | |
| # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| parser.add_argument( | ||
| "--cmakedir", | ||
| action="store_true", | ||
| help="CMake module directory, ideal for setting -DDPCTL_ROOT in CMake.", |
There was a problem hiding this comment.
This looks like a direct copy from dpctl without any changes
| kernels | ||
| utils |
There was a problem hiding this comment.
find_path() uses OR semantics for multiple names so this check will succeed if either kernels or utils is present and it does not guarantee that both directories exist
| set(SYCL_MODULE_PATH "${CMAKE_SOURCE_DIR}/../../../dpnp/backend/cmake/Modules") | ||
| set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${SYCL_MODULE_PATH}) | ||
| find_package(IntelSYCL REQUIRED PATHS ${SYCL_MODULE_PATH} NO_DEFAULT_PATH) |
There was a problem hiding this comment.
Since dpctl already ships IntelSYCLConfig.cmake could this be replaced with
find_package(IntelSYCL REQUIRED PATHS "${Dpctl_DIR}" NO_DEFAULT_PATH) after find_package(Dpctl REQUIRED)?
Or does it make sense to install IntelSYCLConfig.cmake into dpnp/resources/cmake/ and use "${Dpnp_DIR}" instead?
This PR proposes a refactor of dpnp's includes and the introduction of an example extension, to be tested to make sure examples using dpnp and dpnp.tensor can be written.
The
usm_ndarray_constants.hheader anddpnp4pybind11.hppare moved todpnp/include, removing a relative include and aligning with previous dpctl behavior.Also introduces dpnp-config.cmake, which enables
find_package(Dpnp)out of the box, which is installed with dpnp, and--cmakedircommand line option, which leads to the CMake config.