From 6bcfbf2ecc25f097ba1ffebf59bb2a67e1b57d49 Mon Sep 17 00:00:00 2001 From: etotmeni Date: Wed, 21 Oct 2020 10:01:59 -0500 Subject: [PATCH 1/2] Change funcs to cpdef --- dpctl/_sycl_core.pxd | 2 ++ dpctl/sycl_core.pyx | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dpctl/_sycl_core.pxd b/dpctl/_sycl_core.pxd index 2d7fbc01fa..06d7a2e2ed 100644 --- a/dpctl/_sycl_core.pxd +++ b/dpctl/_sycl_core.pxd @@ -121,3 +121,5 @@ cdef class SyclQueue: cpdef SyclQueue get_current_queue() +cpdef get_current_device_type () +cpdef get_current_backend() diff --git a/dpctl/sycl_core.pyx b/dpctl/sycl_core.pyx index c9524a1d29..6379742649 100644 --- a/dpctl/sycl_core.pyx +++ b/dpctl/sycl_core.pyx @@ -616,12 +616,12 @@ cdef class _SyclRTManager: """ print(self._backend_str_ty_dict.keys()) - def get_current_backend (self): + cpdef get_current_backend (self): """ Returns the backend for the current queue as `backend_type` enum """ return self.get_current_queue().get_sycl_backend() - def get_current_device_type (self): + cpdef get_current_device_type (self): ''' Returns current device type as `device_type` enum ''' return self.get_current_queue().get_sycl_device().get_device_type() @@ -736,7 +736,6 @@ _mgr = _SyclRTManager() # Global bound functions dump = _mgr.dump -get_current_device_type = _mgr.get_current_device_type get_num_platforms = _mgr.get_num_platforms get_num_activated_queues = _mgr.get_num_activated_queues get_num_queues = _mgr.get_num_queues @@ -750,6 +749,13 @@ cpdef SyclQueue get_current_queue(): ''' Obtain current Sycl Queue from Data Parallel Control package ''' return _mgr.get_current_queue() +cpdef get_current_device_type(): + ''' Obtain current device type from Data Parallel Control package ''' + return _mgr.get_current_device_type() + +cpdef get_current_backend(): + ''' Obtain current backend type from Data Parallel Control package ''' + return _mgr.get_current_backend() def create_program_from_source (SyclQueue q, unicode source, unicode copts=""): ''' Creates a Sycl interoperability program from an OpenCL source string. From a189a04325912d440d0e6a143a0cfd0528c68374 Mon Sep 17 00:00:00 2001 From: etotmeni Date: Wed, 21 Oct 2020 10:01:59 -0500 Subject: [PATCH 2/2] Change funcs to cpdef --- dpctl/_sycl_core.pxd | 2 ++ dpctl/sycl_core.pyx | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dpctl/_sycl_core.pxd b/dpctl/_sycl_core.pxd index 2d7fbc01fa..06d7a2e2ed 100644 --- a/dpctl/_sycl_core.pxd +++ b/dpctl/_sycl_core.pxd @@ -121,3 +121,5 @@ cdef class SyclQueue: cpdef SyclQueue get_current_queue() +cpdef get_current_device_type () +cpdef get_current_backend() diff --git a/dpctl/sycl_core.pyx b/dpctl/sycl_core.pyx index c9524a1d29..6379742649 100644 --- a/dpctl/sycl_core.pyx +++ b/dpctl/sycl_core.pyx @@ -616,12 +616,12 @@ cdef class _SyclRTManager: """ print(self._backend_str_ty_dict.keys()) - def get_current_backend (self): + cpdef get_current_backend (self): """ Returns the backend for the current queue as `backend_type` enum """ return self.get_current_queue().get_sycl_backend() - def get_current_device_type (self): + cpdef get_current_device_type (self): ''' Returns current device type as `device_type` enum ''' return self.get_current_queue().get_sycl_device().get_device_type() @@ -736,7 +736,6 @@ _mgr = _SyclRTManager() # Global bound functions dump = _mgr.dump -get_current_device_type = _mgr.get_current_device_type get_num_platforms = _mgr.get_num_platforms get_num_activated_queues = _mgr.get_num_activated_queues get_num_queues = _mgr.get_num_queues @@ -750,6 +749,13 @@ cpdef SyclQueue get_current_queue(): ''' Obtain current Sycl Queue from Data Parallel Control package ''' return _mgr.get_current_queue() +cpdef get_current_device_type(): + ''' Obtain current device type from Data Parallel Control package ''' + return _mgr.get_current_device_type() + +cpdef get_current_backend(): + ''' Obtain current backend type from Data Parallel Control package ''' + return _mgr.get_current_backend() def create_program_from_source (SyclQueue q, unicode source, unicode copts=""): ''' Creates a Sycl interoperability program from an OpenCL source string.