Rust-GPU / Rust-CUDA

Ecosystem of libraries and tools for writing and executing fast GPU code fully in Rust.
Apache License 2.0
3.16k stars 120 forks source link

Sequencing tasks on multiple streams w/ Events #81

Open thedodd opened 2 years ago

thedodd commented 2 years ago

The following doc snippets seem to indicate that this is not yet supported:

Events can also be used to sequence tasks on multiple streams within the same context by specifying dependent tasks (not supported yet by cust). ~ https://docs.rs/cust/latest/cust/event/index.html

and

Sequencing between multiple streams can be achieved using events, which are not currently supported by cust. ~ https://docs.rs/cust/latest/cust/stream/index.html

However, the following bit makes it seem as though it is indeed supported, even across different devices/contexts.

Make the stream wait on an event.

All future work submitted to the stream will wait for the event to complete. Synchronization is performed on the device, if possible. The event may originate from different context or device than the stream. ~ https://docs.rs/cust/latest/cust/stream/struct.Stream.html#method.wait_event

Just wondering what the state of cross-stream/cross-context Event-based synchronization is. I'm happy to just go ahead and test, but I figured I would ask. This seems to be something supported on the Cuda level, not necessarily something which would need to be implemented in cust, but I could be wrong.

Also, if this needs to be implemented, I'm wondering if folks might have some thoughts on current blockers and such?

thedodd commented 2 years ago

Well, just reporting back here based on my initial experimentation.