Skip to content

Commit

Permalink
Execute body of host_task if main interpreter is still initialized (#776
Browse files Browse the repository at this point in the history
)
  • Loading branch information
oleksandr-pavlyk authored Feb 11, 2022
1 parent e5789bf commit 902fa01
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dpctl/_host_task_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ int async_dec_ref(DPCTLSyclQueueRef QRef,
*(reinterpret_cast<sycl::event *>(ERefs[ev_id])));
}
cgh.host_task([obj_array_size, obj_vec]() {
{
// if the main thread has not finilized the interpreter yet
if (Py_IsInitialized()) {
PyGILState_STATE gstate;
gstate = PyGILState_Ensure();
for (size_t i = 0; i < obj_array_size; ++i) {
Expand Down

0 comments on commit 902fa01

Please sign in to comment.