diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c5ff2d0368..92e1ccc5fb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,9 +17,9 @@ This is a bug-fix release. ### Fixed * Resolved an issue with Compute Follows Data inconsistency in `dpnp.extract` function [#2172](https://github.com/IntelPython/dpnp/pull/2172) +* Resolves an import error when using `dpnp` in virtual environment on Linux [#2199](https://github.com/IntelPython/dpnp/pull/2199) * Resolved a compilation error when building with DPC++ 2025.1 compiler [#2211](https://github.com/IntelPython/dpnp/pull/2211) - ## [0.16.0] - 10/14/2024 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. diff --git a/CMakeLists.txt b/CMakeLists.txt index 45e2ffb51c4..8e2b260cb39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,8 +6,9 @@ project(dpnp DESCRIPTION "NumPy-like API accelerated by SYCL." ) -option(DPNP_GENERATE_COVERAGE "Enable build DPNP with coverage instrumentation" FALSE) -option(DPNP_BACKEND_TESTS "Enable building of DPNP backend test suite" FALSE) +option(DPNP_GENERATE_COVERAGE "Enable build DPNP with coverage instrumentation" OFF) +option(DPNP_BACKEND_TESTS "Enable building of DPNP backend test suite" OFF) +option(DPNP_WITH_REDIST "Build DPNP assuming DPC++ redistributable is installed into Python prefix" OFF) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED True) diff --git a/conda-recipe/bld.bat b/conda-recipe/bld.bat index 922b6949d2f..3dcdf754e27 100644 --- a/conda-recipe/bld.bat +++ b/conda-recipe/bld.bat @@ -16,7 +16,7 @@ if DEFINED OVERRIDE_INTEL_IPO ( set "SKBUILD_ARGS=%SKBUILD_ARGS% -DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=FALSE" ) -FOR %%V IN (14.0.0 14 15.0.0 15 16.0.0 16 17.0.0 17) DO @( +FOR %%V IN (17.0.0 17 18.0.0 18 19.0.0 19) DO @( REM set DIR_HINT if directory exists IF EXIST "%BUILD_PREFIX%\Library\lib\clang\%%V\" ( SET "SYCL_INCLUDE_DIR_HINT=%BUILD_PREFIX%\Library\lib\clang\%%V" diff --git a/conda-recipe/build.sh b/conda-recipe/build.sh index fa4b5a1c6e6..d4523cae7be 100755 --- a/conda-recipe/build.sh +++ b/conda-recipe/build.sh @@ -1,7 +1,7 @@ #!/bin/bash # This is necessary to help DPC++ find Intel libraries such as SVML, IRNG, etc in build prefix -export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${BUILD_PREFIX}/lib" +export LIBRARY_PATH="$LIBRARY_PATH:${BUILD_PREFIX}/lib" # Intel LLVM must cooperate with compiler and sysroot from conda 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 export MKL_ROOT_HINT=$PREFIX SKBUILD_ARGS=(-- "-DCMAKE_C_COMPILER:PATH=icx" "-DCMAKE_CXX_COMPILER:PATH=icpx" "-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON") SKBUILD_ARGS=("${SKBUILD_ARGS[@]}" "-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON") +SKBUILD_ARGS=("${SKBUILD_ARGS[@]}" "-DDPNP_WITH_REDIST:BOOL=ON") # Build wheel package WHEELS_BUILD_ARGS=("-p" "manylinux_2_28_x86_64") diff --git a/dpnp/CMakeLists.txt b/dpnp/CMakeLists.txt index da46cf99e3f..d07004acde9 100644 --- a/dpnp/CMakeLists.txt +++ b/dpnp/CMakeLists.txt @@ -1,6 +1,5 @@ function(build_dpnp_cython_ext _trgt _src _dest) set(options SYCL) - cmake_parse_arguments(BUILD_DPNP_EXT "${options}" "" "" ${ARGN}) add_cython_target(${_trgt} ${_src} CXX OUTPUT_VAR _generated_src) message(STATUS "Using ${_trgt}") @@ -41,15 +40,19 @@ function(build_dpnp_cython_ext _trgt _src _dest) VERBATIM COMMENT "Copying Cython-generated source for target ${_trgt} to dpnp source layout" ) endif() + + set(_rpath_value "$ORIGIN/..") + if (DPNP_WITH_REDIST) + set(_rpath_value "${_rpath_value}:$ORIGIN/../../../../") + endif() + set_target_properties(${_trgt} PROPERTIES INSTALL_RPATH ${_rpath_value}) + install(TARGETS ${_trgt} LIBRARY DESTINATION ${_dest}) endfunction() function(build_dpnp_cython_ext_with_backend _trgt _src _dest) build_dpnp_cython_ext(${_trgt} ${_src} ${_dest}) target_link_libraries(${_trgt} PRIVATE dpnp_backend_library) - if (UNIX) - set_target_properties(${_trgt} PROPERTIES INSTALL_RPATH "$ORIGIN/..") - endif() endfunction() add_subdirectory(backend) diff --git a/dpnp/backend/CMakeLists.txt b/dpnp/backend/CMakeLists.txt index 64d1e81c9c2..2cc65864f91 100644 --- a/dpnp/backend/CMakeLists.txt +++ b/dpnp/backend/CMakeLists.txt @@ -102,6 +102,10 @@ add_library(dpnp_backend_library INTERFACE IMPORTED GLOBAL) target_include_directories(dpnp_backend_library BEFORE INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/src) target_link_libraries(dpnp_backend_library INTERFACE ${_trgt}) +if (DPNP_WITH_REDIST) + set_target_properties(${python_module_name} PROPERTIES INSTALL_RPATH "$ORIGIN/../../../") +endif() + if (DPNP_BACKEND_TESTS) add_subdirectory(tests) endif() diff --git a/dpnp/backend/extensions/blas/CMakeLists.txt b/dpnp/backend/extensions/blas/CMakeLists.txt index 1695785e794..0aafd1ba8b4 100644 --- a/dpnp/backend/extensions/blas/CMakeLists.txt +++ b/dpnp/backend/extensions/blas/CMakeLists.txt @@ -93,6 +93,10 @@ else() target_link_libraries(${python_module_name} PUBLIC MKL::MKL_SYCL::BLAS) endif() +if (DPNP_WITH_REDIST) + set_target_properties(${python_module_name} PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../") +endif() + install(TARGETS ${python_module_name} DESTINATION "dpnp/backend/extensions/blas" ) diff --git a/dpnp/backend/extensions/fft/CMakeLists.txt b/dpnp/backend/extensions/fft/CMakeLists.txt index 939848a12d6..f9fd08a30cc 100644 --- a/dpnp/backend/extensions/fft/CMakeLists.txt +++ b/dpnp/backend/extensions/fft/CMakeLists.txt @@ -89,6 +89,10 @@ else() target_link_libraries(${python_module_name} PUBLIC MKL::MKL_SYCL::DFT) endif() +if (DPNP_WITH_REDIST) + set_target_properties(${python_module_name} PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../") +endif() + install(TARGETS ${python_module_name} DESTINATION "dpnp/backend/extensions/fft" ) diff --git a/dpnp/backend/extensions/lapack/CMakeLists.txt b/dpnp/backend/extensions/lapack/CMakeLists.txt index 8d5dd5342b5..de37e25443e 100644 --- a/dpnp/backend/extensions/lapack/CMakeLists.txt +++ b/dpnp/backend/extensions/lapack/CMakeLists.txt @@ -107,6 +107,10 @@ else() target_link_libraries(${python_module_name} PUBLIC MKL::MKL_SYCL::LAPACK) endif() +if (DPNP_WITH_REDIST) + set_target_properties(${python_module_name} PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../") +endif() + install(TARGETS ${python_module_name} DESTINATION "dpnp/backend/extensions/lapack" ) diff --git a/dpnp/backend/extensions/ufunc/CMakeLists.txt b/dpnp/backend/extensions/ufunc/CMakeLists.txt index 3580c29ef08..e138537dc0a 100644 --- a/dpnp/backend/extensions/ufunc/CMakeLists.txt +++ b/dpnp/backend/extensions/ufunc/CMakeLists.txt @@ -97,6 +97,10 @@ if (DPNP_GENERATE_COVERAGE) target_link_options(${python_module_name} PRIVATE -fprofile-instr-generate -fcoverage-mapping) endif() +if (DPNP_WITH_REDIST) + set_target_properties(${python_module_name} PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../") +endif() + install(TARGETS ${python_module_name} DESTINATION "dpnp/backend/extensions/ufunc" ) diff --git a/dpnp/backend/extensions/vm/CMakeLists.txt b/dpnp/backend/extensions/vm/CMakeLists.txt index 0bbf6476aa5..79b2238b74d 100644 --- a/dpnp/backend/extensions/vm/CMakeLists.txt +++ b/dpnp/backend/extensions/vm/CMakeLists.txt @@ -120,6 +120,10 @@ else() target_link_libraries(${python_module_name} PUBLIC MKL::MKL_SYCL::VM) endif() +if (DPNP_WITH_REDIST) + set_target_properties(${python_module_name} PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../") +endif() + install(TARGETS ${python_module_name} DESTINATION "dpnp/backend/extensions/vm" )