Advanced Multi-Physics (AMP)
On-Line Documentation
CSRLocalMatrixOperationsKokkos.h
Go to the documentation of this file.
1#ifndef included_CSRLocalMatrixOperationsKokkos_H_
2#define included_CSRLocalMatrixOperationsKokkos_H_
3
4#include "AMP/matrices/operations/MatrixOperations.h"
5
6#include <type_traits>
7
8#ifdef AMP_USE_KOKKOS
9
10 #include "Kokkos_Core.hpp"
11
12namespace AMP::LinearAlgebra {
13
14template<typename Config, class ExecSpace, class ViewSpace>
15class CSRLocalMatrixOperationsKokkos
16{
17public:
18 static_assert( std::is_same_v<typename Config::allocator_type::value_type, void> );
19
20 using config_type = Config;
21 using allocator_type = typename Config::allocator_type;
22 using localmatrixdata_t = CSRLocalMatrixData<Config>;
23
24 using gidx_t = typename Config::gidx_t;
25 using lidx_t = typename Config::lidx_t;
26 using scalar_t = typename Config::scalar_t;
27
28 CSRLocalMatrixOperationsKokkos( const ExecSpace &exec_space ) : d_exec_space( exec_space ) {}
29
36 void mult( const scalar_t *in,
37 const scalar_t alpha,
38 std::shared_ptr<localmatrixdata_t> A,
39 const scalar_t beta,
40 scalar_t *out );
41
48 void multTranspose( const scalar_t *in, std::shared_ptr<localmatrixdata_t> A, scalar_t *out );
49
55 void scale( scalar_t alpha, std::shared_ptr<localmatrixdata_t> A );
56
63 void scale( scalar_t alpha, const scalar_t *D, std::shared_ptr<localmatrixdata_t> A );
64
71 void scaleInv( scalar_t alpha, const scalar_t *D, std::shared_ptr<localmatrixdata_t> A );
72
78 void matMatMult( std::shared_ptr<localmatrixdata_t>,
79 std::shared_ptr<localmatrixdata_t>,
80 std::shared_ptr<localmatrixdata_t> );
81
88 void axpy( scalar_t alpha,
89 std::shared_ptr<localmatrixdata_t> X,
90 std::shared_ptr<localmatrixdata_t> Y );
91
96 void setScalar( scalar_t alpha, std::shared_ptr<localmatrixdata_t> A );
97
102 void zero( std::shared_ptr<localmatrixdata_t> A );
103
108 void setDiagonal( const scalar_t *in, std::shared_ptr<localmatrixdata_t> A );
109
114 void extractDiagonal( std::shared_ptr<localmatrixdata_t> A, scalar_t *buf );
115
120 void
121 getRowSums( std::shared_ptr<localmatrixdata_t> A, scalar_t *buf, const bool zero_first ) const;
122
127 void getRowSumsAbsolute( std::shared_ptr<localmatrixdata_t> A,
128 scalar_t *buf,
129 const bool zero_first ) const;
130
134 void setIdentity( std::shared_ptr<localmatrixdata_t> A );
135
141 void copy( std::shared_ptr<const localmatrixdata_t> X, std::shared_ptr<localmatrixdata_t> Y );
142
148 template<typename ConfigIn>
149 static void copyCast( std::shared_ptr<CSRLocalMatrixData<ConfigIn>> X,
150 std::shared_ptr<localmatrixdata_t> Y );
151
152protected:
153 ExecSpace d_exec_space;
154};
155
156} // namespace AMP::LinearAlgebra
157
158#endif
159
160#endif
#define X(C)
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)



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:40.
Comments on this page