Skip to content

Commit a3f3407

Browse files
committed
Merge branch 'main' into dev/eglaser-add-torch-spmd-validation
2 parents f767365 + a1b8bc1 commit a3f3407

128 files changed

Lines changed: 4434 additions & 3213 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.ci/pipeline/build-and-test-lnx.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ steps:
6767
NO_DPC: ${{ variables.NO_DPC }}
6868
DPCTL_VERSION: 0.21.1
6969
DPNP_VERSION: 0.19.1
70-
DPCPP_RT_VERSION: 2025.3.2
70+
DPCPP_RT_VERSION: 2025.3.3
7171
displayName: "Install testing requirements"
7272
- script: |
7373
. /usr/share/miniconda/etc/profile.d/conda.sh
Lines changed: 44 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,44 @@
1-
#! /usr/bin/env python
2-
# ===============================================================================
3-
# Copyright 2023 Intel Corporation
4-
#
5-
# Licensed under the Apache License, Version 2.0 (the "License");
6-
# you may not use this file except in compliance with the License.
7-
# You may obtain a copy of the License at
8-
#
9-
# http://www.apache.org/licenses/LICENSE-2.0
10-
#
11-
# Unless required by applicable law or agreed to in writing, software
12-
# distributed under the License is distributed on an "AS IS" BASIS,
13-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
# See the License for the specific language governing permissions and
15-
# limitations under the License.
16-
# ===============================================================================
17-
from sys import argv, exit, stderr
18-
from sys import version_info as python_version
19-
20-
if len(argv) == 1:
21-
from daal4py.sklearn._utils import sklearn_check_version
22-
else:
23-
# This is necessary to prevent import errors from sklearnex and by extension
24-
# sklearn caused by initial scipy and/or numpy versions that are installed.
25-
# It is written in a way to be `packaging` independent. This branch occurs
26-
# when a sklearn version is given to the script externally.
27-
def sklearn_check_version(ver):
28-
ver = [int(i) if i != "" else 0 for i in ver.split(".")[:2]]
29-
sk_ver = [int(i) if i != "" else 0 for i in str(argv[1]).split(".")[:2]]
30-
return sk_ver[0] > ver[0] or (sk_ver[0] == ver[0] and sk_ver[1] >= ver[1])
31-
32-
33-
if sklearn_check_version("1.4"):
34-
print("Scipy version is not specified for this sklearn/python version.", file=stderr)
35-
print("scipy")
36-
elif sklearn_check_version("1.3") or python_version[1] > 11:
37-
if python_version[1] > 8:
38-
print("scipy==1.12.*")
39-
else:
40-
print("scipy==1.11.*")
41-
elif sklearn_check_version("1.2") or python_version[1] > 10:
42-
if python_version[1] > 9:
43-
print("scipy==1.12.*")
44-
else:
45-
print("scipy==1.9.*")
46-
elif sklearn_check_version("1.1"):
47-
print("scipy==1.8.*")
48-
elif sklearn_check_version("1.0"):
49-
print("scipy==1.7.*")
50-
else:
51-
print(
52-
"Scipy version defaults to not specified "
53-
"for this outdated sklearn/python version.",
54-
file=stderr,
55-
)
56-
print("scipy")
1+
#! /usr/bin/env python
2+
# ===============================================================================
3+
# Copyright 2023 Intel Corporation
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
# ===============================================================================
17+
from sys import argv, exit, stderr
18+
from sys import version_info as python_version
19+
20+
if len(argv) == 1:
21+
from daal4py.sklearn._utils import sklearn_check_version
22+
else:
23+
# This is necessary to prevent import errors from sklearnex and by extension
24+
# sklearn caused by initial scipy and/or numpy versions that are installed.
25+
# It is written in a way to be `packaging` independent. This branch occurs
26+
# when a sklearn version is given to the script externally.
27+
def sklearn_check_version(ver):
28+
ver = [int(i) if i != "" else 0 for i in ver.split(".")[:2]]
29+
sk_ver = [int(i) if i != "" else 0 for i in str(argv[1]).split(".")[:2]]
30+
return sk_ver[0] > ver[0] or (sk_ver[0] == ver[0] and sk_ver[1] >= ver[1])
31+
32+
33+
if sklearn_check_version("1.4"):
34+
print("Scipy version is not specified for this sklearn/python version.", file=stderr)
35+
print("scipy")
36+
elif sklearn_check_version("1.0"):
37+
print("scipy==1.10.*")
38+
else:
39+
print(
40+
"Scipy version defaults to not specified "
41+
"for this outdated sklearn/python version.",
42+
file=stderr,
43+
)
44+
print("scipy")

.ci/scripts/install_dpcpp.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
2121
echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
2222
sudo add-apt-repository -y "deb https://apt.repos.intel.com/oneapi all main"
2323
sudo apt-get update
24-
sudo apt-get install -y intel-oneapi-compiler-dpcpp-cpp=2025.3.2-832
24+
sudo apt-get install -y intel-oneapi-compiler-dpcpp-cpp=2025.3.3-30
2525
sudo bash -c 'echo libintelocl.so > /etc/OpenCL/vendors/intel-cpu.icd'

