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

[enhancement] add oneDAL finiteness_checker implementation to onedal #2126

Open
wants to merge 55 commits into
base: main
Choose a base branch
from

Conversation

icfaust
Copy link
Contributor

@icfaust icfaust commented Oct 23, 2024

Description

A GPU side finiteness checker was added to oneDAL in 2024.7 (oneapi-src/oneDAL#2781), this becomes useful with the merge of #2045. This will expose the first step, which is to include it in the onedal folder. This may replace daal4py's assert_all_finite, but will occur in a later PR. This adds limited testing on onedal side.


Checklist to comply with before moving PR from draft:

PR completeness and readability

  • I have reviewed my changes thoroughly before submitting this pull request.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation to reflect the changes or created a separate PR with update and provided its number in the description, if necessary.
  • Git commit message contains an appropriate signed-off-by string (see CONTRIBUTING.md for details).
  • I have added a respective label(s) to PR if I have a permission for that.
  • I have resolved any merge conflicts that might occur with the base branch.

Testing

  • I have run it locally and tested the changes extensively.
  • All CI jobs are green or I have provided justification why they aren't.
  • I have extended testing suite if new functionality was introduced in this PR.

Performance

  • I have measured performance for affected algorithms using scikit-learn_bench and provided at least summary table with measured data, if performance change is expected.
  • I have provided justification why performance has changed or why changes are not expected.
  • I have provided justification why quality metrics have changed or why changes are not expected.
  • I have extended benchmarking suite and provided corresponding scikit-learn_bench PR if new measurable functionality was introduced in this PR.

@icfaust icfaust marked this pull request as ready for review October 24, 2024 08:52
@icfaust icfaust marked this pull request as draft October 24, 2024 08:53
@icfaust
Copy link
Contributor Author

icfaust commented Oct 28, 2024

/azp run CI

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@icfaust
Copy link
Contributor Author

icfaust commented Oct 29, 2024

/azp run CI

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@icfaust
Copy link
Contributor Author

icfaust commented Nov 3, 2024

/intelci: run

@icfaust icfaust marked this pull request as ready for review November 3, 2024 20:58
@icfaust
Copy link
Contributor Author

icfaust commented Nov 3, 2024

Private CI fail unrelated to this implementation.

Copy link
Contributor

@samir-nasibli samir-nasibli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@icfaust Thank you for the excellent work! I have a few questions and clarifications, and I’ve left some comments

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like refactoring for to_table/from_table primitives, but since this api used in several other PRs, I think it worth to move this common changes into separate PR, to be used on #2096, #2106, #2100


def _apply_and_pass(func, *args, **kwargs):
if len(args) == 1:
return func(args[0], **kwargs)
return tuple(map(lambda arg: func(arg, **kwargs), args))


if _is_dpc_backend:
def convert_one_to_table(arg):
return _backend.to_table(np.atleast_2d(arg) if np.isscalar(arg) else arg)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It worth to add a comment. Will this properly work with dpnp ndarrays and dpctl usm_ndarrays?

Comment on lines +48 to +49
if xp == dpnp:
return dpnp.array(dpnp.dpctl.tensor.asarray(table), copy=False)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know is this dpctl module in dpnp is an official part of API? This may work now, but I am not sure for further versions of DPNP. It worth to add some comments here

if dpnp_available:
if _is_dpc_backend:

try:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use dpnp_available from _dpep_helpers instead.

if not _backend.finiteness_checker.compute.compute(policy, params, X_t).finite:
type_err = "infinity" if allow_nan else "NaN, infinity"
padded_input_name = input_name + " " if input_name else ""
msg_err = f"Input {padded_input_name}contains {type_err}."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please cover with tests this message catch

@@ -48,12 +48,8 @@ def __init__(self):


if _is_dpc_backend:
from onedal._device_offload import DummySyclQueue
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only place where DummySyclQueue is used. I am ok with this refactoring, but it worth also remove it definition as well. I didn't find the description for these changes, make sense to move into separate branch or add into commit messages on the merge this work as well, to be clear other dev/users why and when this were removed.

icfaust added a commit to icfaust/scikit-learn-intelex that referenced this pull request Nov 5, 2024
@icfaust icfaust mentioned this pull request Nov 5, 2024
13 tasks
icfaust added a commit to icfaust/scikit-learn-intelex that referenced this pull request Nov 5, 2024
@samir-nasibli
Copy link
Contributor

@icfaust I believe it would be beneficial to include links to other dependent PRs in the description.

icfaust added a commit that referenced this pull request Nov 11, 2024
* carryover from #2126

* formatting

* Update test_memory_usage.py

* Update _data_conversion.py

* Update _data_conversion.py

* Update _data_conversion.py

* Update test_data.py

* Update onedal/datatypes/_data_conversion.py

Co-authored-by: Victoriya Fedotova <viktoria.nn@gmail.com>

* Update _data_conversion.py

* Update _data_conversion.py

* Update onedal/datatypes/_data_conversion.py

Co-authored-by: Samir Nasibli <samir.nasibli@intel.com>

* Update _data_conversion.py

* Update _data_conversion.py

---------

Co-authored-by: Victoriya Fedotova <viktoria.nn@gmail.com>
Co-authored-by: Samir Nasibli <samir.nasibli@intel.com>
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.

3 participants