diff --git a/setup.py b/setup.py index a1d25568d7..4d6f92a202 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,7 @@ #! /usr/bin/env python # ============================================================================== # Copyright 2014 Intel Corporation +# Copyright 2024 Fujitsu Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -72,7 +73,7 @@ ONEDAL_2021_3 = 2021 * 10000 + 3 * 100 ONEDAL_2023_0_1 = 2023 * 10000 + 0 * 100 + 1 is_onedal_iface = ( - os.environ.get("OFF_ONEDAL_IFACE") is None and ONEDAL_VERSION >= ONEDAL_2021_3 + os.environ.get("OFF_ONEDAL_IFACE", "0") == "0" and ONEDAL_VERSION >= ONEDAL_2021_3 ) d4p_version = ( diff --git a/sklearnex/__init__.py b/sklearnex/__init__.py index c3f9e586e6..f9d8b21d1d 100755 --- a/sklearnex/__init__.py +++ b/sklearnex/__init__.py @@ -1,5 +1,6 @@ # ============================================================================== # Copyright 2021 Intel Corporation +# Copyright 2024 Fujitsu Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +15,7 @@ # limitations under the License. # ============================================================================== -from onedal.common.hyperparameters import get_hyperparameters +import os from . import utils from ._config import config_context, get_config, set_config @@ -50,12 +51,13 @@ "unpatch_sklearn", "utils", ] +onedal_iface_flag = os.environ.get("OFF_ONEDAL_IFACE", "0") +if onedal_iface_flag == "0": + from onedal import _is_spmd_backend + from onedal.common.hyperparameters import get_hyperparameters - -from onedal import _is_spmd_backend - -if _is_spmd_backend: - __all__.append("spmd") + if _is_spmd_backend: + __all__.append("spmd") from ._utils import set_sklearn_ex_verbose diff --git a/sklearnex/dispatcher.py b/sklearnex/dispatcher.py index 04bf07fe1f..a5194bc551 100644 --- a/sklearnex/dispatcher.py +++ b/sklearnex/dispatcher.py @@ -1,5 +1,6 @@ # ============================================================================== # Copyright 2021 Intel Corporation +# Copyright 2024 Fujitsu Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -22,7 +23,7 @@ def _is_new_patching_available(): - return os.environ.get("OFF_ONEDAL_IFACE") is None and daal_check_version( + return os.environ.get("OFF_ONEDAL_IFACE", "0") == "0" and daal_check_version( (2021, "P", 300) )