1 #ifndef PETSC_DEVICE_CUPM_KERNELS_HPP 2 #define PETSC_DEVICE_CUPM_KERNELS_HPP 3 4 #include <petscdevice_cupm.h> 5 6 #if defined(__cplusplus) 7 8 namespace Petsc 9 { 10 11 namespace device 12 { 13 14 namespace cupm 15 { 16 17 namespace kernels 18 { 19 20 namespace util 21 { 22 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 } 29 30 } // namespace util 31 32 } // namespace kernels 33 34 } // namespace cupm 35 36 } // namespace device 37 38 } // namespace Petsc 39 40 #endif // __cplusplus 41 42 #endif // PETSC_DEVICE_CUPM_KERNELS_HPP 43