Skip to content
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

Using set_event_callback #25

Closed
itayw opened this issue Aug 7, 2021 · 3 comments
Closed

Using set_event_callback #25

itayw opened this issue Aug 7, 2021 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@itayw
Copy link

itayw commented Aug 7, 2021

Firstly, thank you very much for this library, I'm new to both Rust and OpenCL and find this library with its tests and examples as a great resource.

I'm trying to use set_event_callback from opencl3/cl3 but cannot find any documentation or examples on how this can be done. Can you please point me to a doc/test if one is available for this?

My goal is for my code to be able to run kernel executions repeatedly while utilizing the GPUs to the maximum possible. So my plan was to avoid blocking actions in the execution path and use event callbacks in order to determine when the kernel execution has been completed. Once it completes, I can flag it and allow my code to start a new execution again. As I mentioned I'm new to this, so maybe what I'm trying to achieve is not possible.

kenba added a commit that referenced this issue Aug 7, 2021
@kenba kenba self-assigned this Aug 7, 2021
@kenba kenba added the enhancement New feature or request label Aug 7, 2021
@kenba
Copy link
Owner

kenba commented Aug 7, 2021

Thank you Itay, I'm glad to hear that you find the library useful.

I'm sorry about the lack of a call to set_event_callback from opencl3, that was an oversight by me.

I've added a new method set_callback to the opencl3 Event struct and I've also added an example in test_event to show how it can be used to call a callback function. They are in the develop branch. Please let me know if you have any problems with them.

BTW, set_callback calls the OpenCL clSetEventCallback function.

As for your goal, it may be easier to achieve using OpenCL event lists to wait_for_events (see, clWaitForEvents) than by using callback functions.

@itayw
Copy link
Author

itayw commented Aug 8, 2021 via email

@kenba
Copy link
Owner

kenba commented Aug 10, 2021

Thank you Itay, if you are happy with the new method then please feel free to close this issue.

@itayw itayw closed this as completed Aug 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants