1#ifndef included_CSRLocalMatrixOperationsKokkos_H_
2#define included_CSRLocalMatrixOperationsKokkos_H_
4#include "AMP/matrices/operations/MatrixOperations.h"
10 #include "Kokkos_Core.hpp"
14template<
typename Config,
class ExecSpace,
class ViewSpace>
15class CSRLocalMatrixOperationsKokkos
18 static_assert( std::is_same_v<typename Config::allocator_type::value_type, void> );
20 using config_type = Config;
21 using allocator_type =
typename Config::allocator_type;
22 using localmatrixdata_t = CSRLocalMatrixData<Config>;
24 using gidx_t =
typename Config::gidx_t;
25 using lidx_t =
typename Config::lidx_t;
26 using scalar_t =
typename Config::scalar_t;
28 CSRLocalMatrixOperationsKokkos(
const ExecSpace &exec_space ) : d_exec_space( exec_space ) {}
36 void mult(
const scalar_t *in,
38 std::shared_ptr<localmatrixdata_t> A,
48 void multTranspose(
const scalar_t *in, std::shared_ptr<localmatrixdata_t> A, scalar_t *out );
55 void scale( scalar_t alpha, std::shared_ptr<localmatrixdata_t> A );
63 void scale( scalar_t alpha,
const scalar_t *D, std::shared_ptr<localmatrixdata_t> A );
71 void scaleInv( scalar_t alpha,
const scalar_t *D, std::shared_ptr<localmatrixdata_t> A );
78 void matMatMult( std::shared_ptr<localmatrixdata_t>,
79 std::shared_ptr<localmatrixdata_t>,
80 std::shared_ptr<localmatrixdata_t> );
88 void axpy( scalar_t alpha,
89 std::shared_ptr<localmatrixdata_t>
X,
90 std::shared_ptr<localmatrixdata_t> Y );
96 void setScalar( scalar_t alpha, std::shared_ptr<localmatrixdata_t> A );
102 void zero( std::shared_ptr<localmatrixdata_t> A );
108 void setDiagonal(
const scalar_t *in, std::shared_ptr<localmatrixdata_t> A );
114 void extractDiagonal( std::shared_ptr<localmatrixdata_t> A, scalar_t *buf );
121 getRowSums( std::shared_ptr<localmatrixdata_t> A, scalar_t *buf,
const bool zero_first )
const;
127 void getRowSumsAbsolute( std::shared_ptr<localmatrixdata_t> A,
129 const bool zero_first )
const;
134 void setIdentity( std::shared_ptr<localmatrixdata_t> A );
141 void copy( std::shared_ptr<const localmatrixdata_t>
X, std::shared_ptr<localmatrixdata_t> Y );
148 template<
typename ConfigIn>
149 static void copyCast( std::shared_ptr<CSRLocalMatrixData<ConfigIn>>
X,
150 std::shared_ptr<localmatrixdata_t> Y );
153 ExecSpace d_exec_space;
void copy(size_t N, const T1 *src, T2 *dst)
Perform copy with conversion if necessary.
void copyCast(const size_t len, const T1 *vec_in, T2 *vec_out)
void zero(void *dest, std::size_t count)
Perform memory zero (pointer may be in any memory space)