Skip to content

Commit 4012c98

Browse files
authored
Tests are crashing if no default device (#1311)
1 parent d7219e2 commit 4012c98

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

dpnp/backend/src/queue_sycl.hpp

+7
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,13 @@ class backend_sycl
137137
#else
138138
// temporal solution. Started from Sept-2020
139139
DPCTLSyclQueueRef DPCtrl_queue = DPCTLQueueMgr_GetCurrentQueue();
140+
if (DPCtrl_queue == nullptr)
141+
{
142+
std::string reason = (DPCTLQueueMgr_GetQueueStackSize() == static_cast<size_t>(-1))
143+
? ": the queue stack is empty, probably no device is available."
144+
: ".";
145+
throw std::runtime_error("Failed to create a copy of SYCL queue with default device" + reason);
146+
}
140147
return *(reinterpret_cast<sycl::queue*>(DPCtrl_queue));
141148
#endif
142149
}

dpnp/dpnp_algo/dpnp_algo.pxd

+1-1
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ cdef extern from "constants.hpp":
391391

392392
cdef extern from "dpnp_iface.hpp":
393393
void dpnp_queue_initialize_c(QueueOptions selector)
394-
size_t dpnp_queue_is_cpu_c()
394+
size_t dpnp_queue_is_cpu_c() except +
395395

396396
char * dpnp_memory_alloc_c(size_t size_in_bytes) except +
397397
void dpnp_memory_free_c(void * ptr)

0 commit comments

Comments
 (0)