Actual source code: kernels.hpp

  1: #ifndef PETSC_DEVICE_CUPM_KERNELS_HPP
  2: #define PETSC_DEVICE_CUPM_KERNELS_HPP

  4: #include <petscdevice_cupm.h>

  6: #if defined(__cplusplus)

  8: namespace Petsc
  9: {

 11: namespace device
 12: {

 14: namespace cupm
 15: {

 17: namespace kernels
 18: {

 20: namespace util
 21: {

 23: template <typename SizeType, typename T>
 24: PETSC_DEVICE_INLINE_DECL static void grid_stride_1D(const SizeType size, T &&func) noexcept
 25: {
 26:   for (SizeType i = blockIdx.x * blockDim.x + threadIdx.x; i < size; i += blockDim.x * gridDim.x) func(i);
 27:   return;
 28: }

 30: } // namespace util

 32: } // namespace kernels

 34: } // namespace cupm

 36: } // namespace device

 38: } // namespace Petsc

 40: #endif // __cplusplus

 42: #endif // PETSC_DEVICE_CUPM_KERNELS_HPP