.circleci/deselect_tests.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,10 @@ def create_pytest_switches(
8181
with open(filename, "r") as fh:
8282
dt = yaml_load(fh, Loader=FullLoader)
8383

84+
sklearn_dir = os.path.dirname(sklearn.__file__)
85+
8486
if absolute:
85-
base_dir = (
86-
os.path.relpath(
87-
os.path.dirname(sklearn.__file__), os.path.expanduser("~")
88-
)
89-
+ "/"
90-
)
87+
base_dir = os.path.relpath(sklearn_dir, os.path.expanduser("~")) + "/"
9188
elif base_dir is None:
9289
base_dir = ""
9390
elif not base_dir.endswith("/"):
@@ -129,6 +126,14 @@ def create_pytest_switches(
129126
for test_name in filtered_deselection:
130127
if test_name:
131128
pytest_switches.extend(["--deselect=" + base_dir + test_name])
129+
130+
# Files that crash at collection time need --ignore instead of --deselect
131+
for entry in dt.get("ignored_tests", []):
132+
rel_path = filter_by_version_and_platform(entry, sklearn_version)
133+
if rel_path:
134+
pytest_switches.append(
135+
"--ignore=" + os.path.join(sklearn_dir, *rel_path.split("/"))
136+
)
132137
return pytest_switches
133138

134139

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ concurrency:
3232
env:
3333
DPCTL_VERSION: 0.21.1
3434
DPNP_VERSION: 0.19.1
35-
DPCTL_PY_VERSIONS: '3.10\|3.12'
35+
DPCTL_PY_VERSIONS: '3.10\|3.14'
3636
UXL_PYTHONVERSION: "3.13"
3737
UXL_SKLEARNVERSION: "1.6"
3838
ONEDAL_REPO: "uxlfoundation/oneDAL"

.github/workflows/docs-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ jobs:
9898
./build-doc.sh --gh-pages
9999
100100
- name: Setup Pages
101-
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
101+
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
102102

103103
- name: Prepare Documentation for Deployment
104104
run: |

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
repos:
1818
- repo: https://github.com/psf/black
19-
rev: 26.1.0
19+
rev: 26.3.1
2020
hooks:
2121
- id: black
2222
- repo: https://github.com/PyCQA/isort

README.md

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ Easiest way to benefit from accelerations from the extension is by patching scik
9393
clustering = DBSCAN(eps=3, min_samples=2).fit(X)
9494
```
9595

96+
:eyes: Read about [other ways to patch scikit-learn](https://uxlfoundation.github.io/scikit-learn-intelex/latest/quick-start.html#patching).
97+
9698
:eyes: Check out available [notebooks](https://github.com/uxlfoundation/scikit-learn-intelex/tree/master/examples/notebooks) for more examples.
9799

98100
### Usage without patching
@@ -133,37 +135,6 @@ pip install scikit-learn-intelex
133135

134136
Package is also offered through other channels such as conda-forge. See all installation instructions in the [Installation Guide](https://uxlfoundation.github.io/scikit-learn-intelex/latest/quick-start.html#installation).
135137

136-
## Integration
137-
138-
The easiest way of accelerating scikit-learn workflows with the extension is through through [patching](https://uxlfoundation.github.io/scikit-learn-intelex/latest/quick-start.html#patching), which replaces the stock scikit-learn algorithms with their optimized versions provided by the extension using the same namespaces in the same modules as scikit-learn.
139-
140-
The patching only affects [supported algorithms and their parameters](https://uxlfoundation.github.io/scikit-learn-intelex/latest/algorithms.html).
141-
You can still use not supported ones in your code, the package simply fallbacks into the stock version of scikit-learn.
142-
143-
> **_TIP:_** Enable [verbose mode](https://uxlfoundation.github.io/scikit-learn-intelex/latest/verbose.html) to see which implementation of the algorithm is currently used.
144-
145-
To patch scikit-learn, you can:
146-
* Use the following command-line flag:
147-
```shell
148-
python -m sklearnex my_application.py
149-
```
150-
* Add the following lines to the script:
151-
```python
152-
from sklearnex import patch_sklearn
153-
patch_sklearn()
154-
```
155-
156-
:eyes: Read about [other ways to patch scikit-learn](https://uxlfoundation.github.io/scikit-learn-intelex/latest/quick-start.html#patching).
157-
158-
As an alternative, accelerated classes from the extension can also be imported directly without patching, thereby allowing to keep them separate from stock scikit-learn ones - for example:
159-
160-
```python
161-
from sklearnex.cluster import DBSCAN as exDBSCAN
162-
from sklearn.cluster import DBSCAN as stockDBSCAN
163-
164-
# ...
165-
```
166-
167138
## Documentation
168139

169140
* [Quick Start](https://uxlfoundation.github.io/scikit-learn-intelex/latest/quick-start.html)

conda-recipe/meta.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ test:
9393
- treelite
9494
- array-api-compat
9595
- array-api-strict
96+
- polars
9697
source_files:
9798
- .ci
9899
- setup.cfg

daal4py/sklearn/_utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ def is_sparse(x):
200200
return sp.issparse(x) or (is_DataFrame(x) and hasattr(x, "sparse"))
201201

202202

203+
def check_is_array_api(x: object) -> bool:
204+
return not isinstance(x, np.ndarray) and hasattr(x, "__dlpack__")
205+
206+
203207
class PatchingConditionsChain:
204208
def __init__(self, scope_name):
205209
self.scope_name = scope_name

0 commit comments

Comments
 (0)