Skip to content

pybind11 type caster to sycl::queue, sycl::device handle None #773

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions dpctl/apis/include/dpctl4pybind11.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,12 @@ template <> struct type_caster<sycl::queue>
value = *q;
return true;
}
else if (source == Py_None) {
value = sycl::queue{};
return true;
}
else {
throw std::runtime_error(
throw py::type_error(
"Input is of unexpected type, expected dpctl.SyclQueue");
}
}
Expand Down Expand Up @@ -87,8 +91,12 @@ template <> struct type_caster<sycl::device>
value = *d;
return true;
}
else if (source == Py_None) {
value = sycl::device{};
return true;
}
else {
throw std::runtime_error(
throw py::type_error(
"Input is of unexpected type, expected dpctl.SyclDevice");
}
}
Expand Down Expand Up @@ -120,7 +128,7 @@ template <> struct type_caster<sycl::context>
return true;
}
else {
throw std::runtime_error(
throw py::type_error(
"Input is of unexpected type, expected dpctl.SyclContext");
}
}
Expand Down Expand Up @@ -153,7 +161,7 @@ template <> struct type_caster<sycl::event>
return true;
}
else {
throw std::runtime_error(
throw py::type_error(
"Input is of unexpected type, expected dpctl.SyclEvent");
}
}
Expand Down