Skip to content

Commit 39439dd

Browse files
authored
Backport gh-2199 (#2217)
This PR backports of #2199 from development branch to `maintenance/0.16.x`.
1 parent 60025dc commit 39439dd

File tree

11 files changed

+38
-9
lines changed

11 files changed

+38
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ This is a bug-fix release.
1717
### Fixed
1818

1919
* Resolved an issue with Compute Follows Data inconsistency in `dpnp.extract` function [#2172](https://github.com/IntelPython/dpnp/pull/2172)
20+
* Resolves an import error when using `dpnp` in virtual environment on Linux [#2199](https://github.com/IntelPython/dpnp/pull/2199)
2021
* Resolved a compilation error when building with DPC++ 2025.1 compiler [#2211](https://github.com/IntelPython/dpnp/pull/2211)
2122

22-
2323
## [0.16.0] - 10/14/2024
2424

2525
This release reaches an important milestone by making offloading fully asynchronous. Calls to `dpnp` submit tasks for execution to DPC++ runtime and return without waiting for execution of these tasks to finish. The sequential semantics a user comes to expect from execution of Python script is preserved though.

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ project(dpnp
66
DESCRIPTION "NumPy-like API accelerated by SYCL."
77
)
88

9-
option(DPNP_GENERATE_COVERAGE "Enable build DPNP with coverage instrumentation" FALSE)
10-
option(DPNP_BACKEND_TESTS "Enable building of DPNP backend test suite" FALSE)
9+
option(DPNP_GENERATE_COVERAGE "Enable build DPNP with coverage instrumentation" OFF)
10+
option(DPNP_BACKEND_TESTS "Enable building of DPNP backend test suite" OFF)
11+
option(DPNP_WITH_REDIST "Build DPNP assuming DPC++ redistributable is installed into Python prefix" OFF)
1112

1213
set(CMAKE_CXX_STANDARD 17)
1314
set(CMAKE_CXX_STANDARD_REQUIRED True)

conda-recipe/bld.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if DEFINED OVERRIDE_INTEL_IPO (
1616
set "SKBUILD_ARGS=%SKBUILD_ARGS% -DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=FALSE"
1717
)
1818

19-
FOR %%V IN (14.0.0 14 15.0.0 15 16.0.0 16 17.0.0 17) DO @(
19+
FOR %%V IN (17.0.0 17 18.0.0 18 19.0.0 19) DO @(
2020
REM set DIR_HINT if directory exists
2121
IF EXIST "%BUILD_PREFIX%\Library\lib\clang\%%V\" (
2222
SET "SYCL_INCLUDE_DIR_HINT=%BUILD_PREFIX%\Library\lib\clang\%%V"

conda-recipe/build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
# This is necessary to help DPC++ find Intel libraries such as SVML, IRNG, etc in build prefix
4-
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${BUILD_PREFIX}/lib"
4+
export LIBRARY_PATH="$LIBRARY_PATH:${BUILD_PREFIX}/lib"
55

66
# Intel LLVM must cooperate with compiler and sysroot from conda
77
echo "--gcc-toolchain=${BUILD_PREFIX} --sysroot=${BUILD_PREFIX}/${HOST}/sysroot -target ${HOST}" > icpx_for_conda.cfg
@@ -18,6 +18,7 @@ export DPL_ROOT_HINT=$PREFIX
1818
export MKL_ROOT_HINT=$PREFIX
1919
SKBUILD_ARGS=(-- "-DCMAKE_C_COMPILER:PATH=icx" "-DCMAKE_CXX_COMPILER:PATH=icpx" "-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON")
2020
SKBUILD_ARGS=("${SKBUILD_ARGS[@]}" "-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON")
21+
SKBUILD_ARGS=("${SKBUILD_ARGS[@]}" "-DDPNP_WITH_REDIST:BOOL=ON")
2122

2223
# Build wheel package
2324
WHEELS_BUILD_ARGS=("-p" "manylinux_2_28_x86_64")

dpnp/CMakeLists.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
function(build_dpnp_cython_ext _trgt _src _dest)
22
set(options SYCL)
3-
cmake_parse_arguments(BUILD_DPNP_EXT "${options}" "" "" ${ARGN})
43
add_cython_target(${_trgt} ${_src} CXX OUTPUT_VAR _generated_src)
54
message(STATUS "Using ${_trgt}")
65

@@ -41,15 +40,19 @@ function(build_dpnp_cython_ext _trgt _src _dest)
4140
VERBATIM COMMENT "Copying Cython-generated source for target ${_trgt} to dpnp source layout"
4241
)
4342
endif()
43+
44+
set(_rpath_value "$ORIGIN/..")
45+
if (DPNP_WITH_REDIST)
46+
set(_rpath_value "${_rpath_value}:$ORIGIN/../../../../")
47+
endif()
48+
set_target_properties(${_trgt} PROPERTIES INSTALL_RPATH ${_rpath_value})
49+
4450
install(TARGETS ${_trgt} LIBRARY DESTINATION ${_dest})
4551
endfunction()
4652

4753
function(build_dpnp_cython_ext_with_backend _trgt _src _dest)
4854
build_dpnp_cython_ext(${_trgt} ${_src} ${_dest})
4955
target_link_libraries(${_trgt} PRIVATE dpnp_backend_library)
50-
if (UNIX)
51-
set_target_properties(${_trgt} PROPERTIES INSTALL_RPATH "$ORIGIN/..")
52-
endif()
5356
endfunction()
5457

5558
add_subdirectory(backend)

dpnp/backend/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ add_library(dpnp_backend_library INTERFACE IMPORTED GLOBAL)
102102
target_include_directories(dpnp_backend_library BEFORE INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/src)
103103
target_link_libraries(dpnp_backend_library INTERFACE ${_trgt})
104104

105+
if (DPNP_WITH_REDIST)
106+
set_target_properties(${python_module_name} PROPERTIES INSTALL_RPATH "$ORIGIN/../../../")
107+
endif()
108+
105109
if (DPNP_BACKEND_TESTS)
106110
add_subdirectory(tests)
107111
endif()

dpnp/backend/extensions/blas/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ else()
9393
target_link_libraries(${python_module_name} PUBLIC MKL::MKL_SYCL::BLAS)
9494
endif()
9595

96+
if (DPNP_WITH_REDIST)
97+
set_target_properties(${python_module_name} PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../")
98+
endif()
99+
96100
install(TARGETS ${python_module_name}
97101
DESTINATION "dpnp/backend/extensions/blas"
98102
)

dpnp/backend/extensions/fft/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ else()
8989
target_link_libraries(${python_module_name} PUBLIC MKL::MKL_SYCL::DFT)
9090
endif()
9191

92+
if (DPNP_WITH_REDIST)
93+
set_target_properties(${python_module_name} PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../")
94+
endif()
95+
9296
install(TARGETS ${python_module_name}
9397
DESTINATION "dpnp/backend/extensions/fft"
9498
)

dpnp/backend/extensions/lapack/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ else()
107107
target_link_libraries(${python_module_name} PUBLIC MKL::MKL_SYCL::LAPACK)
108108
endif()
109109

110+
if (DPNP_WITH_REDIST)
111+
set_target_properties(${python_module_name} PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../")
112+
endif()
113+
110114
install(TARGETS ${python_module_name}
111115
DESTINATION "dpnp/backend/extensions/lapack"
112116
)

dpnp/backend/extensions/ufunc/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ if (DPNP_GENERATE_COVERAGE)
9797
target_link_options(${python_module_name} PRIVATE -fprofile-instr-generate -fcoverage-mapping)
9898
endif()
9999

100+
if (DPNP_WITH_REDIST)
101+
set_target_properties(${python_module_name} PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../")
102+
endif()
103+
100104
install(TARGETS ${python_module_name}
101105
DESTINATION "dpnp/backend/extensions/ufunc"
102106
)

dpnp/backend/extensions/vm/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ else()
120120
target_link_libraries(${python_module_name} PUBLIC MKL::MKL_SYCL::VM)
121121
endif()
122122

123+
if (DPNP_WITH_REDIST)
124+
set_target_properties(${python_module_name} PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../")
125+
endif()
126+
123127
install(TARGETS ${python_module_name}
124128
DESTINATION "dpnp/backend/extensions/vm"
125129
)

0 commit comments

Comments
 (0)