Celeritas  0.5.0-56+6b053cd
Classes | Macros
KernelParamCalculator.device.hh File Reference
#include <cstddef>
#include <string_view>
#include "corecel/DeviceRuntimeApi.hh"
#include "corecel/Assert.hh"
#include "corecel/Macros.hh"
#include "corecel/OpaqueId.hh"
#include "corecel/Types.hh"
#include "corecel/math/Algorithms.hh"
#include "Device.hh"
#include "KernelAttributes.hh"
#include "ThreadId.hh"
This graph shows which files directly or indirectly include this file:

Classes

class  celeritas::KernelParamCalculator
 Kernel management helper functions. More...
 
struct  celeritas::KernelParamCalculator::LaunchParams
 Parameters needed for a CUDA lauch call. More...
 

Macros

#define CELER_LAUNCH_KERNEL(NAME, THREADS, STREAM, ...)
 Create a kernel param calculator with the given kernel, assuming the function itself has a _kernel suffix, and launch with the given block/thread sizes and arguments list. More...
 
#define CELER_LAUNCH_KERNEL_TEMPLATE_1(NAME, T1, THREADS, STREAM, ...)
 Create a kernel param calculator with the given kernel with one template parameter, assuming the unction itself has a _kernel suffix, and launch with the given block/thread sizes and arguments list. More...
 
#define CELER_LAUNCH_KERNEL_IMPL(KERNEL, GRID, BLOCK, SHARED, STREAM, ...)
 

Macro Definition Documentation

◆ CELER_LAUNCH_KERNEL

#define CELER_LAUNCH_KERNEL (   NAME,
  THREADS,
  STREAM,
  ... 
)
Value:
do \
{ \
static const ::celeritas::KernelParamCalculator calc_launch_params_( \
#NAME, NAME##_kernel); \
auto grid_ = calc_launch_params_(THREADS); \
\
CELER_LAUNCH_KERNEL_IMPL(NAME##_kernel, \
grid_.blocks_per_grid, \
grid_.threads_per_block, \
0, \
STREAM, \
__VA_ARGS__); \
CELER_DEVICE_CHECK_ERROR(); \
} while (0)

Create a kernel param calculator with the given kernel, assuming the function itself has a _kernel suffix, and launch with the given block/thread sizes and arguments list.

◆ CELER_LAUNCH_KERNEL_IMPL

#define CELER_LAUNCH_KERNEL_IMPL (   KERNEL,
  GRID,
  BLOCK,
  SHARED,
  STREAM,
  ... 
)
Value:
CELER_NOT_CONFIGURED("CUDA or HIP"); \
CELER_DISCARD(GRID) \
CELER_DISCARD(KERNEL) \
CELER_DISCARD(__VA_ARGS__);
#define CELER_NOT_CONFIGURED(WHAT)
Assert if the code point is reached because an optional feature is disabled.
Definition: Assert.hh:244

◆ CELER_LAUNCH_KERNEL_TEMPLATE_1

#define CELER_LAUNCH_KERNEL_TEMPLATE_1 (   NAME,
  T1,
  THREADS,
  STREAM,
  ... 
)
Value:
do \
{ \
static const ::celeritas::KernelParamCalculator calc_launch_params_( \
#NAME, NAME##_kernel<T1>); \
auto grid_ = calc_launch_params_(THREADS); \
\
CELER_LAUNCH_KERNEL_IMPL(NAME##_kernel<T1>, \
grid_.blocks_per_grid, \
grid_.threads_per_block, \
0, \
STREAM, \
__VA_ARGS__); \
CELER_DEVICE_CHECK_ERROR(); \
} while (0)

Create a kernel param calculator with the given kernel with one template parameter, assuming the unction itself has a _kernel suffix, and launch with the given block/thread sizes and arguments list.