Tpetra Matrix/Vector Services  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
Tpetra_Details_MultiVectorDistObjectKernels_def.hpp
00001 /*
00002 // @HEADER
00003 // ***********************************************************************
00004 //
00005 //          Tpetra: Templated Linear Algebra Services Package
00006 //                 Copyright (2008) Sandia Corporation
00007 //
00008 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00009 // the U.S. Government retains certain rights in this software.
00010 //
00011 // Redistribution and use in source and binary forms, with or without
00012 // modification, are permitted provided that the following conditions are
00013 // met:
00014 //
00015 // 1. Redistributions of source code must retain the above copyright
00016 // notice, this list of conditions and the following disclaimer.
00017 //
00018 // 2. Redistributions in binary form must reproduce the above copyright
00019 // notice, this list of conditions and the following disclaimer in the
00020 // documentation and/or other materials provided with the distribution.
00021 //
00022 // 3. Neither the name of the Corporation nor the names of the
00023 // contributors may be used to endorse or promote products derived from
00024 // this software without specific prior written permission.
00025 //
00026 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00027 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00028 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00029 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00030 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00031 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00032 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00033 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00034 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00035 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00036 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00037 //
00038 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
00039 //
00040 // ************************************************************************
00041 // @HEADER
00042 */
00043 
00044 #ifndef TPETRA_DETAILS_MULTI_VECTOR_DIST_OBJECT_KERNELS_DEF_HPP
00045 #define TPETRA_DETAILS_MULTI_VECTOR_DIST_OBJECT_KERNELS_DEF_HPP
00046 
00047 #include "Tpetra_ConfigDefs.hpp"
00048 #if TPETRA_USE_KOKKOS_DISTOBJECT
00049 
00050 namespace Tpetra {
00051 namespace Details {
00052 
00054 
00055 template <typename Scalar, typename LocalOrdinal, typename Device>
00056 void
00057 PackArraySingleColumnConstantStride<Scalar,LocalOrdinal,Device>::
00058 pack() {
00059   Kokkos::parallel_for( exportLIDs.size(), *this );
00060 }
00061 
00063 
00064 template <typename Scalar, typename LocalOrdinal, typename Device>
00065 void
00066 PackArraySingleColumnOffset<Scalar,LocalOrdinal,Device>::
00067 pack() {
00068   Kokkos::parallel_for( exportLIDs.size(), *this );
00069 }
00070 
00072 
00073 template <typename Scalar, typename LocalOrdinal, typename Device>
00074 void
00075 PackArrayMultiColumnConstantStride<Scalar,LocalOrdinal,Device>::
00076 pack() {
00077   Kokkos::parallel_for( exportLIDs.size(), *this );
00078 }
00079 
00081 
00082 template <typename Scalar, typename LocalOrdinal, typename Device>
00083 void
00084 PackArrayMultiColumnVariableStride<Scalar,LocalOrdinal,Device>::
00085 pack() {
00086   Kokkos::parallel_for( exportLIDs.size(), *this );
00087 }
00088 
00090 
00091 template <typename Scalar, typename LocalOrdinal, typename Op, typename Device>
00092 void
00093 UnpackArrayMultiColumnConstantStride<Scalar,LocalOrdinal,Op,Device>::
00094 unpack() {
00095   Kokkos::parallel_for( importLIDs.size(), *this );
00096 }
00097 
00099 
00100 template <typename Scalar, typename LocalOrdinal, typename Op, typename Device>
00101 void
00102 UnpackArrayMultiColumnVariableStride<Scalar,LocalOrdinal,Op,Device>::
00103 unpack() {
00104   Kokkos::parallel_for( importLIDs.size(), *this );
00105 }
00106 
00108 
00109 template <typename Scalar, typename LocalOrdinal, typename Device>
00110 void
00111 PermuteArrayMultiColumnConstantStride<Scalar,LocalOrdinal,Device>::
00112 permute() {
00113   const size_type numPermuteLIDs =
00114     std::min (permuteToLIDs.size (), permuteFromLIDs.size ());
00115   Kokkos::parallel_for( numPermuteLIDs, *this );
00116 }
00117 
00119 
00120 template <typename Scalar, typename LocalOrdinal, typename Device>
00121 void
00122 PermuteArrayMultiColumnVariableStride<Scalar,LocalOrdinal,Device>::
00123 permute() {
00124   const size_type numPermuteLIDs =
00125     std::min (permuteToLIDs.size (), permuteFromLIDs.size ());
00126   Kokkos::parallel_for( numPermuteLIDs, *this );
00127 }
00128 
00129 #define PACK_KERNELS_INSTANT(SC,LO,DE) \
00130   template class PackArraySingleColumnConstantStride< SC, LO, DE >; \
00131   template class PackArraySingleColumnOffset< SC, LO, DE >; \
00132   template class PackArrayMultiColumnConstantStride< SC, LO, DE >; \
00133   template class PackArrayMultiColumnVariableStride< SC, LO, DE >;
00134 
00135 #define UNPACK_KERNELS_INSTANT(SC,LO,OP,DE) \
00136   template class UnpackArrayMultiColumnConstantStride< SC, LO, OP, DE >; \
00137   template class UnpackArrayMultiColumnVariableStride< SC, LO, OP, DE >;
00138 
00139 #define PERM_KERNELS_INSTANT(SC,LO,DE) \
00140   template class PermuteArrayMultiColumnConstantStride< SC, LO, DE >; \
00141   template class PermuteArrayMultiColumnVariableStride< SC, LO, DE >;
00142 
00143 #define KERNELS_INSTANT(SC,LO,DE)               \
00144   PACK_KERNELS_INSTANT(SC,LO,DE)                \
00145   PERM_KERNELS_INSTANT(SC,LO,DE)                \
00146   UNPACK_KERNELS_INSTANT(SC,LO,InsertOp,DE)     \
00147   UNPACK_KERNELS_INSTANT(SC,LO,AddOp,DE)        \
00148   UNPACK_KERNELS_INSTANT(SC,LO,AbsMaxOp,DE)
00149 
00150 } // Details namespace
00151 } // Tpetra namespace
00152 
00153 #endif // TPETRA_USE_KOKKOS_DISTOBJECT
00154 
00155 #endif // TPETRA_DETAILS_MULTI_VECTOR_DIST_OBJECT_KERNELS_DEF_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines