Tpetra parallel linear algebra  Version of the Day
Tpetra_Details_MultiVectorDistObjectKernels_def.hpp
1 /*
2 // @HEADER
3 // ***********************************************************************
4 //
5 // Tpetra: Templated Linear Algebra Services Package
6 // Copyright (2008) Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
39 //
40 // ************************************************************************
41 // @HEADER
42 */
43 
44 #ifndef TPETRA_DETAILS_MULTI_VECTOR_DIST_OBJECT_KERNELS_DEF_HPP
45 #define TPETRA_DETAILS_MULTI_VECTOR_DIST_OBJECT_KERNELS_DEF_HPP
46 
47 #include "Tpetra_ConfigDefs.hpp"
48 #if TPETRA_USE_KOKKOS_DISTOBJECT
49 
50 namespace Tpetra {
51 namespace Details {
52 
54 
55 template <typename Scalar, typename LocalOrdinal, typename Device>
56 void
57 PackArraySingleColumnConstantStride<Scalar,LocalOrdinal,Device>::
58 pack() {
59  Kokkos::parallel_for( exportLIDs.size(), *this );
60 }
61 
63 
64 template <typename Scalar, typename LocalOrdinal, typename Device>
65 void
66 PackArraySingleColumnOffset<Scalar,LocalOrdinal,Device>::
67 pack() {
68  Kokkos::parallel_for( exportLIDs.size(), *this );
69 }
70 
72 
73 template <typename Scalar, typename LocalOrdinal, typename Device>
74 void
75 PackArrayMultiColumnConstantStride<Scalar,LocalOrdinal,Device>::
76 pack() {
77  Kokkos::parallel_for( exportLIDs.size(), *this );
78 }
79 
81 
82 template <typename Scalar, typename LocalOrdinal, typename Device>
83 void
84 PackArrayMultiColumnVariableStride<Scalar,LocalOrdinal,Device>::
85 pack() {
86  Kokkos::parallel_for( exportLIDs.size(), *this );
87 }
88 
90 
91 template <typename Scalar, typename LocalOrdinal, typename Op, typename Device>
92 void
93 UnpackArrayMultiColumnConstantStride<Scalar,LocalOrdinal,Op,Device>::
94 unpack() {
95  Kokkos::parallel_for( importLIDs.size(), *this );
96 }
97 
99 
100 template <typename Scalar, typename LocalOrdinal, typename Op, typename Device>
101 void
102 UnpackArrayMultiColumnVariableStride<Scalar,LocalOrdinal,Op,Device>::
103 unpack() {
104  Kokkos::parallel_for( importLIDs.size(), *this );
105 }
106 
108 
109 template <typename Scalar, typename LocalOrdinal, typename Device>
110 void
111 PermuteArrayMultiColumnConstantStride<Scalar,LocalOrdinal,Device>::
112 permute() {
113  const size_type numPermuteLIDs =
114  std::min (permuteToLIDs.size (), permuteFromLIDs.size ());
115  Kokkos::parallel_for( numPermuteLIDs, *this );
116 }
117 
119 
120 template <typename Scalar, typename LocalOrdinal, typename Device>
121 void
122 PermuteArrayMultiColumnVariableStride<Scalar,LocalOrdinal,Device>::
123 permute() {
124  const size_type numPermuteLIDs =
125  std::min (permuteToLIDs.size (), permuteFromLIDs.size ());
126  Kokkos::parallel_for( numPermuteLIDs, *this );
127 }
128 
129 #define PACK_KERNELS_INSTANT(SC,LO,DE) \
130  template class PackArraySingleColumnConstantStride< SC, LO, DE >; \
131  template class PackArraySingleColumnOffset< SC, LO, DE >; \
132  template class PackArrayMultiColumnConstantStride< SC, LO, DE >; \
133  template class PackArrayMultiColumnVariableStride< SC, LO, DE >;
134 
135 #define UNPACK_KERNELS_INSTANT(SC,LO,OP,DE) \
136  template class UnpackArrayMultiColumnConstantStride< SC, LO, OP, DE >; \
137  template class UnpackArrayMultiColumnVariableStride< SC, LO, OP, DE >;
138 
139 #define PERM_KERNELS_INSTANT(SC,LO,DE) \
140  template class PermuteArrayMultiColumnConstantStride< SC, LO, DE >; \
141  template class PermuteArrayMultiColumnVariableStride< SC, LO, DE >;
142 
143 #define KERNELS_INSTANT(SC,LO,DE) \
144  PACK_KERNELS_INSTANT(SC,LO,DE) \
145  PERM_KERNELS_INSTANT(SC,LO,DE) \
146  UNPACK_KERNELS_INSTANT(SC,LO,InsertOp,DE) \
147  UNPACK_KERNELS_INSTANT(SC,LO,AddOp,DE) \
148  UNPACK_KERNELS_INSTANT(SC,LO,AbsMaxOp,DE)
149 
150 } // Details namespace
151 } // Tpetra namespace
152 
153 #endif // TPETRA_USE_KOKKOS_DISTOBJECT
154 
155 #endif // TPETRA_DETAILS_MULTI_VECTOR_DIST_OBJECT_KERNELS_DEF_HPP
Namespace Tpetra contains the class and methods constituting the Tpetra library.
Implementation details of Tpetra.