-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for execution spaces instances #209
Conversation
…streams and rename Pthreads to Threads
…pace and move kokkos.initialize() here
…stance as member variable
…ead of creating new one and remove fence call
…gument to constructor
s1 = cp.cuda.Stream() | ||
s2 = cp.cuda.Stream() | ||
|
||
instance1 = pk.ExecutionSpaceInstance(space, s1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ExecutionSpaceInstance => ExecutionSpace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we are instantiating a stream on top of a space, we could also go with space.make(stream)
. (And potentially have also a version that does not accept a stream but uses a new stream for each call.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That does seem like a better interface. I'll address this in a new PR
if __name__ == "__main__": | ||
space = pk.Cuda | ||
|
||
s1 = cp.cuda.Stream() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use pk.Stream to avoid importing cupy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The motivation here is that users might have pre-existing CuPy code they want to integrate with pykokkos, and this example shows how.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but the example only uses cupy to create streams not to use cupy arrays; would be good to then use cupy for all parts
@@ -311,7 +312,7 @@ def generate_call(operation: str, functor: str, members: PyKokkosMembers, tag: c | |||
call += f"}} else {{ {custom_call} }}" | |||
|
|||
call += generate_copy_back(members) | |||
call += generate_fence_call() | |||
# call += generate_fence_call() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
including a comment to explain the reason this is commented out would be good
class ExecutionSpaceInstance: | ||
""" | ||
An instance of the execution space, corresponding to Cuda/HIP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this only corresponds to streams, should we call it that way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically users can create an instance for OpenMP (which doesn't have streams), although I don't think it does anything right now. Future execution spaces might have use for this and they might not use the terminology "Streams".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stream would at least reflect the current usage. In the future, you could reconsider the name if needed. ExecutionSpaceInstace
sounds like an instance of a class, but then instance of an instance sounds like a meta level. This is something to be discussed in the next pykokkos meeting, but seems unnecessarily complex in my view.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
A few comments for a future PR.
The difference between execution space and execution space instance is confusing: it could be due to names used, so considering switching to Stream for instances.
No description provided.