Celeritas
0.5.0-86+4a8eea4
|
Keep track of kernels and launches. More...
#include <KernelRegistry.hh>
Public Member Functions | |
KernelProfiling * | insert (std::string_view name, KernelAttributes &&attrs) |
Add a new kernel definition to the list. | |
KernelId::size_type | num_kernels () const |
Number of kernel diagnostics available. More... | |
KernelMetadata const & | kernel (KernelId id) const |
Get the kernel metadata for a given ID. More... | |
Static Public Member Functions | |
static bool | profiling () |
Whether to record potentially expensive kernel profiling information. More... | |
Keep track of kernels and launches.
Every "insert" creates a unique KernelMetadata
entry in a thread-safe fashion (in case multiple threads are launching kernels for the first time). Thus every kernel added to the registry needs a static
local data (i.e., KernelParamCalculator
) to track whether the kernel has been added and to keep a reference to the returned profiling data counter. Kernels are always added sequentially and can never be removed from the registry once added. Kernels that share the same name will create independent entries!
This class has a thread-safe methods because it's meant to be shared across multiple threads when running. Generally insert
is the only method expected to have contention across threads.
auto celeritas::KernelRegistry::kernel | ( | KernelId | id | ) | const |
Get the kernel metadata for a given ID.
KernelId::size_type celeritas::KernelRegistry::num_kernels | ( | ) | const |
Number of kernel diagnostics available.
|
static |
Whether to record potentially expensive kernel profiling information.
This is true if CELERITAS_DEBUG
is set or if the CELER_PROFILE_DEVICE
environment variable exists and is not empty.