From 81559dd5061e6218a40afb3335db93f19f596115 Mon Sep 17 00:00:00 2001 From: Alexander Andreev Date: Tue, 22 Nov 2022 15:52:25 +0300 Subject: [PATCH] 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 9bf55d42a02e786eacdf99ac76c674b6bb489a66. Co-authored-by: Samir Nasibli --- .circleci/run_xpu_tests.py | 2 +- daal4py/sklearn/_utils.py | 4 ++-- examples/daal4py/run_examples.py | 1 - examples/daal4py/sycl/sklearn_sycl.py | 4 +--- onedal/common/_policy.py | 2 +- onedal/common/policy.cpp | 4 +--- onedal/datatypes/data_conversion.cpp | 2 +- sklearnex/_device_offload.py | 3 +-- sklearnex/_utils.py | 2 +- 9 files changed, 9 insertions(+), 15 deletions(-) diff --git a/.circleci/run_xpu_tests.py b/.circleci/run_xpu_tests.py index ef91b82540..364b80ecea 100644 --- a/.circleci/run_xpu_tests.py +++ b/.circleci/run_xpu_tests.py @@ -32,7 +32,7 @@ '-d', '--device', type=str, help='device name', - choices=['host', 'cpu', 'gpu'] + choices=['cpu', 'gpu'] ) parser.add_argument( '--deselect', diff --git a/daal4py/sklearn/_utils.py b/daal4py/sklearn/_utils.py index 47aff5d8d2..6528805ecd 100644 --- a/daal4py/sklearn/_utils.py +++ b/daal4py/sklearn/_utils.py @@ -115,13 +115,13 @@ def get_patch_message(s): if 'daal4py.oneapi' in sys.modules: from daal4py.oneapi import _get_device_name_sycl_ctxt dev = _get_device_name_sycl_ctxt() - if dev == 'cpu' or dev == 'host' or dev is None: + if dev == 'cpu' or dev is None: message += 'CPU' elif dev == 'gpu': message += 'GPU' else: raise ValueError(f"Unexpected device name {dev}." - " Supported types are host, cpu and gpu") + " Supported types are cpu and gpu") else: message += 'CPU' diff --git a/examples/daal4py/run_examples.py b/examples/daal4py/run_examples.py index ad7bec3066..14eba0a21b 100755 --- a/examples/daal4py/run_examples.py +++ b/examples/daal4py/run_examples.py @@ -72,7 +72,6 @@ availabe_devices.append("gpu") except RuntimeError: gpu_available = False - availabe_devices.append("host") availabe_devices.append("cpu") #validate that host and cpu devices avaialbe for logging reasons. Examples and #vaidaton logic assumes that host and cpu devices are always available diff --git a/examples/daal4py/sycl/sklearn_sycl.py b/examples/daal4py/sycl/sklearn_sycl.py index 933accc765..c33ded4751 100644 --- a/examples/daal4py/sycl/sklearn_sycl.py +++ b/examples/daal4py/sycl/sklearn_sycl.py @@ -141,15 +141,13 @@ def get_context(device): def device_type_to_str(queue): if queue is None: - return 'host' + return 'cpu' from dpctl import device_type if queue.sycl_device.device_type == device_type.cpu: return 'cpu' if queue.sycl_device.device_type == device_type.gpu: return 'gpu' - if queue.sycl_device.device_type == device_type.host: - return 'host' return 'unknown' diff --git a/onedal/common/_policy.py b/onedal/common/_policy.py index 5d6c51d011..8350874184 100644 --- a/onedal/common/_policy.py +++ b/onedal/common/_policy.py @@ -46,7 +46,7 @@ def __init__(self): if 'daal4py.oneapi' in sys.modules: from daal4py.oneapi import _get_sycl_ctxt, sycl_execution_context self._d4p_context = _get_sycl_ctxt() - self._host_context = sycl_execution_context('host') + self._host_context = sycl_execution_context('cpu') self._host_context.apply() def __del__(self): diff --git a/onedal/common/policy.cpp b/onedal/common/policy.cpp index fd1a925d34..42a117400b 100644 --- a/onedal/common/policy.cpp +++ b/onedal/common/policy.cpp @@ -25,7 +25,7 @@ ONEDAL_PY_INIT_MODULE(policy) { py::class_(m, "host_policy") .def(py::init()) .def("get_device_name", [](const detail::host_policy& self) { - return "host"; + return "cpu"; }); #ifdef ONEDAL_DATA_PARALLEL @@ -43,8 +43,6 @@ ONEDAL_PY_INIT_MODULE(policy) { return "gpu"; } else if (self.get_queue().get_device().is_cpu()) { return "cpu"; - } else if (self.get_queue().get_device().is_host()) { - return "host"; } return "unknown"; }); diff --git a/onedal/datatypes/data_conversion.cpp b/onedal/datatypes/data_conversion.cpp index ebfcd28a0b..00f406afb5 100644 --- a/onedal/datatypes/data_conversion.cpp +++ b/onedal/datatypes/data_conversion.cpp @@ -34,7 +34,7 @@ static dal::array transfer_to_host(const dal::array& array) { auto opt_queue = array.get_queue(); if (opt_queue.has_value()) { auto device = opt_queue->get_device(); - if (!device.is_cpu() && !device.is_host()) { + if (!device.is_cpu()) { const auto* device_data = array.get_data(); auto memory_kind = sycl::get_pointer_type(device_data, opt_queue->get_context()); diff --git a/sklearnex/_device_offload.py b/sklearnex/_device_offload.py index 281854773f..f580acbb7c 100644 --- a/sklearnex/_device_offload.py +++ b/sklearnex/_device_offload.py @@ -37,9 +37,8 @@ def __init__(self, filter_string): self._filter_string = filter_string self.is_cpu = 'cpu' in filter_string self.is_gpu = 'gpu' in filter_string - self.is_host = False - if not (self.is_cpu or self.is_host): + if not (self.is_cpu): import logging logging.warning("Device support is limited. " "Please install dpctl for full experience") diff --git a/sklearnex/_utils.py b/sklearnex/_utils.py index 1cb569c3aa..a03bf774d1 100755 --- a/sklearnex/_utils.py +++ b/sklearnex/_utils.py @@ -47,7 +47,7 @@ def get_patch_message(s, queue=None, cpu_fallback=False): elif 'daal4py.oneapi' in sys.modules: from daal4py.oneapi import _get_device_name_sycl_ctxt dev = _get_device_name_sycl_ctxt() - if dev == 'cpu' or dev == 'host' or dev is None: + if dev == 'cpu' or dev is None: message += 'CPU' elif dev == 'gpu': if cpu_fallback: