Celeritas 0.7-develop+db9a1d4
Loading...
Searching...
No Matches
Classes | Functions
DeviceEvent.cc File Reference
#include "corecel/DeviceRuntimeApi.hh"
#include "DeviceEvent.hh"
#include <iostream>
#include "corecel/Assert.hh"
#include "corecel/Macros.hh"
#include "Device.hh"
#include "Stream.hh"

Classes

struct  celeritas::DeviceEvent::Impl
 Internal implementation holding the native CUDA/HIP event handle. More...
 

Functions

double celeritas::query_elapsed_time (DeviceEvent const &start, DeviceEvent const &stop)
 Query the device runtime for the elapsed time [s] between two events.
 

Function Documentation

◆ query_elapsed_time()

double celeritas::query_elapsed_time ( DeviceEvent const &  start,
DeviceEvent const &  stop 
)

Query the device runtime for the elapsed time [s] between two events.

Both events must have been constructed with DeviceEvent::with_timing , recorded, and completed: this does not synchronize. If stop (or start ) is still pending, the runtime returns a "not ready" error, which is thrown as a RuntimeError . Sync the later event first (all earlier events on the same stream are then complete). The resolution is about half a microsecond.

Todo:
Return a Quantity -like type with a time unit that is separate from the physics unit system, and use it for the StreamTimer and action/step timer results.