Skip to main content

Module event

Module event 

Source
Expand description

CUDA event management for timing and synchronisation.

Events can be recorded on a stream and used to measure elapsed time between GPU operations or to synchronise streams.

§Timing example

let stream = Stream::new(&ctx)?;
let start = Event::new()?;
let end = Event::new()?;

start.record(&stream)?;
// ... enqueue GPU work on `stream` ...
end.record(&stream)?;
end.synchronize()?;

let ms = Event::elapsed_time(&start, &end)?;
println!("kernel took {ms:.3} ms");

Structs§

Event
A CUDA event for timing and synchronisation.