24#ifndef MORPHEUS_DIA_KERNELS_MATRIXOPERATIONS_IMPL_HPP
25#define MORPHEUS_DIA_KERNELS_MATRIXOPERATIONS_IMPL_HPP
27#include <Morpheus_Macros.hpp>
28#if defined(MORPHEUS_ENABLE_CUDA) || defined(MORPHEUS_ENABLE_HIP)
34template <
typename ValueType,
typename IndexType,
typename SizeType>
35__global__
void update_dia_diagonal_kernel(
const SizeType num_rows,
36 const SizeType num_cols,
37 const SizeType num_diagonals,
39 const IndexType* diagonal_offsets,
41 const ValueType* diagonal) {
42 const SizeType thread_id = blockDim.x * blockIdx.x + threadIdx.x;
43 const SizeType grid_size = gridDim.x * blockDim.x;
45 for (SizeType row = thread_id; row < num_rows; row += grid_size) {
46 for (SizeType n = 0; n < num_diagonals; n++) {
47 const IndexType col = row + diagonal_offsets[n];
48 const SizeType idx = row + pitch * n;
50 if ((col >= 0 && col < (IndexType)num_cols) && (col == (IndexType)row)) {
51 values[idx] = (values[idx] == ValueType(0)) ? 0 : diagonal[col];
Generic Morpheus interfaces.
Definition: dummy.cpp:24