Debian Codegraph @

packages/stokhos/src/kokkos/Cuda/Stokhos_Cuda_StochasticProductTensor.hpp

raw
1 // @HEADER
2 // *****************************************************************************
3 // Stokhos Package
4 //
5 // Copyright 2009 NTESS and the Stokhos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9
10 #ifndef STOKHOS_CUDA_STOCHASTICPRODUCTTENSOR_HPP
11 #define STOKHOS_CUDA_STOCHASTICPRODUCTTENSOR_HPP
12
13 #include "Kokkos_Core.hpp"
14
15 #include "Stokhos_Multiply.hpp"
16 #include "Stokhos_BlockCrsMatrix.hpp"
17 #include "Stokhos_StochasticProductTensor.hpp"
18
19 namespace Stokhos {
20
21 //----------------------------------------------------------------------------
22 //----------------------------------------------------------------------------
23
24 template< typename TensorScalar ,
25 typename MatrixScalar ,
26 typename VectorScalar ,
27 typename TensorType >
28 class Multiply<
29 BlockCrsMatrix<
30 StochasticProductTensor<TensorScalar, TensorType, Kokkos::Cuda>,
31 MatrixScalar, Kokkos::Cuda> ,
32 Kokkos::View<VectorScalar**, Kokkos::LayoutLeft, Kokkos::Cuda>,
33 Kokkos::View<VectorScalar**, Kokkos::LayoutLeft, Kokkos::Cuda> >
34 {
35 public:
36
37 typedef Kokkos::Cuda execution_space ;
38 typedef execution_space::size_type size_type ;
39
40 typedef StochasticProductTensor< TensorScalar , TensorType , Kokkos::Cuda > tensor_type ;
41 typedef BlockCrsMatrix< tensor_type, MatrixScalar, execution_space > matrix_type ;
42 typedef Kokkos::View< VectorScalar** , Kokkos::LayoutLeft , Kokkos::Cuda > vector_type ;
43
44
45 static void apply( const matrix_type & A ,
46 const vector_type & x ,
47 const vector_type & y )
48 {
49 typedef BlockCrsMatrix< TensorType, MatrixScalar , Kokkos::Cuda > base_matrix_type ;
50
51 typedef Multiply< base_matrix_type , vector_type , vector_type >
52 base_multiply_type ;
53
54 base_matrix_type base_matrix ;
55
56 base_matrix.values = A.values ;
57 base_matrix.graph = A.graph ;
58 base_matrix.block = A.block.tensor();
59
60 base_multiply_type::apply( base_matrix , x , y );
61 }
62 };
63
64 //----------------------------------------------------------------------------
65 //----------------------------------------------------------------------------
66
67 } // namespace Stokhos
68
69 #endif /* #ifndef STOKHOS_CUDA_STOCHASTICPRODUCTTENSOR_HPP */