Skip to content

Conversation

vlad-perevezentsev
Copy link
Collaborator

This PR will add a get_backend method for the SyclEventRaw class which returns the backend enum.

@coveralls
Copy link
Collaborator

Coverage Status

Coverage increased (+1.2%) to 66.289% when pulling 18cd26d on vlad-perevezentsev:cython_getbackend into e5c50ea on IntelPython:master.

@oleksandr-pavlyk oleksandr-pavlyk changed the base branch from master to refactor/SyclEvent August 11, 2021 15:28
@oleksandr-pavlyk
Copy link
Contributor

Following choices made for other classes, accessing backend info should be implemented using backend property of the class, rather than get_backend method:

In [1]: import dpctl

In [2]: ev = dpctl.SyclEventRaw()

In [3]: !git log -1
commit 2a9d56ff46703e82a1702da57cc07f2fb66cddaf (HEAD -> cython_getbackend, vlad/cython_getbackend)
Merge: 18cd26d 414de9c
Author: << elided >>
Date:   Wed Aug 11 12:15:46 2021 -0500

    Merge branch 'refactor/SyclEvent' into cython_getbackend

In [4]: ev.backend
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-4-4c072d4c7aeb> in <module>
----> 1 ev.backend

AttributeError: 'dpctl._sycl_event.SyclEventRaw' object has no attribute 'backend'

In [5]: ev.get_backend()
Out[5]: <backend_type.host: 3>

In [6]: d = dpctl.SyclDevice() # compare 

In [7]: d.backend
Out[7]: <backend_type.level_zero: 4>

Copy link
Contributor

@oleksandr-pavlyk oleksandr-pavlyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please implement access to backend using SyclEventRaw.backend readonly property

@@ -222,3 +224,19 @@ cdef class SyclEventRaw(_SyclEventRaw):
return event_status_type.complete
else:
raise ValueError("Unknown event status.")

@property
def get_backend(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def get_backend(self):
def backend(self):

Copy link
Contributor

@oleksandr-pavlyk oleksandr-pavlyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@oleksandr-pavlyk oleksandr-pavlyk merged commit aae8461 into IntelPython:refactor/SyclEvent Aug 16, 2021
vlad-perevezentsev added a commit to vlad-perevezentsev/dpctl that referenced this pull request Aug 23, 2021
@vlad-perevezentsev vlad-perevezentsev deleted the cython_getbackend branch June 20, 2023 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants