Morpheus 1.0.0
Dynamic matrix type and algorithms for sparse matrices
Loading...
Searching...
No Matches
Coo/Kernels/Morpheus_MatrixOperations_Impl.hpp
1
24#ifndef MORPHEUS_COO_KERNELS_MATRIXOPERATIONS_IMPL_HPP
25#define MORPHEUS_COO_KERNELS_MATRIXOPERATIONS_IMPL_HPP
26
27#include <Morpheus_Macros.hpp>
28#if defined(MORPHEUS_ENABLE_CUDA) || defined(MORPHEUS_ENABLE_HIP)
29
30namespace Morpheus {
31namespace Impl {
32
33namespace Kernels {
34template <typename ValueType, typename IndexType, typename SizeType>
35__global__ void update_coo_diagonal_kernel(const SizeType nnnz,
36 const IndexType* I,
37 const IndexType* J, ValueType* V,
38 const ValueType* diagonal) {
39 const SizeType tid = blockDim.x * blockIdx.x + threadIdx.x;
40 if (tid >= nnnz) return;
41
42 if (I[tid] == J[tid]) V[tid] = diagonal[J[tid]];
43}
44
45} // namespace Kernels
46} // namespace Impl
47} // namespace Morpheus
48
49#endif // MORPHEUS_ENABLE_CUDA || MORPHEUS_ENABLE_HIP
50#endif // MORPHEUS_COO_KERNELS_MATRIXOPERATIONS_IMPL_HPP
Generic Morpheus interfaces.
Definition: dummy.cpp:24