Skip to content

Conversation

@david-cortes-intel
Copy link
Contributor

Description

This PR:

  • Removes references and recommendations to use the soon-to-be-removed arrays from dpctl, replacing the suggestions for dpnp arrays instead.
  • Adds documentation pages for the config contexts in sklearnex.
  • Rewords lots of docs related to GPU support to be more clear and reflect the current behaviors of the library.

Checklist:

Completeness and readability

  • I have updated the documentation to reflect the changes or created a separate PR with updates 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 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.

@codecov
Copy link

codecov bot commented Oct 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
azure 80.49% <100.00%> (?)
github 82.09% <100.00%> (+9.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
sklearnex/_config.py 100.00% <100.00%> (ø)

... and 75 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@david-cortes-intel
Copy link
Contributor Author

Failing doc CI job appears to be a rate limiting issue with medium.com.

will be converted to CSR, which implies more than just data copying.
- Heterogeneous NumPy array
- If SYCL queue is provided for device without ``float64`` support but data are ``float64``, data are copied with reduced precision.
- If SyCL queue is provided for device without ``float64`` support but data are ``float64``, data are copied with reduced precision.
Copy link
Contributor

Choose a reason for hiding this comment

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

Its SYCL in all cases not in code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

from daal4py.sklearn._utils import sklearn_check_version
from onedal._config import _get_config as onedal_get_config

__all__ = ["get_config", "set_config", "config_context"]
Copy link
Contributor

Choose a reason for hiding this comment

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

why add __all__?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It defines more objects than these 3. Adding __all__ would avoid making them exportable for asterisk imports.


__all__ = ["get_config", "set_config", "config_context"]

tab = " " if (sys.version_info.major == 3 and sys.version_info.minor < 13) else ""
Copy link
Contributor

Choose a reason for hiding this comment

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

Whats up with the tabs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Python 3.13 changed how it deals with leading whitespace in docstrings.

Copy link
Contributor

Choose a reason for hiding this comment

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

Does that mean we need to do it throughout the repo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This same workaround is already used in other places throughout the repository.

@ethanglaser ethanglaser requested a review from Copilot November 6, 2025 05:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves GPU-related documentation and modernizes array handling recommendations by removing references to soon-to-be-deprecated dpctl arrays and replacing them with dpnp arrays. Key changes include:

  • Adds comprehensive documentation for sklearnex configuration contexts (config_context, set_config, get_config)
  • Restructures and clarifies GPU support documentation with better organization and examples
  • Updates code examples across documentation to use dpnp and torch tensors instead of dpctl arrays

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
sklearnex/_config.py Adds shared docstring for configuration options, updates function docstrings to reference it
doc/sources/substitutions.rst Adds substitution for dpnp_array reference link
doc/sources/oneapi-gpu.rst Major rewrite of GPU docs with clearer sections, updated examples, and removal of dpctl array references
doc/sources/input-types.rst Removes dpctl.tensor references, updates to mention only dpnp.ndarray
doc/sources/index.rst Updates examples to use torch tensors instead of dpnp, fixes syntax error in code block
doc/sources/distributed-mode.rst Updates text to reference dpnp_array instead of dpctl arrays
doc/sources/config-contexts.rst New documentation page for configuration contexts
doc/sources/array_api.rst Updates SyCL/SYCL spelling, removes dpctl references, adds torch tensor examples
doc/sources/algorithms.rst Minor formatting fix to verbose mode reference
Comments suppressed due to low confidence (1)

sklearnex/_config.py:1

  • Corrected spelling of 'accelered' to 'accelerated'.
# ==============================================================================

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


__all__ = ["get_config", "set_config", "config_context"]

tab = " " if (sys.version_info.major == 3 and sys.version_info.minor < 13) else ""
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

The magic number 13 in the Python version check lacks explanation. Consider adding a comment explaining why Python 3.13+ requires different tab handling for docstrings, or define this as a named constant like PYTHON_VERSION_WITH_DOCSTRING_CHANGE = (3, 13).

Suggested change
tab = " " if (sys.version_info.major == 3 and sys.version_info.minor < 13) else ""
# Python 3.13+ changes tab handling in docstrings, so we adjust indentation accordingly.
PYTHON_VERSION_WITH_DOCSTRING_CHANGE = (3, 13)
tab = " " if (sys.version_info.major == 3 and sys.version_info.minor < PYTHON_VERSION_WITH_DOCSTRING_CHANGE[1]) else ""

Copilot uses AI. Check for mistakes.
os.environ["SCIPY_ARRAY_API"] = "1"
import numpy as np
import dpnp
import torch
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not keep dpnp here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's currently lacking important capabilities like serialization, and more likely to segfault instead of producing errors when doing something wrong with it. I think it's more likely that a user playing with this example would run into issues with dpnp than with torch, and then conclude that sklearnex can't do something before reading the docs.

Overview
========

Just like |sklearn|, the |sklearnex| offers configurable options which can be managed
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor naming conventions nitpick - I'd say it makes more sense to refer to "|sklearnex|" compared to "the |sklearnex|". The name of the project is Extension for scikit-learn. This could apply to line 24, 29, 32, 36, 48, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a macro that expands to "Extension for Scikit-learn*":

.. |sklearnex| replace:: Extension for Scikit-learn*

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes but I mean to remove "the" in "the |sklearnex|" and just refer to it as |sklearnex|

Copy link
Contributor

Choose a reason for hiding this comment

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

So in this case "Just like |sklearn|, the Extension for Scikit-learn offers configurable options which can be managed" would be "Just like |sklearn|, Extension for Scikit-learn offers configurable options which can be managed"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd say

The extension for scikit-learn offers ...

.. sounds more correct to me than

Extension for scikit-learn offers ...

.. if put within a larger paragraph.

@ethanglaser ethanglaser mentioned this pull request Nov 6, 2025
10 tasks
@david-cortes-intel david-cortes-intel merged commit 8bb05f0 into uxlfoundation:main Nov 17, 2025
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants