Skip to content
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

dpnp.fmod() doesn't work properly with a scalar #1348

Closed
wants to merge 18 commits into from

Conversation

antonwolfy
Copy link
Contributor

@antonwolfy antonwolfy commented Mar 22, 2023

The PR is aimed to implement support of dpnp.power call where one of arguments is a scalar.

Currently, since #1201, it raises not-implemented exception in dpnp. This is because dpnp was falling back on NumPy implementation in that use case, but has to call an internal kernel function from the backend.

The PR proposes to copy a scalar data from host memory into USM allocated memory, which means to create zero-dimension dpnp array from the scalar. This way the power of array with a scalar or the power of scalar with an array will be handled in the same way as power with two arrays, which already works fine in dpnp.

Note that if some input argument is a scalar and another one is an array, memory for the scalar will be allocated on the same SYCL device and with the same USM type as the array has. It's required to proceed with further computing and to be compliant with compute follows data paradigm (all input data has to reside on the same device).

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • If this PR is a work in progress, are you filing the PR as a draft?

npolina4 and others added 10 commits March 29, 2023 17:00
Support more use cases for 'out' parameter
…ences

Allow asarray to work on sequences of dpnp_array
* Suppport parameter out in dpnp.add()

* Update tests/test_mathematical.py

Co-authored-by: vlad-perevezentsev <vladislav.perevezentsev@intel.com>

* Update tests/test_mathematical.py

Co-authored-by: vlad-perevezentsev <vladislav.perevezentsev@intel.com>

* Update tests/test_mathematical.py

* Update tests/test_mathematical.py

Co-authored-by: Natalia Polina <natalia.polina@intel.com>

* Use internal _check_nd_call() function which is common for mathematical ones with 2 input arrays

* Add more test for 'out' parameter

---------

Co-authored-by: vlad-perevezentsev <vladislav.perevezentsev@intel.com>
Co-authored-by: Natalia Polina <natalia.polina@intel.com>
@antonwolfy antonwolfy marked this pull request as draft April 4, 2023 17:05
@npolina4 npolina4 self-requested a review April 5, 2023 18:15
@antonwolfy
Copy link
Contributor Author

#1883 covers that PR

@antonwolfy antonwolfy closed this Jun 27, 2024
@antonwolfy antonwolfy deleted the fmod_by_scalar branch June 27, 2024 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants