Tpetra parallel linear algebra Version of the Day
Loading...
Searching...
No Matches
Tpetra_Details_MatrixApplyHelper.hpp
1// @HEADER
2// *****************************************************************************
3// Tpetra: Templated Linear Algebra Services Package
4//
5// Copyright 2008 NTESS and the Tpetra contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef TPETRA_MATRIX_APPLY_HELPER_HPP
11#define TPETRA_MATRIX_APPLY_HELPER_HPP
12
13#include "Kokkos_Core.hpp"
14#include "KokkosSparse_spmv_handle.hpp"
15#include "Tpetra_Details_IntRowPtrHelper.hpp"
16
17namespace Tpetra {
18namespace Details {
19
27template <typename LocalMatrix, typename IntLocalMatrix, typename MultiVectorLocalView>
28struct MatrixApplyHelper : public IntRowPtrHelper<LocalMatrix, IntLocalMatrix> {
29 // using Rowptrs = typename LocalMatrix::row_map_type;
30 // using IntRowptrs = typename IntLocalMatrix::row_map_type;
31 using XVectorType = typename MultiVectorLocalView::const_type;
33 using SPMVHandle = KokkosSparse::SPMVHandle<typename LocalMatrix::device_type, LocalMatrix, XVectorType, YVectorType>;
34 using SPMVHandleInt = KokkosSparse::SPMVHandle<typename LocalMatrix::device_type, IntLocalMatrix, XVectorType, YVectorType>;
35
36 MatrixApplyHelper(size_t nnz, const typename LocalMatrix::row_map_type& rowptrs, KokkosSparse::SPMVAlgorithm algo = KokkosSparse::SPMV_DEFAULT)
38 , handle_int(algo) {}
39
40 // SPMVHandles are lazily initialized by actual spmv calls.
41 // We declare both here because we don't know until runtime (based on nnz) which should be used.
42 SPMVHandle handle;
43 SPMVHandleInt handle_int;
44};
45} // namespace Details
46} // namespace Tpetra
47
48#endif // TPETRA_MATRIX_APPLY_HELPER_HPP
Struct that holds views of the contents of a CrsMatrix.
Implementation details of Tpetra.
Namespace Tpetra contains the class and methods constituting the Tpetra library.