diff --git a/.github/workflows/check-mkl-interfaces.yaml b/.github/workflows/check-onemath.yaml similarity index 95% rename from .github/workflows/check-mkl-interfaces.yaml rename to .github/workflows/check-onemath.yaml index 11a89aea9d0b..9cd16a7373e1 100644 --- a/.github/workflows/check-mkl-interfaces.yaml +++ b/.github/workflows/check-onemath.yaml @@ -1,4 +1,4 @@ -name: Test oneMKL interfaces +name: Test oneAPI Math Library (oneMath) on: push: @@ -15,7 +15,7 @@ env: build-with-oneapi-env: 'environments/build_with_oneapi.yml' dpctl-pkg-env: 'environments/dpctl_pkg.yml' oneapi-pkgs-env: 'environments/oneapi_pkgs.yml' - test-env-name: 'test_onemkl_interfaces' + test-env-name: 'test_onemath' rerun-tests-on-failure: 'true' rerun-tests-max-attempts: 2 rerun-tests-timeout: 20 @@ -58,7 +58,7 @@ jobs: path: ${{ env.environment-file }} test_by_tag: - name: Run tests with oneMKL tag + name: Run tests with OneMath tag needs: build_env_file @@ -116,7 +116,7 @@ jobs: - name: Build and install DPNP package run: | - python scripts/build_locally.py --onemkl-interfaces --verbose + python scripts/build_locally.py --onemath --verbose - name: Smoke test run: | @@ -148,7 +148,7 @@ jobs: SYCL_CACHE_PERSISTENT: 1 test_by_branch: - name: Run tests with oneMKL develop branch + name: Run tests with oneMath develop branch needs: build_env_file @@ -221,7 +221,7 @@ jobs: - name: Build and install DPNP package run: | - python scripts/build_locally.py --onemkl-interfaces --onemkl-interfaces-dir=${{ env.onemkl-source-dir }} --verbose + python scripts/build_locally.py --onemath --onemath-dir=${{ env.onemkl-source-dir }} --verbose - name: Smoke test run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index ad8714a54e0e..6e09bb89d49e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,9 +15,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Adjusted the `pre-commit` configuration to run autoupdate weekly [#2479](https://github.com/IntelPython/dpnp/pull/2479) * Improved validation of `--target-hip` build option to only accept a gfx-prefixed value [#2481](https://github.com/IntelPython/dpnp/pull/2481) * Simplifies backend implementation of `dpnp.kaiser` by getting rid of unnecessary template [#2472](https://github.com/IntelPython/dpnp/pull/2472) +* `--onemkl-interfaces` and `--onemkl-interfaces-dir` options for building script are deprecated, instead `--onemath` and `--onemath-dir` are introduced to be aligned with [oneMath specification](https://oneapi-spec.uxlfoundation.org/specifications/oneapi/latest/elements/onemath/source/) [#2487](https://github.com/IntelPython/dpnp/pull/2487) ### Deprecated +* `--onemkl-interfaces` and `--onemkl-interfaces-dir` options for building script are deprecated, instead `--onemath` and `--onemath-dir` are introduced to be aligned with [oneMath specification](https://oneapi-spec.uxlfoundation.org/specifications/oneapi/latest/elements/onemath/source/) [#2487](https://github.com/IntelPython/dpnp/pull/2487) + ### Removed * Cleaned up backend code to remove obsolete and unused parts of functionality [#2485](https://github.com/IntelPython/dpnp/pull/2485) @@ -26,7 +29,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Security - ## [0.18.1] - 2025-06-24 This release achieves `dpnp` compatibility with Python 3.13 and enables distributing `dpnp` packages with the latest Python version. diff --git a/CMakeLists.txt b/CMakeLists.txt index 43b4ba0bd67e..9e0a3183f936 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,8 +68,8 @@ find_package(Dpctl REQUIRED) message(STATUS "Dpctl_INCLUDE_DIR=" ${Dpctl_INCLUDE_DIR}) message(STATUS "Dpctl_TENSOR_INCLUDE_DIR=" ${Dpctl_TENSOR_INCLUDE_DIR}) -option(DPNP_USE_ONEMKL_INTERFACES - "Build DPNP with oneMKL Interfaces" +option(DPNP_USE_ONEMATH + "Build DPNP with oneMath" OFF ) set(DPNP_TARGET_CUDA @@ -82,9 +82,9 @@ or to a specific architecture like sm_80." set(HIP_TARGETS "" CACHE STRING "HIP architecture for target") set(_dpnp_sycl_targets) -set(_use_onemkl_interfaces OFF) -set(_use_onemkl_interfaces_cuda OFF) -set(_use_onemkl_interfaces_hip OFF) +set(_use_onemath OFF) +set(_use_onemath_cuda OFF) +set(_use_onemath_hip OFF) set(_dpnp_sycl_target_compile_options) set(_dpnp_sycl_target_link_options) @@ -103,7 +103,7 @@ if ("x${DPNP_SYCL_TARGETS}" STREQUAL "x") ) endif() set(_dpnp_sycl_targets "nvidia_gpu_${_dpnp_cuda_arch},spir64-unknown-unknown") - set(_use_onemkl_interfaces_cuda ON) + set(_use_onemath_cuda ON) endif() if (HIP_TARGETS) @@ -113,7 +113,7 @@ if ("x${DPNP_SYCL_TARGETS}" STREQUAL "x") else() set(_dpnp_sycl_targets "amd_gpu_${HIP_TARGETS},${_dpnp_sycl_targets}") endif() - set(_use_onemkl_interfaces_hip ON) + set(_use_onemath_hip ON) else() message(FATAL_ERROR "Invalid value for HIP_TARGETS: \"${HIP_TARGETS}\". " @@ -125,11 +125,11 @@ else() set(_dpnp_sycl_targets ${DPNP_SYCL_TARGETS}) if("${DPNP_SYCL_TARGETS}" MATCHES "(nvidia_gpu_sm_|nvptx64-nvidia-cuda)") - set(_use_onemkl_interfaces_cuda ON) + set(_use_onemath_cuda ON) endif() if ("${DPNP_SYCL_TARGETS}" MATCHES "amd_gpu_") - set(_use_onemkl_interfaces_hip ON) + set(_use_onemath_hip ON) if ("x${HIP_TARGETS}" STREQUAL "x") message(FATAL_ERROR "HIP_TARGETS must be specified when using HIP backend") @@ -150,35 +150,35 @@ if (_dpnp_sycl_targets) list(APPEND _dpnp_sycl_target_link_options -fsycl-targets=${_dpnp_sycl_targets}) endif() -if(DPNP_USE_ONEMKL_INTERFACES) - set(_use_onemkl_interfaces ON) +if(DPNP_USE_ONEMATH) + set(_use_onemath ON) else() - if(DEFINED ENV{DPNP_USE_ONEMKL_INTERFACES}) - set(_use_onemkl_interfaces ON) + if(DEFINED ENV{DPNP_USE_ONEMATH}) + set(_use_onemath ON) endif() endif() -if(_use_onemkl_interfaces) +if(_use_onemath) set(BUILD_FUNCTIONAL_TESTS False) set(BUILD_EXAMPLES False) set(ENABLE_MKLGPU_BACKEND True) set(ENABLE_MKLCPU_BACKEND True) - if(_use_onemkl_interfaces_cuda) + if(_use_onemath_cuda) set(ENABLE_CUBLAS_BACKEND True) set(ENABLE_CUSOLVER_BACKEND True) set(ENABLE_CUFFT_BACKEND True) # set(ENABLE_CURAND_BACKEND True) endif() - if(_use_onemkl_interfaces_hip) + if(_use_onemath_hip) set(ENABLE_ROCBLAS_BACKEND True) set(ENABLE_ROCSOLVER_BACKEND True) set(ENABLE_ROCFFT_BACKEND True) # set(ENABLE_ROCRAND_BACKEND True) endif() - if(DPNP_ONEMKL_INTERFACES_DIR) - FetchContent_Declare(onemath_library SOURCE_DIR "${DPNP_ONEMKL_INTERFACES_DIR}") + if(DPNP_ONEMATH_DIR) + FetchContent_Declare(onemath_library SOURCE_DIR "${DPNP_ONEMATH_DIR}") else() FetchContent_Declare( onemath_library @@ -189,19 +189,19 @@ if(_use_onemkl_interfaces) FetchContent_MakeAvailable(onemath_library) if(TARGET onemath) - set(MKL_INTERFACES_LIB "onemath" CACHE INTERNAL "OneMath lib target") + set(ONEMATH_LIB "onemath" CACHE INTERNAL "OneMath lib target") elseif(TARGET onemkl) - set(MKL_INTERFACES_LIB "onemkl" CACHE INTERNAL "OneMKL lib target") + set(ONEMATH_LIB "onemkl" CACHE INTERNAL "OneMKL lib target") else() message(FATAL_ERROR "Neither 'oneMath' nor 'oneMKL' found!") endif() - message(STATUS "MKL interfaces lib target used: ${MKL_INTERFACES_LIB}") + message(STATUS "OneMath lib target used: ${ONEMATH_LIB}") set(CMAKE_INSTALL_RPATH "${CMAKE_BINARY_DIR}/lib") else() - if(_use_onemkl_interfaces_cuda OR _use_onemkl_interfaces_hip) + if(_use_onemath_cuda OR _use_onemath_hip) message(FATAL_ERROR - "CUDA or HIP targets are enabled, but oneMKL Interfaces are not. " - "Please set DPNP_USE_ONEMKL_INTERFACES=ON to enable them." + "CUDA or HIP targets are enabled, but oneMath is not. " + "Please set DPNP_USE_ONEMATH=ON to enable them." ) endif() endif() diff --git a/dpnp/backend/extensions/blas/CMakeLists.txt b/dpnp/backend/extensions/blas/CMakeLists.txt index 3cca41032a5a..24b8457ffebc 100644 --- a/dpnp/backend/extensions/blas/CMakeLists.txt +++ b/dpnp/backend/extensions/blas/CMakeLists.txt @@ -83,11 +83,11 @@ if (DPNP_GENERATE_COVERAGE) target_link_options(${python_module_name} PRIVATE -fprofile-instr-generate -fcoverage-mapping) endif() -if(_use_onemkl_interfaces) - target_link_libraries(${python_module_name} PRIVATE ${MKL_INTERFACES_LIB}) - target_compile_options(${python_module_name} PRIVATE -DUSE_ONEMKL_INTERFACES) - if(_use_onemkl_interfaces_cuda) - target_compile_options(${python_module_name} PRIVATE -DUSE_ONEMKL_CUBLAS) +if(_ues_onemath) + target_link_libraries(${python_module_name} PRIVATE ${ONEMATH_LIB}) + target_compile_options(${python_module_name} PRIVATE -DUSE_ONEMATH) + if(_ues_onemath_cuda) + target_compile_options(${python_module_name} PRIVATE -DUSE_ONEMATH_CUBLAS) endif() else() target_link_libraries(${python_module_name} PUBLIC MKL::MKL_SYCL::BLAS) diff --git a/dpnp/backend/extensions/blas/blas_py.cpp b/dpnp/backend/extensions/blas/blas_py.cpp index 0321ff6fc6bd..3393315ffe19 100644 --- a/dpnp/backend/extensions/blas/blas_py.cpp +++ b/dpnp/backend/extensions/blas/blas_py.cpp @@ -143,14 +143,14 @@ PYBIND11_MODULE(_blas_impl, m) { m.def( - "_using_onemkl_interfaces", + "_using_onemath", []() { -#ifdef USE_ONEMKL_INTERFACES +#ifdef USE_ONEMATH return true; #else return false; #endif }, - "Check if the OneMKL interfaces are being used."); + "Check if OneMath is being used."); } } diff --git a/dpnp/backend/extensions/blas/gemm.cpp b/dpnp/backend/extensions/blas/gemm.cpp index 4d674010efd7..af18ab3002fb 100644 --- a/dpnp/backend/extensions/blas/gemm.cpp +++ b/dpnp/backend/extensions/blas/gemm.cpp @@ -55,9 +55,9 @@ typedef sycl::event (*gemm_impl_fn_ptr_t)(sycl::queue &, const std::int64_t, char *, const std::int64_t, -#if !defined(USE_ONEMKL_CUBLAS) +#if !defined(USE_ONEMATH_CUBLAS) const bool, -#endif // !USE_ONEMKL_CUBLAS +#endif // !USE_ONEMATH_CUBLAS const std::vector &); static gemm_impl_fn_ptr_t gemm_dispatch_table[dpctl_td_ns::num_types] @@ -76,9 +76,9 @@ static sycl::event gemm_impl(sycl::queue &exec_q, const std::int64_t ldb, char *resultC, const std::int64_t ldc, -#if !defined(USE_ONEMKL_CUBLAS) +#if !defined(USE_ONEMATH_CUBLAS) const bool is_row_major, -#endif // !USE_ONEMKL_CUBLAS +#endif // !USE_ONEMATH_CUBLAS const std::vector &depends) { type_utils::validate_type_for_device(exec_q); @@ -100,7 +100,7 @@ static sycl::event gemm_impl(sycl::queue &exec_q, const Tab *a, const std::int64_t lda, const Tab *b, const std::int64_t ldb, Tab beta, Tc *c, const std::int64_t ldc, const std::vector &deps) -> sycl::event { -#if defined(USE_ONEMKL_CUBLAS) +#if defined(USE_ONEMATH_CUBLAS) return mkl_blas::column_major::gemm(q, transA, transB, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc, deps); @@ -115,7 +115,7 @@ static sycl::event gemm_impl(sycl::queue &exec_q, alpha, a, lda, b, ldb, beta, c, ldc, deps); } -#endif // USE_ONEMKL_CUBLAS +#endif // USE_ONEMATH_CUBLAS }; gemm_event = gemm_func( exec_q, @@ -241,7 +241,7 @@ std::tuple std::int64_t ldb; // cuBLAS supports only column-major storage -#if defined(USE_ONEMKL_CUBLAS) +#if defined(USE_ONEMATH_CUBLAS) const bool is_row_major = false; transA = is_matrixA_c_contig ? oneapi::mkl::transpose::T @@ -291,7 +291,7 @@ std::tuple lda = m; ldb = k; } -#endif // USE_ONEMKL_CUBLAS +#endif // USE_ONEMATH_CUBLAS const std::int64_t ldc = is_row_major ? n : m; @@ -320,7 +320,7 @@ std::tuple const char *b_typeless_ptr = matrixB.get_data(); char *r_typeless_ptr = resultC.get_data(); -#if defined(USE_ONEMKL_CUBLAS) +#if defined(USE_ONEMATH_CUBLAS) sycl::event gemm_ev = gemm_fn(exec_q, transA, transB, m, n, k, a_typeless_ptr, lda, b_typeless_ptr, ldb, r_typeless_ptr, ldc, depends); @@ -328,7 +328,7 @@ std::tuple sycl::event gemm_ev = gemm_fn(exec_q, transA, transB, m, n, k, a_typeless_ptr, lda, b_typeless_ptr, ldb, r_typeless_ptr, ldc, is_row_major, depends); -#endif // USE_ONEMKL_CUBLAS +#endif // USE_ONEMATH_CUBLAS sycl::event args_ev = dpctl::utils::keep_args_alive( exec_q, {matrixA, matrixB, resultC}, {gemm_ev}); diff --git a/dpnp/backend/extensions/blas/gemm_batch.cpp b/dpnp/backend/extensions/blas/gemm_batch.cpp index d844457689ad..1e210aede9fa 100644 --- a/dpnp/backend/extensions/blas/gemm_batch.cpp +++ b/dpnp/backend/extensions/blas/gemm_batch.cpp @@ -60,9 +60,9 @@ typedef sycl::event (*gemm_batch_impl_fn_ptr_t)( const char *, const char *, char *, -#if !defined(USE_ONEMKL_CUBLAS) +#if !defined(USE_ONEMATH_CUBLAS) const bool, -#endif // !USE_ONEMKL_CUBLAS +#endif // !USE_ONEMATH_CUBLAS const std::vector &); static gemm_batch_impl_fn_ptr_t @@ -85,9 +85,9 @@ static sycl::event gemm_batch_impl(sycl::queue &exec_q, const char *matrixA, const char *matrixB, char *resultC, -#if !defined(USE_ONEMKL_CUBLAS) +#if !defined(USE_ONEMATH_CUBLAS) const bool is_row_major, -#endif // !USE_ONEMKL_CUBLAS +#endif // !USE_ONEMATH_CUBLAS const std::vector &depends) { type_utils::validate_type_for_device(exec_q); @@ -112,7 +112,7 @@ static sycl::event gemm_batch_impl(sycl::queue &exec_q, Tc *c, const std::int64_t ldc, const std::int64_t stridec, const std::int64_t batch_size, const std::vector &deps) -> sycl::event { -#if defined(USE_ONEMKL_CUBLAS) +#if defined(USE_ONEMATH_CUBLAS) return mkl_blas::column_major::gemm_batch( q, transA, transB, m, n, k, alpha, a, lda, stridea, b, ldb, strideb, beta, c, ldc, stridec, batch_size, deps); @@ -127,7 +127,7 @@ static sycl::event gemm_batch_impl(sycl::queue &exec_q, q, transA, transB, m, n, k, alpha, a, lda, stridea, b, ldb, strideb, beta, c, ldc, stridec, batch_size, deps); } -#endif // USE_ONEMKL_CUBLAS +#endif // USE_ONEMATH_CUBLAS }; gemm_batch_event = gemm_batch_func( exec_q, @@ -316,7 +316,7 @@ std::tuple std::int64_t ldb; // cuBLAS supports only column-major storage -#if defined(USE_ONEMKL_CUBLAS) +#if defined(USE_ONEMATH_CUBLAS) const bool is_row_major = false; transA = A_base_is_c_contig ? oneapi::mkl::transpose::T @@ -367,7 +367,7 @@ std::tuple lda = m; ldb = k; } -#endif // USE_ONEMKL_CUBLAS +#endif // USE_ONEMATH_CUBLAS const std::int64_t ldc = is_row_major ? n : m; @@ -396,7 +396,7 @@ std::tuple const char *b_typeless_ptr = matrixB.get_data(); char *r_typeless_ptr = resultC.get_data(); -#if defined(USE_ONEMKL_CUBLAS) +#if defined(USE_ONEMATH_CUBLAS) sycl::event gemm_batch_ev = gemm_batch_fn(exec_q, m, n, k, batch_size, lda, ldb, ldc, stridea, strideb, stridec, transA, transB, a_typeless_ptr, @@ -406,7 +406,7 @@ std::tuple gemm_batch_fn(exec_q, m, n, k, batch_size, lda, ldb, ldc, stridea, strideb, stridec, transA, transB, a_typeless_ptr, b_typeless_ptr, r_typeless_ptr, is_row_major, depends); -#endif // USE_ONEMKL_CUBLAS +#endif // USE_ONEMATH_CUBLAS sycl::event args_ev = dpctl::utils::keep_args_alive( exec_q, {matrixA, matrixB, resultC}, {gemm_batch_ev}); diff --git a/dpnp/backend/extensions/blas/gemv.cpp b/dpnp/backend/extensions/blas/gemv.cpp index 87730fbec9a8..91057893aa5f 100644 --- a/dpnp/backend/extensions/blas/gemv.cpp +++ b/dpnp/backend/extensions/blas/gemv.cpp @@ -53,9 +53,9 @@ typedef sycl::event (*gemv_impl_fn_ptr_t)(sycl::queue &, const std::int64_t, char *, const std::int64_t, -#if !defined(USE_ONEMKL_CUBLAS) +#if !defined(USE_ONEMATH_CUBLAS) const bool, -#endif // !USE_ONEMKL_CUBLAS +#endif // !USE_ONEMATH_CUBLAS const std::vector &); static gemv_impl_fn_ptr_t gemv_dispatch_vector[dpctl_td_ns::num_types]; @@ -71,9 +71,9 @@ static sycl::event gemv_impl(sycl::queue &exec_q, const std::int64_t incx, char *vectorY, const std::int64_t incy, -#if !defined(USE_ONEMKL_CUBLAS) +#if !defined(USE_ONEMATH_CUBLAS) const bool is_row_major, -#endif // !USE_ONEMKL_CUBLAS +#endif // !USE_ONEMATH_CUBLAS const std::vector &depends) { type_utils::validate_type_for_device(exec_q); @@ -93,7 +93,7 @@ static sycl::event gemv_impl(sycl::queue &exec_q, const std::int64_t lda, const T *x, const std::int64_t incx, T beta, T *y, const std::int64_t incy, const std::vector &deps) -> sycl::event { -#if defined(USE_ONEMKL_CUBLAS) +#if defined(USE_ONEMATH_CUBLAS) return mkl_blas::column_major::gemv(q, transA, m, n, alpha, a, lda, x, incx, beta, y, incy, deps); #else @@ -106,7 +106,7 @@ static sycl::event gemv_impl(sycl::queue &exec_q, lda, x, incx, beta, y, incy, deps); } -#endif // USE_ONEMKL_CUBLAS +#endif // USE_ONEMATH_CUBLAS }; gemv_event = gemv_func( exec_q, @@ -195,7 +195,7 @@ std::pair std::size_t src_nelems; // cuBLAS supports only column-major storage -#if defined(USE_ONEMKL_CUBLAS) +#if defined(USE_ONEMATH_CUBLAS) const bool is_row_major = false; std::int64_t m; std::int64_t n; @@ -241,7 +241,7 @@ std::pair transA = oneapi::mkl::transpose::N; src_nelems = m; } -#endif // USE_ONEMKL_CUBLAS +#endif // USE_ONEMATH_CUBLAS if (transpose) { if (a_shape[0] != x_shape[0]) { @@ -304,7 +304,7 @@ std::pair y_typeless_ptr -= (y_shape[0] - 1) * std::abs(incy) * y_elemsize; } -#if defined(USE_ONEMKL_CUBLAS) +#if defined(USE_ONEMATH_CUBLAS) sycl::event gemv_ev = gemv_fn(exec_q, transA, m, n, a_typeless_ptr, lda, x_typeless_ptr, incx, y_typeless_ptr, incy, depends); @@ -312,7 +312,7 @@ std::pair sycl::event gemv_ev = gemv_fn(exec_q, transA, m, n, a_typeless_ptr, lda, x_typeless_ptr, incx, y_typeless_ptr, incy, is_row_major, depends); -#endif // USE_ONEMKL_CUBLAS +#endif // USE_ONEMATH_CUBLAS sycl::event args_ev = dpctl::utils::keep_args_alive( exec_q, {matrixA, vectorX, vectorY}, {gemv_ev}); diff --git a/dpnp/backend/extensions/blas/types_matrix.hpp b/dpnp/backend/extensions/blas/types_matrix.hpp index 22fc98f05137..7590364737bf 100644 --- a/dpnp/backend/extensions/blas/types_matrix.hpp +++ b/dpnp/backend/extensions/blas/types_matrix.hpp @@ -110,10 +110,10 @@ template struct GemmTypePairSupportFactory { static constexpr bool is_defined = std::disjunction< -#if !defined(USE_ONEMKL_INTERFACES) +#if !defined(USE_ONEMATH) dpctl_td_ns::TypePairDefinedEntry, dpctl_td_ns::TypePairDefinedEntry, -#endif // USE_ONEMKL_INTERFACES +#endif // USE_ONEMATH dpctl_td_ns::TypePairDefinedEntry, dpctl_td_ns::TypePairDefinedEntry, dpctl_td_ns::TypePairDefinedEntry, @@ -142,10 +142,10 @@ template struct GemmBatchTypePairSupportFactory { static constexpr bool is_defined = std::disjunction< -#if !defined(USE_ONEMKL_INTERFACES) +#if !defined(USE_ONEMATH) dpctl_td_ns::TypePairDefinedEntry, dpctl_td_ns::TypePairDefinedEntry, -#endif // USE_ONEMKL_INTERFACES +#endif // USE_ONEMATH dpctl_td_ns::TypePairDefinedEntry, dpctl_td_ns::TypePairDefinedEntry, dpctl_td_ns::TypePairDefinedEntry, diff --git a/dpnp/backend/extensions/fft/CMakeLists.txt b/dpnp/backend/extensions/fft/CMakeLists.txt index dbca2191eb31..b613d5cfdb48 100644 --- a/dpnp/backend/extensions/fft/CMakeLists.txt +++ b/dpnp/backend/extensions/fft/CMakeLists.txt @@ -80,9 +80,9 @@ if (DPNP_GENERATE_COVERAGE) target_link_options(${python_module_name} PRIVATE -fprofile-instr-generate -fcoverage-mapping) endif() -if(_use_onemkl_interfaces) - target_link_libraries(${python_module_name} PRIVATE ${MKL_INTERFACES_LIB}) - target_compile_options(${python_module_name} PRIVATE -DUSE_ONEMKL_INTERFACES) +if(_use_onemath) + target_link_libraries(${python_module_name} PRIVATE ${ONEMATH_LIB}) + target_compile_options(${python_module_name} PRIVATE -DUSE_ONEMATH) else() target_link_libraries(${python_module_name} PUBLIC MKL::MKL_SYCL::DFT) endif() diff --git a/dpnp/backend/extensions/fft/common.hpp b/dpnp/backend/extensions/fft/common.hpp index bf8a3d7a6ae0..fbe384fed874 100644 --- a/dpnp/backend/extensions/fft/common.hpp +++ b/dpnp/backend/extensions/fft/common.hpp @@ -205,7 +205,7 @@ class DescriptorWrapper // config_param::PLACEMENT bool get_in_place() { -#if defined(USE_ONEMKL_INTERFACES) || INTEL_MKL_VERSION >= 20250000 +#if defined(USE_ONEMATH) || INTEL_MKL_VERSION >= 20250000 mkl_dft::config_value placement; descr_.get_value(mkl_dft::config_param::PLACEMENT, &placement); return (placement == mkl_dft::config_value::INPLACE); @@ -214,12 +214,12 @@ class DescriptorWrapper DFTI_CONFIG_VALUE placement; descr_.get_value(mkl_dft::config_param::PLACEMENT, &placement); return (placement == DFTI_CONFIG_VALUE::DFTI_INPLACE); -#endif // USE_ONEMKL_INTERFACES or INTEL_MKL_VERSION +#endif // USE_ONEMATH or INTEL_MKL_VERSION } void set_in_place(const bool &in_place_request) { -#if defined(USE_ONEMKL_INTERFACES) || INTEL_MKL_VERSION >= 20250000 +#if defined(USE_ONEMATH) || INTEL_MKL_VERSION >= 20250000 descr_.set_value(mkl_dft::config_param::PLACEMENT, (in_place_request) ? mkl_dft::config_value::INPLACE @@ -230,7 +230,7 @@ class DescriptorWrapper (in_place_request) ? DFTI_CONFIG_VALUE::DFTI_INPLACE : DFTI_CONFIG_VALUE::DFTI_NOT_INPLACE); -#endif // USE_ONEMKL_INTERFACES or INTEL_MKL_VERSION +#endif // USE_ONEMATH or INTEL_MKL_VERSION } // config_param::PRECISION @@ -245,7 +245,7 @@ class DescriptorWrapper // config_param::COMMIT_STATUS bool is_committed() { -#if defined(USE_ONEMKL_INTERFACES) || INTEL_MKL_VERSION >= 20250000 +#if defined(USE_ONEMATH) || INTEL_MKL_VERSION >= 20250000 mkl_dft::config_value committed; descr_.get_value(mkl_dft::config_param::COMMIT_STATUS, &committed); return (committed == mkl_dft::config_value::COMMITTED); @@ -254,7 +254,7 @@ class DescriptorWrapper DFTI_CONFIG_VALUE committed; descr_.get_value(mkl_dft::config_param::COMMIT_STATUS, &committed); return (committed == DFTI_CONFIG_VALUE::DFTI_COMMITTED); -#endif // USE_ONEMKL_INTERFACES or INTEL_MKL_VERSION +#endif // USE_ONEMATH or INTEL_MKL_VERSION } private: diff --git a/dpnp/backend/extensions/lapack/CMakeLists.txt b/dpnp/backend/extensions/lapack/CMakeLists.txt index ccc680a1f445..1f35ee4d47c1 100644 --- a/dpnp/backend/extensions/lapack/CMakeLists.txt +++ b/dpnp/backend/extensions/lapack/CMakeLists.txt @@ -100,9 +100,9 @@ if (DPNP_GENERATE_COVERAGE) target_link_options(${python_module_name} PRIVATE -fprofile-instr-generate -fcoverage-mapping) endif() -if(_use_onemkl_interfaces) - target_link_libraries(${python_module_name} PRIVATE ${MKL_INTERFACES_LIB}) - target_compile_options(${python_module_name} PRIVATE -DUSE_ONEMKL_INTERFACES) +if(_use_onemath) + target_link_libraries(${python_module_name} PRIVATE ${ONEMATH_LIB}) + target_compile_options(${python_module_name} PRIVATE -DUSE_ONEMATH) else() target_link_libraries(${python_module_name} PUBLIC MKL::MKL_SYCL::LAPACK) endif() diff --git a/dpnp/backend/extensions/lapack/gesv.cpp b/dpnp/backend/extensions/lapack/gesv.cpp index 30cf9b97304e..7697316d02e9 100644 --- a/dpnp/backend/extensions/lapack/gesv.cpp +++ b/dpnp/backend/extensions/lapack/gesv.cpp @@ -76,7 +76,7 @@ static sycl::event gesv_impl(sycl::queue &exec_q, std::stringstream error_msg; bool is_exception_caught = false; -#if defined(USE_ONEMKL_INTERFACES) +#if defined(USE_ONEMATH) // Use transpose::T if the LU-factorized array is passed as C-contiguous. // For F-contiguous we use transpose::N. // Since gesv takes F-contiguous as input, we use transpose::N. @@ -90,7 +90,7 @@ static sycl::event gesv_impl(sycl::queue &exec_q, scratchpad_size = mkl_lapack::gesv_scratchpad_size(exec_q, n, nrhs, lda, ldb); -#endif // USE_ONEMKL_INTERFACES +#endif // USE_ONEMATH T *scratchpad = helper::alloc_scratchpad(scratchpad_size, exec_q); @@ -102,7 +102,7 @@ static sycl::event gesv_impl(sycl::queue &exec_q, throw; } -#if defined(USE_ONEMKL_INTERFACES) +#if defined(USE_ONEMATH) sycl::event getrf_event; try { getrf_event = mkl_lapack::getrf( @@ -146,7 +146,7 @@ static sycl::event gesv_impl(sycl::queue &exec_q, scratchpad, ipiv, e, error_msg); } catch (oneapi::mkl::computation_error const &e) { // TODO: remove this catch when gh-642(oneMath) is fixed - // Workaround for oneMath interfaces + // Workaround for oneMath // oneapi::mkl::computation_error is thrown instead of // oneapi::mkl::lapack::computation_error. if (scratchpad != nullptr) @@ -188,7 +188,7 @@ static sycl::event gesv_impl(sycl::queue &exec_q, error_msg << "Unexpected SYCL exception caught during gesv() call:\n" << e.what(); } -#endif // USE_ONEMKL_INTERFACES +#endif // USE_ONEMATH if (is_exception_caught) // an unexpected error occurs { diff --git a/dpnp/backend/extensions/lapack/gesv_batch.cpp b/dpnp/backend/extensions/lapack/gesv_batch.cpp index 199d75874dc1..dd9368d7132d 100644 --- a/dpnp/backend/extensions/lapack/gesv_batch.cpp +++ b/dpnp/backend/extensions/lapack/gesv_batch.cpp @@ -49,10 +49,10 @@ typedef sycl::event (*gesv_batch_impl_fn_ptr_t)( const std::int64_t, const std::int64_t, const std::int64_t, -#if defined(USE_ONEMKL_INTERFACES) +#if defined(USE_ONEMATH) const std::int64_t, const std::int64_t, -#endif // USE_ONEMKL_INTERFACES +#endif // USE_ONEMATH char *, char *, const std::vector &); @@ -65,10 +65,10 @@ static sycl::event gesv_batch_impl(sycl::queue &exec_q, const std::int64_t n, const std::int64_t nrhs, const std::int64_t batch_size, -#if defined(USE_ONEMKL_INTERFACES) +#if defined(USE_ONEMATH) const std::int64_t stride_a, const std::int64_t stride_b, -#endif // USE_ONEMKL_INTERFACES +#endif // USE_ONEMATH char *in_a, char *in_b, const std::vector &depends) @@ -89,7 +89,7 @@ static sycl::event gesv_batch_impl(sycl::queue &exec_q, std::stringstream error_msg; bool is_exception_caught = false; -#if defined(USE_ONEMKL_INTERFACES) +#if defined(USE_ONEMATH) // Use transpose::T if the LU-factorized array is passed as C-contiguous. // For F-contiguous we use transpose::N. // Since gesv_batch takes F-contiguous as input, we use transpose::N. @@ -281,7 +281,7 @@ static sycl::event gesv_batch_impl(sycl::queue &exec_q, // Update the event dependencies for the current stream comp_evs[stream_id] = {gesv_event}; } -#endif // USE_ONEMKL_INTERFACES +#endif // USE_ONEMATH if (is_exception_caught) // an unexpected error occurs { @@ -293,13 +293,13 @@ static sycl::event gesv_batch_impl(sycl::queue &exec_q, } sycl::event ht_ev = exec_q.submit([&](sycl::handler &cgh) { -#if defined(USE_ONEMKL_INTERFACES) +#if defined(USE_ONEMATH) cgh.depends_on(comp_event); #else for (const auto &ev : comp_evs) { cgh.depends_on(ev); } -#endif // USE_ONEMKL_INTERFACES +#endif // USE_ONEMATH auto ctx = exec_q.get_context(); cgh.host_task([ctx, scratchpad, ipiv]() { sycl_free_noexcept(scratchpad, ctx); @@ -383,7 +383,7 @@ std::pair sycl::event gesv_ev; -#if defined(USE_ONEMKL_INTERFACES) +#if defined(USE_ONEMATH) auto const &coeff_matrix_strides = coeff_matrix.get_strides_vector(); auto const &dependent_vals_strides = dependent_vals.get_strides_vector(); @@ -401,7 +401,7 @@ std::pair #else gesv_ev = gesv_batch_fn(exec_q, n, nrhs, batch_size, coeff_matrix_data, dependent_vals_data, depends); -#endif // USE_ONEMKL_INTERFACES +#endif // USE_ONEMATH sycl::event ht_ev = dpctl::utils::keep_args_alive( exec_q, {coeff_matrix, dependent_vals}, {gesv_ev}); diff --git a/dpnp/backend/extensions/lapack/getrf.cpp b/dpnp/backend/extensions/lapack/getrf.cpp index 204d682984ef..5ba1a7cc9b65 100644 --- a/dpnp/backend/extensions/lapack/getrf.cpp +++ b/dpnp/backend/extensions/lapack/getrf.cpp @@ -122,7 +122,7 @@ static sycl::event getrf_impl(sycl::queue &exec_q, } } catch (oneapi::mkl::computation_error const &e) { // TODO: remove this catch when gh-642(oneMath) is fixed - // Workaround for oneMath interfaces + // Workaround for oneMath // oneapi::mkl::computation_error is thrown instead of // oneapi::mkl::lapack::computation_error. is_exception_caught = false; diff --git a/dpnp/backend/extensions/vm/CMakeLists.txt b/dpnp/backend/extensions/vm/CMakeLists.txt index 9ad513ccbff6..a2b7297e72b5 100644 --- a/dpnp/backend/extensions/vm/CMakeLists.txt +++ b/dpnp/backend/extensions/vm/CMakeLists.txt @@ -23,7 +23,7 @@ # THE POSSIBILITY OF SUCH DAMAGE. # ***************************************************************************** -if(NOT _use_onemkl_interfaces) +if(NOT _use_onemath) set(_elementwise_sources ${CMAKE_CURRENT_SOURCE_DIR}/abs.cpp ${CMAKE_CURRENT_SOURCE_DIR}/acos.cpp @@ -118,8 +118,8 @@ if (DPNP_GENERATE_COVERAGE) target_link_options(${python_module_name} PRIVATE -fprofile-instr-generate -fcoverage-mapping) endif() -if(_use_onemkl_interfaces) - target_compile_options(${python_module_name} PRIVATE -DUSE_ONEMKL_INTERFACES) +if(_use_onemath) + target_compile_options(${python_module_name} PRIVATE -DUSE_ONEMATH) else() target_link_libraries(${python_module_name} PUBLIC MKL::MKL_SYCL::VM) endif() diff --git a/dpnp/backend/extensions/vm/vm_py.cpp b/dpnp/backend/extensions/vm/vm_py.cpp index ad52e499419b..ab2734794bdc 100644 --- a/dpnp/backend/extensions/vm/vm_py.cpp +++ b/dpnp/backend/extensions/vm/vm_py.cpp @@ -27,7 +27,7 @@ // //***************************************************************************** -#if not defined(USE_ONEMKL_INTERFACES) +#if not defined(USE_ONEMATH) #include "abs.hpp" #include "acos.hpp" #include "acosh.hpp" @@ -73,13 +73,13 @@ #include "trunc.hpp" namespace vm_ns = dpnp::extensions::vm; -#endif // USE_ONEMKL_INTERFACES +#endif // USE_ONEMATH #include PYBIND11_MODULE(_vm_impl, m) { -#if not defined(USE_ONEMKL_INTERFACES) +#if not defined(USE_ONEMATH) vm_ns::init_abs(m); vm_ns::init_acos(m); vm_ns::init_acosh(m); @@ -123,15 +123,15 @@ PYBIND11_MODULE(_vm_impl, m) vm_ns::init_tan(m); vm_ns::init_tanh(m); vm_ns::init_trunc(m); -#endif // USE_ONEMKL_INTERFACES +#endif // USE_ONEMATH m.def( "_is_available", [](void) { -#if defined(USE_ONEMKL_INTERFACES) +#if defined(USE_ONEMATH) return false; #else return true; -#endif // USE_ONEMKL_INTERFACES +#endif // USE_ONEMATH }, "Check if the OneMKL VM library can be used."); } diff --git a/dpnp/dpnp_utils/dpnp_utils_linearalgebra.py b/dpnp/dpnp_utils/dpnp_utils_linearalgebra.py index 60a4375843fb..c80332ea8ebd 100644 --- a/dpnp/dpnp_utils/dpnp_utils_linearalgebra.py +++ b/dpnp/dpnp_utils/dpnp_utils_linearalgebra.py @@ -342,10 +342,10 @@ def _gemm_special_case(x1, x2, res_dtype, call_flag): is_int32_or_f32 = res_dtype in [dpnp.int32, dpnp.float32] flag = is_int8 and is_int32_or_f32 and call_flag in ["gemm", "gemm_batch"] - # onemkl_interfaces does not support these data types - onemkl_interfaces = bi._using_onemkl_interfaces() + # onemath does not support these data types + onemath = bi._using_onemath() - return flag and not onemkl_interfaces + return flag and not onemath def _get_result_shape(x1, x2, out, func, _get_result_shape_fn, np_flag): diff --git a/scripts/build_locally.py b/scripts/build_locally.py index 3902e4eb4733..fd3c94a28a62 100644 --- a/scripts/build_locally.py +++ b/scripts/build_locally.py @@ -27,6 +27,9 @@ import os import subprocess import sys +import warnings + +warnings.simplefilter("default", DeprecationWarning) def run( @@ -42,6 +45,8 @@ def run( target_hip=None, onemkl_interfaces=False, onemkl_interfaces_dir=None, + onemath=False, + onemath_dir=None, ): build_system = None @@ -98,6 +103,23 @@ def run( if "DPL_ROOT" in os.environ: os.environ["DPL_ROOT_HINT"] = os.environ["DPL_ROOT"] + # TODO: onemkl_interfaces and onemkl_interfaces_dir are deprecated in + # dpnp-0.19.0 and should be removed in dpnp-0.20.0. + if onemkl_interfaces: + warnings.warn( + "Using 'onemkl_interfaces' is deprecated. Please use 'onemath' instead.", + DeprecationWarning, + stacklevel=1, + ) + onemath = True + if onemkl_interfaces_dir is not None: + warnings.warn( + "Using 'onemkl_interfaces_dir' is deprecated. Please use 'onemath_dir' instead.", + DeprecationWarning, + stacklevel=1, + ) + onemath_dir = onemkl_interfaces_dir + if target_cuda is not None: if not target_cuda.strip(): raise ValueError( @@ -107,8 +129,8 @@ def run( cmake_args += [ f"-DDPNP_TARGET_CUDA={target_cuda}", ] - # Always builds using oneMKL interfaces for the cuda target - onemkl_interfaces = True + # Always builds using oneMath for the cuda target + onemath = True if target_hip is not None: if not target_hip.strip(): @@ -118,20 +140,20 @@ def run( cmake_args += [ f"-DHIP_TARGETS={target_hip}", ] - # Always builds using oneMKL interfaces for the hip target - onemkl_interfaces = True + # Always builds using oneMath for the hip target + onemath = True - if onemkl_interfaces: + if onemath: cmake_args += [ - "-DDPNP_USE_ONEMKL_INTERFACES=ON", + "-DDPNP_USE_ONEMATH=ON", ] - if onemkl_interfaces_dir: + if onemath_dir: cmake_args += [ - f"-DDPNP_ONEMKL_INTERFACES_DIR={onemkl_interfaces_dir}", + f"-DDPNP_ONEMATH_DIR={onemath_dir}", ] - elif onemkl_interfaces_dir: - raise RuntimeError("--onemkl-interfaces-dir option is not supported") + elif onemath_dir: + raise RuntimeError("--onemath-dir option is not supported") subprocess.check_call( cmake_args, shell=False, cwd=setup_dir, env=os.environ @@ -204,18 +226,31 @@ def run( type=str, ) driver.add_argument( - "--onemkl-interfaces", - help="Build using oneMKL Interfaces", + "--onemkl_interfaces", + help="(DEPRECATED) Build using oneMath", dest="onemkl_interfaces", action="store_true", ) driver.add_argument( - "--onemkl-interfaces-dir", - help="Local directory with source of oneMKL Interfaces", + "--onemkl_interfaces_dir", + help="(DEPRECATED) Local directory with source of oneMath", dest="onemkl_interfaces_dir", default=None, type=str, ) + driver.add_argument( + "--onemath", + help="Build using oneMath", + dest="onemath", + action="store_true", + ) + driver.add_argument( + "--onemath-dir", + help="Local directory with source of oneMath", + dest="onemath_dir", + default=None, + type=str, + ) args = parser.parse_args() args_to_validate = [ @@ -273,4 +308,6 @@ def run( target_hip=args.target_hip, onemkl_interfaces=args.onemkl_interfaces, onemkl_interfaces_dir=args.onemkl_interfaces_dir, + onemath=args.onemath, + onemath_dir=args.onemath_dir, )