Celeritas  0.5.0-56+6b053cd
Public Member Functions | Static Public Member Functions | List of all members
celeritas::KernelRegistry Class Reference

Keep track of kernels and launches. More...

#include <KernelRegistry.hh>

Public Member Functions

KernelProfilinginsert (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...
 

Detailed Description

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.

Member Function Documentation

◆ kernel()

auto celeritas::KernelRegistry::kernel ( KernelId  id) const

Get the kernel metadata for a given ID.

Todo:
rename to get

◆ num_kernels()

KernelId::size_type celeritas::KernelRegistry::num_kernels ( ) const

Number of kernel diagnostics available.

Todo:
rename to size

◆ profiling()

bool celeritas::KernelRegistry::profiling ( )
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.


The documentation for this class was generated from the following files: