Skip to content

Commit 63c2f7b

Browse files
use GetDeviceInfoStr
1 parent fbb3974 commit 63c2f7b

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

dpctl/_backend.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ cdef extern from "dpctl_sycl_device_manager.h":
207207
const DPCTLSyclDeviceRef DRef,
208208
int device_identifier)
209209
cdef size_t DPCTLDeviceMgr_GetNumDevices(int device_identifier)
210-
cdef void DPCTLDeviceMgr_PrintDeviceInfo(const DPCTLSyclDeviceRef DRef)
210+
cdef const char * DPCTLDeviceMgr_GetDeviceInfoStr(const DPCTLSyclDeviceRef DRef)
211211
cdef DPCTLSyclContextRef DPCTLDeviceMgr_GetCachedContext(
212212
const DPCTLSyclDeviceRef DRef)
213213
cdef int64_t DPCTLDeviceMgr_GetRelativeId(const DPCTLSyclDeviceRef DRef)

dpctl/_sycl_device.pyx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ from ._backend cimport ( # noqa: E211
6565
DPCTLDevice_IsCPU,
6666
DPCTLDevice_IsGPU,
6767
DPCTLDevice_IsHost,
68+
DPCTLDeviceMgr_GetDeviceInfoStr,
6869
DPCTLDeviceMgr_GetDevices,
6970
DPCTLDeviceMgr_GetPositionInDevices,
7071
DPCTLDeviceMgr_GetRelativeId,
71-
DPCTLDeviceMgr_PrintDeviceInfo,
7272
DPCTLDeviceSelector_Delete,
7373
DPCTLDeviceSelector_Score,
7474
DPCTLDeviceVector_Delete,
@@ -286,7 +286,12 @@ cdef class SyclDevice(_SyclDevice):
286286
def print_device_info(self):
287287
""" Print information about the SYCL device.
288288
"""
289-
DPCTLDeviceMgr_PrintDeviceInfo(self._device_ref)
289+
cdef const char * info_str = DPCTLDeviceMgr_GetDeviceInfoStr(
290+
self._device_ref
291+
)
292+
py_info = <bytes> info_str
293+
print(py_info.decode("utf-8"))
294+
290295

291296
cdef DPCTLSyclDeviceRef get_device_ref(self):
292297
""" Returns the DPCTLSyclDeviceRef pointer for this class.

0 commit comments

Comments
 (0)