Skip to content

Merge 0.13.0rc2 into gold/2021 #1569

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 36 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
ffeb0ae
utilize new functionality of dpctl for in-place operators
vtavana Aug 21, 2023
aac66a6
address comments
vtavana Aug 22, 2023
2b1173b
Do not build dpnp for Python 3.8
antonwolfy Aug 23, 2023
2a07141
add test_coerced_usm_types_floor_divide
vtavana Aug 22, 2023
57e7359
Leverage `dpctl.tensor.expand_dims()/swapaxes()` implementation (#1532)
vlad-perevezentsev Aug 23, 2023
6c00c20
Merge branch 'master' into dpnp_use_inplace_dpctl
vtavana Aug 23, 2023
44fddf7
Merge pull request #1530 from IntelPython/dpnp_use_inplace_dpctl
vtavana Aug 23, 2023
edf7990
Merge branch 'master' into drop_build_py_38
antonwolfy Aug 24, 2023
3a8ba50
Merge pull request #1534 from IntelPython/drop_build_py_38
antonwolfy Aug 24, 2023
385f9d7
use dpctl.tensor.round functions in dpnp
vtavana Aug 10, 2023
acebaea
modify related tests to work without float64 support
vtavana Aug 23, 2023
004ac9c
add see also section
vtavana Aug 24, 2023
139d194
change numpy to Numpy
vtavana Aug 24, 2023
a4cab86
modify skip test msg
vtavana Aug 24, 2023
1595ab7
Merge pull request #1520 from IntelPython/use_dpctl_round_func
vtavana Aug 24, 2023
a78ae52
implement dpnp.rint (#1537)
vtavana Aug 25, 2023
7cb1fd7
implement dpnp.signbit and dpnp.proj (#1535)
vtavana Aug 27, 2023
ec46177
Conversion from raw to multi_ptr should be done with address_space_ca…
antonwolfy Aug 27, 2023
ff71682
Leverage dpctl.tensor.copy() implementation (#1540)
antonwolfy Aug 28, 2023
5a2913f
Resolve logically dead code from Coverity report (#1541)
antonwolfy Aug 28, 2023
0fd57d4
Implement dpnp.allclose() for a device without fp64 aspect (#1536)
antonwolfy Aug 28, 2023
b694d87
Added flipping functions (#1543)
antonwolfy Aug 28, 2023
fa3cd55
Update dpnp.power using dpctl and OneMKL implementations (#1476)
vlad-perevezentsev Aug 29, 2023
09f7085
Add dpnp.roll implementation and update dpnp.rollaxis/dpnp.moveaxis (…
vlad-perevezentsev Aug 29, 2023
89fd914
Temporary mute tests for dpnp.sum (#1550)
antonwolfy Sep 6, 2023
7cb3949
Get rid of fallback on numpy in dpnp.asfarray (#1542)
npolina4 Sep 6, 2023
80eb738
Implemented dpnp.hstack() and dpnp.atleast_1d() functions. (#1544)
npolina4 Sep 6, 2023
239cca7
Unmuted tests for dpnp.sum (#1552)
antonwolfy Sep 7, 2023
b5764e2
Updated tests to run on Iris Xe. (#1548)
npolina4 Sep 8, 2023
4df273c
use dpctl for trigonometric functions in dpnp (#1545)
vtavana Sep 8, 2023
e4643cb
Leverage `dpctl.tensor.put()` implementation (#1529)
vlad-perevezentsev Sep 11, 2023
51057ba
Stated missing packages required to build dpnp from source (#1553)
antonwolfy Sep 12, 2023
4813810
Update change log due to 2024.0 release (#1555)
antonwolfy Sep 12, 2023
6ada5a7
Refactor MKL and oneDPL find package and add MKL_VERSION_2024 variabl…
vlad-perevezentsev Sep 22, 2023
9746426
Workaround to dpnp.allclose() (#1568)
vlad-perevezentsev Sep 22, 2023
1bcc10a
Merge 'master' into merge_to_gold_rc2
vlad-perevezentsev Sep 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .github/workflows/conda-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ env:
test_arraycreation.py
test_dot.py
test_dparray.py
test_copy.py
test_fft.py
test_linalg.py
test_logic.py
Expand All @@ -23,12 +24,16 @@ env:
test_random_state.py
test_sort.py
test_special.py
test_sycl_queue.py
test_umath.py
test_usm_type.py
third_party/cupy/linalg_tests/test_product.py
third_party/cupy/logic_tests/test_comparison.py
third_party/cupy/logic_tests/test_truth.py
third_party/cupy/manipulation_tests/test_basic.py
third_party/cupy/manipulation_tests/test_join.py
third_party/cupy/manipulation_tests/test_rearrange.py
third_party/cupy/manipulation_tests/test_transpose.py
third_party/cupy/math_tests/test_explog.py
third_party/cupy/math_tests/test_misc.py
third_party/cupy/math_tests/test_trigonometric.py
Expand All @@ -43,7 +48,7 @@ jobs:

strategy:
matrix:
python: ['3.8', '3.9', '3.10', '3.11']
python: ['3.9', '3.10', '3.11']
os: [ubuntu-20.04, windows-latest]

runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -120,7 +125,7 @@ jobs:

strategy:
matrix:
python: ['3.8', '3.9', '3.10', '3.11']
python: ['3.9', '3.10', '3.11']
os: [ubuntu-20.04, ubuntu-latest]

continue-on-error: true
Expand Down Expand Up @@ -221,7 +226,7 @@ jobs:

strategy:
matrix:
python: ['3.8', '3.9', '3.10', '3.11']
python: ['3.9', '3.10', '3.11']

continue-on-error: true

Expand Down Expand Up @@ -353,7 +358,7 @@ jobs:

strategy:
matrix:
python: ['3.8', '3.9', '3.10', '3.11']
python: ['3.9', '3.10', '3.11']
os: [ubuntu-20.04, windows-latest]

runs-on: ${{ matrix.os }}
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/generate_coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ jobs:
conda list
- name: Build dpnp with coverage
run: |
python scripts/gen_coverage.py --pytest-opts="--ignore tests/test_random.py \
--ignore tests/test_strides.py"
python scripts/gen_coverage.py --pytest-opts="--ignore tests/test_random.py"
- name: Install coverall dependencies
run: |
sudo gem install coveralls-lcov
Expand Down
58 changes: 55 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,66 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.12.2] - TBA
## [0.13.0] - TBA

### Added

* Added implementation of flipping functions: `dpnp.flip`, `dpnp.fliplr` and `dpnp.flipud` [#1543](https://github.com/IntelPython/dpnp/pull/1543)
* Added implementation of `dpnp.rint` function through `dpnp.round` call [#1537](https://github.com/IntelPython/dpnp/pull/1537)
* Added in-place support for arithmetic operators [#1530](https://github.com/IntelPython/dpnp/pull/1530)
* Dropped build and uploading the package with `python=3.8` to `dppy/label/dev` channel of Anaconda [#1534](https://github.com/IntelPython/dpnp/pull/1534)
* Implemented build and uploading the package with `python=3.11` to `dppy/label/dev` channel of Anaconda [#1501](https://github.com/IntelPython/dpnp/pull/1501)
* Added the versioneer to compute a product version number [#1497](https://github.com/IntelPython/dpnp/pull/1497)
* Added `cython` support of `3.0.0` or above version [#1495](https://github.com/IntelPython/dpnp/pull/1495)

### Changed

* Updated `Build from source` section in `README.md` to state all the required prerequisite packages [#1553](https://github.com/IntelPython/dpnp/pull/1553)
* Reworked `dpnp.hstack` and `dpnp.atleast_1d` through existing functions to get rid of falling back on NumPy [#1544](https://github.com/IntelPython/dpnp/pull/1544)
* Reworked `dpnp.asfarray` through existing functions to get rid of falling back on NumPy [#1542](https://github.com/IntelPython/dpnp/pull/1542)
* Converted from `raw` to `multi_ptr` with `address_space_cast` to adopt towards changes introduced in `SYCL 2020` [#1538](https://github.com/IntelPython/dpnp/pull/1538)
* Updated install instruction via `pip` [#1531](https://github.com/IntelPython/dpnp/pull/1531)
* Reworked `dpnp.copyto` through existing functions instead of a separate kernel [#1516](https://github.com/IntelPython/dpnp/pull/1516)
* Aligned default order value with NumPy in asarray-like functions [#1526](https://github.com/IntelPython/dpnp/pull/1526)
* Created unary and binary elementwise functions at module import [#1522](https://github.com/IntelPython/dpnp/pull/1522)
* Redesigned trigonometric and hyperbolic functions through pybind11 extension of OneMKL calls where possible or leveraging on `dpctl.tensor` implementation [#1545](https://github.com/IntelPython/dpnp/pull/1545)
* Added `dpnp.signbit` and `dpnp.proj` functions implemented through pybind11 extension of OneMKL calls where possible or leveraging on `dpctl.tensor` implementation [#1535](https://github.com/IntelPython/dpnp/pull/1535)
* Redesigned `dpnp.round` and `dpnp.around` functions through pybind11 extension of OneMKL calls where possible or leveraging on `dpctl.tensor` implementation [#1520](https://github.com/IntelPython/dpnp/pull/1520)
* Redesigned `dpnp.sign` and `dpnp.negative` functions through pybind11 extension of OneMKL calls where possible or leveraging on `dpctl.tensor` implementation [#1523](https://github.com/IntelPython/dpnp/pull/1523)
* Redesigned `dpnp.conjugate` and `dpnp.conj` functions through pybind11 extension of OneMKL calls where possible or leveraging on `dpctl.tensor` implementation [#1519](https://github.com/IntelPython/dpnp/pull/1519)
* Redesigned `dpnp.ceil`, `dpnp.floor` and `dpnp.trunc` functions through pybind11 extension of OneMKL calls where possible or leveraging on `dpctl.tensor` implementation [#1518](https://github.com/IntelPython/dpnp/pull/1518)
* Redesigned `dpnp.remainder` and `dpnp.mod` functions through pybind11 extension of OneMKL calls where possible or leveraging on `dpctl.tensor` implementation [#1515](https://github.com/IntelPython/dpnp/pull/1515)
* Redesigned `dpnp.power` function through pybind11 extension of OneMKL calls where possible or leveraging on `dpctl.tensor` implementation [#1476](https://github.com/IntelPython/dpnp/pull/1476)
* Leveraged `dpctl.tensor` implementation for `dpnp.put` function [#1529](https://github.com/IntelPython/dpnp/pull/1529)
* Leveraged `dpctl.tensor` implementation for `dpnp.roll` and `dpnp.rollaxis` functions [#1517](https://github.com/IntelPython/dpnp/pull/1517)
* Leveraged `dpctl.tensor` implementation for `dpnp.copy` function [#1540](https://github.com/IntelPython/dpnp/pull/1540)
* Leveraged `dpctl.tensor` implementation for `dpnp.expand_dims` and `dpnp.swapaxes` functions [#1532](https://github.com/IntelPython/dpnp/pull/1532)
* Leveraged `dpctl.tensor` implementation for bitwise operations [#1508](https://github.com/IntelPython/dpnp/pull/1508)
* Leveraged `dpctl.tensor` implementation for `dpnp.all` and `dpnp.any` functions [#1512](https://github.com/IntelPython/dpnp/pull/1512)
* Leveraged `dpctl.tensor` implementation for `dpnp.stack` function [#1509](https://github.com/IntelPython/dpnp/pull/1509)
* Leveraged `dpctl.tensor` implementation for `dpnp.concatenate` function [#1507](https://github.com/IntelPython/dpnp/pull/1507)
* Leveraged `dpctl.tensor` implementation for `dpnp.isnan`, `dpnp.isinf` and `dpnp.isfinite` functions [#1504](https://github.com/IntelPython/dpnp/pull/1504)
* Leveraged `dpctl.tensor` implementation for `dpnp.take` function [#1492](https://github.com/IntelPython/dpnp/pull/1492)
* Refreshed API References block in the documentation [#1490](https://github.com/IntelPython/dpnp/pull/1490)
* Refreshed documentation to reflect an actual product behavior [#1485](https://github.com/IntelPython/dpnp/pull/1485)
* Upgraded the build flow to use newer `pybind11=2.11.1` version [#1510](https://github.com/IntelPython/dpnp/pull/1510)
* Updated pre-commit hooks to run with `flake8=6.1.0` and `black=23.7.0` [#1505](https://github.com/IntelPython/dpnp/pull/1505)
* Pinned DPC++ and OneMKL versions to `2023.2`` release [#1496](https://github.com/IntelPython/dpnp/pull/1496)
* Added a specialized kernel for F-contiguous arrays to `dpnp.sum` with `axis=1` [#1489](https://github.com/IntelPython/dpnp/pull/1489)
* Removed a workaround to Klockwork since it is not used anymore due to transition to Coverity tool [#1493](https://github.com/IntelPython/dpnp/pull/1493)

### Fixed

* Resolved `Logically dead code` issue addressed by Coverity scan [#1541](https://github.com/IntelPython/dpnp/pull/1541)
* Resolved `Arguments in wrong order` issue addressed by Coverity scan [#1513](https://github.com/IntelPython/dpnp/pull/1513)
* Resolved `Pointer to local outside scope` issue addressed by Coverity scan [#1514](https://github.com/IntelPython/dpnp/pull/1514)
* Fixed assigning a value to potentially none-valued dictionary coverage generation script [#1511](https://github.com/IntelPython/dpnp/pull/1511)
* Resolved issues with running `dpnp.allclose` function on a device without fp64 support [#1536](https://github.com/IntelPython/dpnp/pull/1536)
* Resolved issues with running FFT functions on a device without fp64 support [#1524](https://github.com/IntelPython/dpnp/pull/1524)
* Resolved issues with running mathematical functions on a device without fp64 support [#1502](https://github.com/IntelPython/dpnp/pull/1502)
* Resolved issues with running random functions on a device without fp64 support [#1498](https://github.com/IntelPython/dpnp/pull/1498)
* Resolved issues with running statistics functions on a device without fp64 support [#1494](https://github.com/IntelPython/dpnp/pull/1494)

## [0.12.1] - 07/18/2023

### Added
Expand All @@ -29,8 +81,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Pinned to `dpctl>=0.14.5` as host and run dependencies [#1481](https://github.com/IntelPython/dpnp/pull/1481)
* Pinned dependent `cython` package to a version less than `3.0.0` [#1480](https://github.com/IntelPython/dpnp/pull/1480)
* Added a specialized kernel for `dpnp.sum` with `axis=0` as a pybind11 extension [#1479](https://github.com/IntelPython/dpnp/pull/1479)
* Redesigned `dpnp.square` function through pybind11 extension of OneMKL call where possible or Leveraging on `dpctl.tensor` implementation [#1473](https://github.com/IntelPython/dpnp/pull/1473)
* Redesigned `dpnp.cos` and `dpnp.sin` functions through pybind11 extension of OneMKL calls where possible or Leveraging on `dpctl.tensor` implementation [#1471](https://github.com/IntelPython/dpnp/pull/1471)
* Redesigned `dpnp.square` function through pybind11 extension of OneMKL call where possible or leveraging on `dpctl.tensor` implementation [#1473](https://github.com/IntelPython/dpnp/pull/1473)
* Redesigned `dpnp.cos` and `dpnp.sin` functions through pybind11 extension of OneMKL calls where possible or leveraging on `dpctl.tensor` implementation [#1471](https://github.com/IntelPython/dpnp/pull/1471)
* Redesigned `dpnp.sqrt` function through pybind11 extension of OneMKL call where possible or leveraging on `dpctl.tensor` implementation [#1470](https://github.com/IntelPython/dpnp/pull/1470)
* Redesigned `dpnp.log` function through pybind11 extension of OneMKL call where possible or leveraging on `dpctl.tensor` implementation [#1469](https://github.com/IntelPython/dpnp/pull/1469)
* Leveraged `dpctl.tensor` implementation for logical operations [#1464](https://github.com/IntelPython/dpnp/pull/1464)
Expand Down
35 changes: 31 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,43 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${DPCTL_MODULE_PATH})


find_package(IntelDPCPP REQUIRED)
find_package(TBB REQUIRED PATHS ${CMAKE_SOURCE_DIR}/dpnp/backend/cmake/Modules NO_DEFAULT_PATH)
find_package(TBB QUIET)
if(TBB_FOUND)
find_package(TBB REQUIRED)
else()
find_package(TBB REQUIRED PATHS ${CMAKE_SOURCE_DIR}/dpnp/backend/cmake/Modules NO_DEFAULT_PATH)
endif()

set(MKL_ARCH "intel64")
set(MKL_LINK "dynamic")
set(MKL_INTERFACE_FULL "intel_ilp64")
set(MKL_THREADING "tbb_thread")
find_package(MKL REQUIRED PATHS ${CMAKE_SOURCE_DIR}/dpnp/backend/cmake/Modules NO_DEFAULT_PATH)
set(MKL_VERSION_2024 FALSE)
find_package(MKL QUIET)
if(MKL_FOUND)
if(MKL_VERSION VERSION_GREATER_EQUAL "2024.0.0")
set(MKL_VERSION_2024 TRUE)
set(MKL_INTERFACE "ilp64")
find_package(MKL REQUIRED)
endif()
endif()

if(NOT MKL_VERSION_2024)
set(MKL_INTERFACE_FULL "intel_ilp64")
find_package(MKL REQUIRED PATHS ${CMAKE_SOURCE_DIR}/dpnp/backend/cmake/Modules NO_DEFAULT_PATH)
endif()

set(ONEDPL_PAR_BACKEND tbb)
find_package(oneDPL REQUIRED PATHS ${CMAKE_SOURCE_DIR}/dpnp/backend/cmake/Modules NO_DEFAULT_PATH)
find_package(oneDPL QUIET)
if(oneDPL_FOUND)
if(oneDPL_VERSION VERSION_GREATER_EQUAL "2022.3.0")
find_package(oneDPL REQUIRED)
else()
find_package(oneDPL REQUIRED PATHS ${CMAKE_SOURCE_DIR}/dpnp/backend/cmake/Modules NO_DEFAULT_PATH)
endif()
else()
find_package(oneDPL REQUIRED PATHS ${CMAKE_SOURCE_DIR}/dpnp/backend/cmake/Modules NO_DEFAULT_PATH)
endif()


include(GNUInstallDirs)

Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,19 @@
## Build from source:
Ensure you have the following prerequisite packages installed:

- `mkl-devel-dpcpp`
- `cython`
- `cmake >=3.21`
- `dpcpp_linux-64` or `dpcpp_win-64` (depending on your OS)
- `dpctl`
- `mkl-devel-dpcpp`
- `onedpl-devel`
- `ninja`
- `numpy >=1.19,<1.25a0`
- `python`
- `scikit-build`
- `setuptools`
- `sysroot_linux-64 >=2.28` (only on Linux OS)
- `tbb-devel`
- `dpctl`

After these steps, `dpnp` can be built in debug mode as follows:

Expand Down
1 change: 1 addition & 0 deletions doc/reference/manipulation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Transpose-like operations
:nosignatures:

dpnp.moveaxis
dpnp.roll
dpnp.rollaxis
dpnp.swapaxes
dpnp.ndarray.T
Expand Down
1 change: 1 addition & 0 deletions doc/reference/math.rst
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ Handling complex numbers
dpnp.imag
dpnp.conj
dpnp.conjugate
dpnp.proj


Extrema Finding
Expand Down
1 change: 1 addition & 0 deletions doc/reference/ufunc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Math operations
dpnp.log10
dpnp.expm1
dpnp.log1p
dpnp.proj
dpnp.sqrt
dpnp.square
dpnp.reciprocal
Expand Down
7 changes: 6 additions & 1 deletion dpnp/backend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ if(DPNP_GENERATE_COVERAGE)
target_link_options(${_trgt} PRIVATE -fprofile-instr-generate -fcoverage-mapping)
endif()

target_link_libraries(${_trgt} PUBLIC MKL::MKL_DPCPP)
if (MKL_VERSION_2024)
target_link_libraries(${_trgt} PUBLIC MKL::MKL_SYCL)
else()
target_link_libraries(${_trgt} PUBLIC MKL::MKL_DPCPP)
endif()

target_link_libraries(${_trgt} PUBLIC oneDPL)

if (UNIX)
Expand Down
6 changes: 5 additions & 1 deletion dpnp/backend/extensions/lapack/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ if (DPNP_GENERATE_COVERAGE)
target_link_options(${python_module_name} PRIVATE -fprofile-instr-generate -fcoverage-mapping)
endif()

target_link_libraries(${python_module_name} PUBLIC MKL::MKL_DPCPP)
if (MKL_VERSION_2024)
target_link_libraries(${python_module_name} PUBLIC MKL::MKL_SYCL::LAPACK)
else()
target_link_libraries(${python_module_name} PUBLIC MKL::MKL_DPCPP)
endif()

install(TARGETS ${python_module_name}
DESTINATION "dpnp/backend/extensions/lapack"
Expand Down
6 changes: 5 additions & 1 deletion dpnp/backend/extensions/vm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ if (DPNP_GENERATE_COVERAGE)
target_link_options(${python_module_name} PRIVATE -fprofile-instr-generate -fcoverage-mapping)
endif()

target_link_libraries(${python_module_name} PUBLIC MKL::MKL_DPCPP)
if (MKL_VERSION_2024)
target_link_libraries(${python_module_name} PUBLIC MKL::MKL_SYCL::VM)
else()
target_link_libraries(${python_module_name} PUBLIC MKL::MKL_DPCPP)
endif()

install(TARGETS ${python_module_name}
DESTINATION "dpnp/backend/extensions/vm"
Expand Down
78 changes: 78 additions & 0 deletions dpnp/backend/extensions/vm/acos.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
//*****************************************************************************
// Copyright (c) 2023, Intel Corporation
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// - Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
// THE POSSIBILITY OF SUCH DAMAGE.
//*****************************************************************************

#pragma once

#include <CL/sycl.hpp>

#include "common.hpp"
#include "types_matrix.hpp"

namespace dpnp
{
namespace backend
{
namespace ext
{
namespace vm
{
template <typename T>
sycl::event acos_contig_impl(sycl::queue exec_q,
const std::int64_t n,
const char *in_a,
char *out_y,
const std::vector<sycl::event> &depends)
{
type_utils::validate_type_for_device<T>(exec_q);

const T *a = reinterpret_cast<const T *>(in_a);
T *y = reinterpret_cast<T *>(out_y);

return mkl_vm::acos(exec_q,
n, // number of elements to be calculated
a, // pointer `a` containing input vector of size n
y, // pointer `y` to the output vector of size n
depends);
}

template <typename fnT, typename T>
struct AcosContigFactory
{
fnT get()
{
if constexpr (std::is_same_v<
typename types::AcosOutputType<T>::value_type, void>)
{
return nullptr;
}
else {
return acos_contig_impl<T>;
}
}
};
} // namespace vm
} // namespace ext
} // namespace backend
} // namespace dpnp
Loading