Skip to content

Commit

Permalink
Linear regression SPMD (#1183)
Browse files Browse the repository at this point in the history
* ENH: OneDAL python ifaces for Random Forest

* initial pybinds

* update

python wrappers, test

* update init

* misc tests update

* update + tests

* intro import

* update

sample weights

* sklearnex dispather: cls

* bump up version

* update fixed params for bins

* update backend wrappers

* update RF cl

* update onedal rf classifier fit

* update fallback to base

* update constraints for falback

* update some attributes saving

* fallback when n_outputs is not 1

* revert additions to deselected_tests.yaml

* update esimators_ for cl

* enabled using onedal rf regression

* PEP8 fixes (#1031)

* Added shape attr check in validation (#1014)

Co-authored-by: Aleksandr Pivovar <[email protected]>

* Fix binary AUC calculation for boolean labels (#1030)

* Fix binary AUC calculation when labels are bool.

Converting y_score to int using label_binarizer just like y_true.

* Optional binarization for y_score

Co-authored-by: Alexander Andreev <[email protected]>

* Update dependency numpy [SECURITY] (#946)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update dependency nbconvert to v6.5.1 [SECURITY] (#1037)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Update algorithm wrappers to latest Scikit-learn changes (#1032)

* Update algorithm wrappers to latest sklearn changes

* PEP8 and lasso fixes

* Fix pca versioning

* Update KMeans versioning

* Rewrite kmeans.fit versions branching

* Fix TSNE perplexity to pass parameter check (perplexity < n_samples)

* Future warnings fix

* Restore auto kmeans algorithm for compatibility with sklearn<1.1

* Numpy versions change; in-function imports removal; load_boston removal (#1041)

* Bump up `dal` and `dal-devel` version to 2021.6.0 in conda recipe (#1015)

* Bump up `dal` and `dal-devel` version to 2021.6.0 in conda recipe

* Update meta.yaml

* Code owners update (#1039)

* Update of code owners

* Replace DTClassifier with DTRegressor in RFRegressor (#1052)

* allow n_init param in KMeans to accept str 'auto' (#1045)

* allow n_init param to accept in kmeans

* whitespace removed

* whitespace removed

* removed check for string for param n_init in kmeans

* changed param 'algorithm' default to lloyd

* whitespace

* add versioning for param change

* pep8 fix

* pep8 fix

* pep8 fix

* Fixed typo: sklern to sklearn in README.md (#1047)

* fixed typo, sklern to sklearn

Co-authored-by: Alexander Andreev <[email protected]>

* Update dependency jupyter-core to v4.11.2 [SECURITY] (#1056)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* ENH: multi-gpu enable

* CI updates (#1062)

* Fix mpich headers for macOS

* Update Ubuntu version to 22.04

* Update macos version to 12

* Change numpy version (#1057)

* Change 'host' to 'cpu' in sycl_execution_content (#1064)

* Change 'host' to 'cpu' in sycl_execution_content

* Remove deprecated host device

* Update python version to 3.10

* Revert "Update python version to 3.10"

This reverts commit 9bf55d4.

Co-authored-by: Samir Nasibli <[email protected]>

* Fix for n_iter_ SVM attribute and oneDAL kNN classifier result option (#1071)

* Add workaround for n_iter_ SVM attribute

* Pytest onedal dir

* Exclude test_policy

* fix result_option fail for kneighbors method in knn classifier

* Numpy version fix (#1070)

* Downgrade build version and set test version of numpy

* Upgrade version to 1.20 for python<=3.9

* Set base numpy to be 1.19.* for build

* Set numpy for future python version

* Enabling full versions and >=3.10 python

Co-authored-by: Nikolay Petrov <[email protected]>

* System info output in CI (#1073)

* add system info

* fix python activation on win

* add system descriptor

* fix descriptor calls

* fix descriptor calls 2

* fix cpufeature installation on mac

* change system descriptor url to oneapi-src/onedal

* Add descriptor script

* Remove extra variable

* Update dependency certifi to v2022 [SECURITY] (#1079)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Fix for balanced class weight (#1080)

* add balanced branch of _compute_class_weight

* Remove extra computation of weights

* Migration to new compiler for 2023.0 release (#1059)

* link libonedal_dpc.so with libonedal_sycl.a due to mkl depency issue

* only changing linker if linux

* additional condition for windows linkage

* removing multiply defined symbols

* windows build completes, sycl errors, trying to start job

* builds and 86/100 examples pass, cleaned up previous unnecessary additions

* initial fix for Linux DPCPP failure

* Flake8 appliance

* add env variables for Linux DPCPP

* Linux DPCPP ci update

* Linux DPCPP check: update conda build step

* moved compiler options setting into conda-recipe build

* reverting linkage changes - resolved from mkl fpk update

* address some comments

updates passing -fsycl flag

some refactoring

* rebase

* fix comments

* Update CMakeLists.txt

fix using gcc compiler

* Apply pep8

* Apply pep8 n2

* Update CMakeLists.txt

* resolving windows intel compiler issues

* MD to MT flag for compiler and removing unneeded cmake verbose flag

* updated gitignore

* link libonedal_dpc.so with libonedal_sycl.a due to mkl depency issue

* only changing linker if linux

* additional condition for windows linkage

* removing multiply defined symbols

* windows build completes, sycl errors, trying to start job

* builds and 86/100 examples pass, cleaned up previous unnecessary additions

* initial fix for Linux DPCPP failure

* Flake8 appliance

* add env variables for Linux DPCPP

* Linux DPCPP ci update

* Linux DPCPP check: update conda build step

* moved compiler options setting into conda-recipe build

* reverting linkage changes - resolved from mkl fpk update

* address some comments

updates passing -fsycl flag

some refactoring

* rebase

* fix comments

* Update CMakeLists.txt

fix using gcc compiler

* Apply pep8

* Apply pep8 n2

* Update CMakeLists.txt

* resolving windows intel compiler issues

* MD to MT flag for compiler and removing unneeded cmake verbose flag

* updated gitignore

* Update setup.py

* reverting MT flag back to MD

* undoing last commit

* reverting sycl linking addition

* removing sycl addition pt. 2

* addressing Mac comments

* link fsycl in cmake only when using dpc interface

* FIX: daal4py spmd test

* some misc fixes setup.py

Co-authored-by: Samir Nasibli <[email protected]>
Co-authored-by: Alexander Andreev <[email protected]>

* FIX: daal4py sycl examples (#1081)

Added required extra_link_args for `icpx/icx` compiler.

* CI matrix and sklearn>1.1 fixes (#1086)

* fix for 'normalize' deprecation in linear_model

* Add initial jobs matrix

* Rework matrix

* Dependencies fix

* Disable DPCPPROOT; fix clang-format installation

* Modify sklearn dep

* Modify scikit-learn installation with pip

* Disable df examples/tests

* fix for sed command

* Fix scipy version on Windows

* Fix scipy version on Windows 2

* Build docs only on py3.9

* Build docs only on py3.9 n2

* Build docs only on py3.9 n3

* Select one job for docs generation

* Increase testing numpy version on Windows

* Extend matrix to sklearn 1.2

* PCA n_features_ deprecation

* Update linear model __init__

* Correct daal version with fixed decision forest

* Move docs building to separate job

* Change matrix; update deps; add sklearnex/* tests

* Enable onedal iface

* Temp.disable dpcpp

* Update pybind11 for py311

* Add upgrade for testing deps installation

* Add sourcing of MSVS on Windows

* Update setup*.py

* Correct requirements.txt

* Correct conda-recipe/build* - d4p installation

* Modify Windows testing

* Fix paths for Windows testing

* Fix paths for Windows testing 2

* Repair docs job

* Repair docs job 2

* Repair docs job 3

* Enable older dpcpp compiler build

* Try to fix deselect for daal4py/sklearn tests on Windows

* fix daal4py docs build - tbb runtime libs exception

* Try to fix deselect for daal4py/sklearn tests on Windows 2

* change dpcpp compiler

* Change dep. versions

* CI matrix change

* Add global patching testing on lnx; remove extra exmples run on mac

* Explicit passing of gamma paramater for kmeans (#1091)

* Revert record filenames in conda-recipe (#1092)

* removed outdated code

* some refactoring

* update onedal4py

* temp: using daal4py backend for sklearnex testing

leaving onlu onedal module tests

* tmp: using daal4py backend

* initial update for the build

* misc fixes

* added using spmd policy

* added some python primitives for spmd policy

* add instantiation for spmd interface

* all together

bringing updated changes from #1058

spmd interface

dpctl integration

updates for MPI

* update onedal.spmd.ensemble

* dpctl installation for ci

initial

* some tests fix

* add missed decorator

* update GPU support condition

* removed merge artefacts

* dev/linear-regression

* All is working. Final polishing is required

* Dispatching

* Clang-format applied as weel as some comments from @samir-nasibli

* PEP8 applied

* Tests fixed

* Minor

* Minor

* Minor

* Minor

* _onedal_supported fixes

* Date in _common.py fixed

* More date fixes

* Proper initialization

* Minor

* PEP8 compliant

* Minor

* ENH: common for SPMD

* PEP8

* Borrowing

* Minor fixes

* Minor

* Comments applied

* Minor

* Switching by versions

* Minor

* Minor

* More define switching

* ONEDAL_STR as string

* Minor

* Correct DALROOT environment variable usage

* No triling space

* Changes in setup_*.py

* Proper versions

* Version define revisited

* Comments by @Alexsandruss applied

* Comparison in integers

* Minor

* Switch in linear.py

* Minor

* Minor

* Optional testing

* Correct dispatching

* Minor

* Bug fixes

* Minor

* Another try

* Minor

* Minor

* Minor

* Complete rework

* PEP8 rules

* Minor

* Comments by @Alexsandruss

* Minor

* Minor

* Another minor commit

* Minor

* Fixes for PEP8

* Minor

* Fixes

* New trimmed deselected list

* PEP8

* Minor

* Minor

* Minor

* Minor

* Temp

* Minor

* Minor

* Minor

* Minor

* Minor

* Steady progress

* Minor

* Test for finiteness

* Minor

* Minor

* Convertation

* minor

* Minor

* minor

* Minor

* update build

* pep8 codestyle

* update

* minor

* Everything is working

* License plate

* Minor

* Minor

* Changes in testing

* SPMD init changes

* Minor

* Minor

* Further improvements

* Minor

* PEP8 application

* Minor

* Minor

* required changes

* Minor

* Minor

* CI changes

* Reversed

* Minor

* minor

* Minor improvements

* Filtered list of tests

* Minor changes according to @Alexsandruss

* Filtering fixed

* Another #ifdef

---------

Co-authored-by: snasibli <[email protected]>
Co-authored-by: Alexander Andreev <[email protected]>
Co-authored-by: PivovarA <[email protected]>
Co-authored-by: Aleksandr Pivovar <[email protected]>
Co-authored-by: Furkan Tektas <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: msa <[email protected]>
Co-authored-by: Shittu Samson <[email protected]>
Co-authored-by: Nikolay Petrov <[email protected]>
Co-authored-by: [email protected] <[email protected]>
  • Loading branch information
11 people authored Feb 25, 2023
1 parent f7fc14a commit e5e8a13
Show file tree
Hide file tree
Showing 16 changed files with 235 additions and 15 deletions.
65 changes: 65 additions & 0 deletions examples/sklearnex/spmd_linear_regression.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#===============================================================================
# Copyright 2023 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#===============================================================================

import numpy as np
from mpi4py import MPI
import dpctl
from numpy.testing import assert_allclose
from onedal.spmd.linear_model import LinearRegression as LinRegSpmd


def generate_X_y(par, coef_seed, data_seed):
ns, nf, nr = par['ns'], par['nf'], par['nr']

crng = np.random.default_rng(coef_seed)
coef = crng.uniform(-4, 1, size=(nr, nf)).T
intp = crng.uniform(-1, 9, size=(nr, ))

drng = np.random.default_rng(data_seed)
data = drng.uniform(-7, 7, size=(ns, nf))
resp = data @ coef + intp[np.newaxis, :]

return data, resp, coef, intp


if __name__ == "__main__":
q = dpctl.SyclQueue("gpu")

comm = MPI.COMM_WORLD
rank = comm.Get_rank()
size = comm.Get_size()

params_spmd = {'ns': 15, 'nf': 21, 'nr': 23}
params_grtr = {'ns': 77, 'nf': 21, 'nr': 23}

Xsp, ysp, csp, isp = generate_X_y(params_spmd, size, size + rank - 1)
Xgt, ygt, cgt, igt = generate_X_y(params_grtr, size, size + rank + 1)

assert_allclose(csp, cgt)
assert_allclose(isp, igt)

lrsp = LinRegSpmd(copy_X=True, fit_intercept=True)
lrsp.fit(Xsp, ysp, queue=q)

assert_allclose(lrsp.coef_, csp.T)
assert_allclose(lrsp.intercept_, isp)

ypr = lrsp.predict(Xgt, queue=q)

assert_allclose(ypr, ygt)

print("Groundtruth responses:\n", ygt)
print("Computed responses:\n", ypr)
3 changes: 3 additions & 0 deletions onedal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,6 @@

if daal_check_version((2023, 'P', 100)):
__all__.append('linear_model')

if _is_dpc_backend:
__all__.append('spmd.linear_model')
2 changes: 1 addition & 1 deletion onedal/common/spmd_policy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace oneapi::dal::python {
ONEDAL_PY_INIT_MODULE(spmd_policy) {
import_dpctl();
py::class_<dal::detail::spmd_policy<detail::data_parallel_policy>>(m, "spmd_data_parallel_policy")
.def(py::init([](cl::sycl::queue &q) {
.def(py::init([](sycl::queue &q) {
detail::data_parallel_policy local_policy = detail::data_parallel_policy(q);
// TODO:
// Communicator hardcoded. Implement passing spmd communicator.
Expand Down
4 changes: 3 additions & 1 deletion onedal/datatypes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@
_get_2d_shape
)

from ._data_conversion import _convert_to_supported

__all__ = ['_column_or_1d', '_validate_targets', '_check_X_y',
'_check_array', '_check_classification_targets',
'_type_of_target', '_is_integral_float',
'_is_multilabel', '_check_n_features', '_num_features',
'_num_samples', '_get_2d_shape']
'_num_samples', '_get_2d_shape', '_convert_to_supported']
46 changes: 46 additions & 0 deletions onedal/datatypes/_data_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,49 @@ def to_table(*args):
if len(args) == 1:
return convert_one_to_table(args[0])
return (convert_one_to_table(item) for item in args)


from onedal import _is_dpc_backend

if _is_dpc_backend:
import numpy as np

from ..common._spmd_policy import _SPMDDataParallelInteropPolicy
from ..common._policy import _HostInteropPolicy, _DataParallelInteropPolicy

def _convert_to_supported_impl(policy, *data):
# CPUs support FP64 by default
is_host = isinstance(policy, _HostInteropPolicy)
no_dpcpp = not _is_dpc_backend
if is_host or no_dpcpp:
return data

# There is only one option of data parallel policy
is_dpcpp_policy = isinstance(policy, _DataParallelInteropPolicy)
is_spmd_policy = isinstance(policy, _SPMDDataParallelInteropPolicy)
assert is_spmd_policy or is_dpcpp_policy

device = policy._queue.sycl_device

def convert_or_pass(x):
if x.dtype is not np.float32:
return x.astype(np.float32)
else:
return x

if not device.has_aspect_fp64:
return (convert_or_pass(x) for x in data)
else:
return data
else:
def _convert_to_supported_impl(policy, *data):
return data


def _convert_to_supported(policy, *data):
res = _convert_to_supported_impl(policy, *data)

if len(data) == 1:
return res[0]
else:
return res
5 changes: 5 additions & 0 deletions onedal/linear_model/linear_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,13 @@ ONEDAL_PY_INIT_MODULE(linear_model) {
using task_list = types<task::regression>;
auto sub = m.def_submodule("linear_model");

#ifdef ONEDAL_DATA_PARALLEL_SPMD
ONEDAL_PY_INSTANTIATE(init_train_ops, sub, policy_list_spmd, task_list);
ONEDAL_PY_INSTANTIATE(init_infer_ops, sub, policy_list_spmd, task_list);
#else // ONEDAL_DATA_PARALLEL_SPMD
ONEDAL_PY_INSTANTIATE(init_train_ops, sub, policy_list, task_list);
ONEDAL_PY_INSTANTIATE(init_infer_ops, sub, policy_list, task_list);
#endif // ONEDAL_DATA_PARALLEL_SPMD

ONEDAL_PY_INSTANTIATE(init_model, sub, task_list);
ONEDAL_PY_INSTANTIATE(init_train_result, sub, task_list);
Expand Down
26 changes: 18 additions & 8 deletions onedal/linear_model/linear_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
_num_features,
_check_array,
_get_2d_shape,
_check_n_features)
_check_n_features,
_convert_to_supported)

from ..common._mixin import RegressorMixin
from ..common._policy import _get_policy
Expand All @@ -42,6 +43,9 @@ def __init__(self, fit_intercept, copy_X, algorithm):
self.algorithm = algorithm
self.copy_X = copy_X

def _get_policy(self, queue, *data):
return _get_policy(queue, *data)

def _get_onedal_params(self, dtype=np.float32):
intercept = 'intercept|' if self.fit_intercept else ''
return {
Expand All @@ -51,7 +55,7 @@ def _get_onedal_params(self, dtype=np.float32):
}

def _fit(self, X, y, module, queue):
policy = _get_policy(queue, X, y)
policy = self._get_policy(queue, X, y)

X_loc, y_loc = X, y
if not isinstance(X, np.ndarray):
Expand All @@ -72,6 +76,7 @@ def _fit(self, X, y, module, queue):

self.n_features_in_ = _num_features(X_loc, fallback_1d=True)

X_loc, y_loc = _convert_to_supported(policy, X_loc, y_loc)
X_table, y_table = to_table(X_loc, y_loc)

result = module.train(policy, params, X_table, y_table)
Expand Down Expand Up @@ -111,13 +116,13 @@ def _create_model(self, module):
assert n_targets_in == intercept.size

intercept = _check_array(intercept, dtype=[np.float64, np.float32],
force_all_finite=True)
force_all_finite=True, ensure_2d=False)
coefficients = _check_array(
coefficients,
dtype=[
np.float64,
np.float32],
force_all_finite=True)
force_all_finite=True, ensure_2d=False)

coefficients, intercept = make2d(coefficients), make2d(intercept)
coefficients = coefficients.T if n_targets_in == 1 else coefficients
Expand All @@ -130,16 +135,18 @@ def _create_model(self, module):

packed_coefficients[:, 1:] = coefficients
if self.fit_intercept:
packed_coefficients[:, :0] = intercept
packed_coefficients[:, 0][:, np.newaxis] = intercept

m.packed_coefficients = to_table(packed_coefficients)

self._onedal_model = m

return m

def _predict(self, X, module, queue):
_check_is_fitted(self)

policy = _get_policy(queue, X)
policy = self._get_policy(queue, X)

if isinstance(X, np.ndarray):
X_loc = np.asarray(X)
Expand All @@ -148,7 +155,7 @@ def _predict(self, X, module, queue):

# Finiteness is checked in the sklearnex wrapper
X_loc = _check_array(X_loc, dtype=[np.float64, np.float32],
force_all_finite=False)
force_all_finite=False, ensure_2d=False)
_check_n_features(self, X_loc, False)

params = self._get_onedal_params(X_loc)
Expand All @@ -158,7 +165,10 @@ def _predict(self, X, module, queue):
else:
model = self._create_model(module)

X_table = to_table(make2d(X_loc))
X_loc = make2d(X_loc)
X_loc = _convert_to_supported(policy, X_loc)

X_table = to_table(X_loc)
result = module.infer(policy, params, model, X_table)
y = from_table(result.responses)

Expand Down
3 changes: 2 additions & 1 deletion onedal/linear_model/tests/test_linear_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,6 @@ def test_reconstruct_model(queue):
model.intercept_ = intp

res = model.predict(X, queue=queue)

from onedal.datatypes._data_conversion import from_table
print(from_table(model._onedal_model.packed_coefficients))
assert_allclose(gtr, res)
2 changes: 1 addition & 1 deletion onedal/spmd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
# limitations under the License.
#===============================================================================

__all__ = []
__all__ = ['linear_model']
19 changes: 19 additions & 0 deletions onedal/spmd/linear_model/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#===============================================================================
# Copyright 2023 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#===============================================================================

from .linear_model import LinearRegression

__all__ = ['LinearRegression']
28 changes: 28 additions & 0 deletions onedal/spmd/linear_model/linear_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#===============================================================================
# Copyright 2023 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#===============================================================================

from abc import ABC
from ...common._spmd_policy import _get_spmd_policy
from onedal.linear_model import LinearRegression as LinearRegression_Batch


class BaseLinearRegressionSPMD(ABC):
def _get_policy(self, queue, *data):
return _get_spmd_policy(queue)


class LinearRegression(BaseLinearRegressionSPMD, LinearRegression_Batch):
pass
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ def run(self):
'onedal.datatypes',
'onedal.common'
] + (['onedal.linear_model'] if ONEDAL_VERSION >= 20230100 else []) + (
['onedal.spmd'] if build_distribute else [])),
['onedal.spmd', 'onedal.spmd.linear_model'] if build_distribute else [])),
package_data={
'daal4py.oneapi': [
'liboneapi_backend.so',
Expand Down
2 changes: 1 addition & 1 deletion sklearnex/spmd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
# limitations under the License.
#===============================================================================

__all__ = []
__all__ = ['linear_model']
19 changes: 19 additions & 0 deletions sklearnex/spmd/linear_model/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#===============================================================================
# Copyright 2023 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#===============================================================================

from .linear_model import LinearRegression

__all__ = ['LinearRegression']
21 changes: 21 additions & 0 deletions sklearnex/spmd/linear_model/linear_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#===============================================================================
# Copyright 2023 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#===============================================================================

from onedal.spmd.linear_model import LinearRegression

# TODO:
# Currently it uses `onedal` module interface.
# Add sklearnex dispatching.
3 changes: 2 additions & 1 deletion tests/test_examples_sklearnex.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ def testit(self):
print("Generating tests for " + os.path.splitext(file)[0])


files = [f for f in os.listdir(examples_path) if f.endswith(".py")]
files = [f for f in os.listdir(examples_path) if f.endswith(".py") and 'spmd' not in f]

for file in files:
test_generator(file)

Expand Down

0 comments on commit e5e8a13

Please sign in to comment.