-
Notifications
You must be signed in to change notification settings - Fork 57
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
Figure out a way to make the context API truly safe #2
Comments
My advice is probably checking out some of the other CUDA wrapper implementations for other languages. PyCUDA seems to be the most popular non C/C++ binding set, and I'm sure whatever the Haskell binding is doing will be too safe. Plus, the PyCUDA has some really nifty wrappers to simplify the API that could be used for inspiration. |
Hello, I have an idea for how to make a better Context API.
This macro would expand to:
Inside of the block, the user can use the global context. This same technique is also applicable for |
Another thing to help manage contexts is: CUDA keeps a ref-count for every context. These are exposed as Using this ref-count could make your |
I like what ctrl-z is thinking with with_context!, but a macro can only convert input to public methods. What about using a special guard object to do the pre / post actions?
|
Maybe someone can find a way to make the Context API more safe than it is. I haven't been able to think of anything so far.
The text was updated successfully, but these errors were encountered: