Skip to content

Commit

Permalink
Change 'host' to 'cpu' in sycl_execution_content (#1064)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
2 people authored and napetrov committed Dec 15, 2022
1 parent fd458ae commit 81559dd
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .circleci/run_xpu_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
'-d', '--device',
type=str,
help='device name',
choices=['host', 'cpu', 'gpu']
choices=['cpu', 'gpu']
)
parser.add_argument(
'--deselect',
Expand Down
4 changes: 2 additions & 2 deletions daal4py/sklearn/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
1 change: 0 additions & 1 deletion examples/daal4py/run_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions examples/daal4py/sycl/sklearn_sycl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'


Expand Down
2 changes: 1 addition & 1 deletion onedal/common/_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 1 addition & 3 deletions onedal/common/policy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ONEDAL_PY_INIT_MODULE(policy) {
py::class_<detail::host_policy>(m, "host_policy")
.def(py::init())
.def("get_device_name", [](const detail::host_policy& self) {
return "host";
return "cpu";
});

#ifdef ONEDAL_DATA_PARALLEL
Expand All @@ -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";
});
Expand Down
2 changes: 1 addition & 1 deletion onedal/datatypes/data_conversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static dal::array<T> transfer_to_host(const dal::array<T>& 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());
Expand Down
3 changes: 1 addition & 2 deletions sklearnex/_device_offload.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion sklearnex/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 81559dd

Please sign in to comment.