Tpetra Matrix/Vector Services Version of the Day
Tpetra_CrsMatrixMultiplyOp.cpp
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 #include "Tpetra_CrsMatrixMultiplyOp.hpp"
00045 
00046 #ifdef HAVE_TPETRA_EXPLICIT_INSTANTIATION
00047 
00048 #include <Kokkos_SerialNode.hpp>
00049 #if defined(HAVE_KOKKOSCLASSIC_TBB)
00050 #  include <Kokkos_TBBNode.hpp>
00051 #endif
00052 #if defined(HAVE_KOKKOSCLASSIC_THREADPOOL)
00053 #  include <Kokkos_TPINode.hpp>
00054 #endif
00055 #if defined(HAVE_KOKKOSCLASSIC_OPENMP)
00056 #  include <Kokkos_OpenMPNode.hpp>
00057 #endif
00058 #if defined(HAVE_KOKKOSCLASSIC_CUSPARSE)
00059 #  include <Kokkos_ThrustGPUNode.hpp>
00060 #endif
00061 
00062 #include "Tpetra_CrsMatrixMultiplyOp_def.hpp"
00063 // need this to instantiate CrsMatrix::multiply()
00064 #include "Tpetra_CrsMatrix_def.hpp"
00065 
00066 namespace Tpetra {
00067 
00068   // 
00069   // instantiate all single-scalar implementations; these are needed internally by CrsMatrix
00070   //
00071 
00072 #if defined(HAVE_TPETRA_INST_DOUBLE)
00073   TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(double,double,int,int,Kokkos::SerialNode)
00074 #if defined(HAVE_KOKKOSCLASSIC_TBB)
00075   TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(double,double,int,int,Kokkos::TBBNode)
00076 #endif
00077 #if defined(HAVE_KOKKOSCLASSIC_THREADPOOL)
00078     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(double,double,int,int,Kokkos::TPINode)
00079 #endif
00080 #if defined(HAVE_KOKKOSCLASSIC_OPENMP)
00081     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(double,double,int,int,Kokkos::OpenMPNode)
00082 #endif
00083 #if defined(HAVE_KOKKOSCLASSIC_CUSPARSE) && defined(HAVE_KOKKOSCLASSIC_CUDA_DOUBLE)
00084     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(double,double,int,int,Kokkos::ThrustGPUNode)
00085 #endif
00086 #endif // double
00087 #if defined(HAVE_TPETRA_INST_FLOAT)
00088   TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(float,float,int,int,Kokkos::SerialNode)
00089 #if defined(HAVE_KOKKOSCLASSIC_TBB)
00090   TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(float,float,int,int,Kokkos::TBBNode)
00091 #endif
00092 #if defined(HAVE_KOKKOSCLASSIC_THREADPOOL)
00093     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(float,float,int,int,Kokkos::TPINode)
00094 #endif
00095 #if defined(HAVE_KOKKOSCLASSIC_OPENMP)
00096     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(float,float,int,int,Kokkos::OpenMPNode)
00097 #endif
00098 #if defined(HAVE_KOKKOSCLASSIC_CUSPARSE) && defined(HAVE_KOKKOSCLASSIC_CUDA_FLOAT)
00099     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(float,float,int,int,Kokkos::ThrustGPUNode)
00100 #endif
00101 #endif // float
00102 #if defined(HAVE_TPETRA_INST_COMPLEX_DOUBLE)
00103   TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(std::complex<double>,std::complex<double>,int,int,Kokkos::SerialNode)
00104 #if defined(HAVE_KOKKOSCLASSIC_TBB)
00105   TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(std::complex<double>,std::complex<double>,int,int,Kokkos::TBBNode)
00106 #endif
00107 #if defined(HAVE_KOKKOSCLASSIC_THREADPOOL)
00108     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(std::complex<double>,std::complex<double>,int,int,Kokkos::TPINode)
00109 #endif
00110 #if defined(HAVE_KOKKOSCLASSIC_OPENMP)
00111     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(std::complex<double>,std::complex<double>,int,int,Kokkos::OpenMPNode)
00112 #endif
00113 // not yet supported
00114 // #if defined(HAVE_KOKKOSCLASSIC_CUSPARSE) && defined(HAVE_KOKKOSCLASSIC_CUDA_COMPLEX_DOUBLE)
00115 //     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(std::complex<double>,std::complex<double>,int,int,Kokkos::ThrustGPUNode)
00116 // #endif
00117 #endif // complex double
00118 #if defined(HAVE_TPETRA_INST_COMPLEX_FLOAT)
00119   TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(std::complex<float>,std::complex<float>,int,int,Kokkos::SerialNode)
00120 #if defined(HAVE_KOKKOSCLASSIC_TBB)
00121   TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(std::complex<float>,std::complex<float>,int,int,Kokkos::TBBNode)
00122 #endif
00123 #if defined(HAVE_KOKKOSCLASSIC_THREADPOOL)
00124     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(std::complex<float>,std::complex<float>,int,int,Kokkos::TPINode)
00125 #endif
00126 #if defined(HAVE_KOKKOSCLASSIC_OPENMP)
00127     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(std::complex<float>,std::complex<float>,int,int,Kokkos::OpenMPNode)
00128 #endif
00129 // not yet supported
00130 // #if defined(HAVE_KOKKOSCLASSIC_CUSPARSE) && defined(HAVE_KOKKOSCLASSIC_CUDA_COMPLEX_FLOAT)
00131 //     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(std::complex<float>,std::complex<float>,int,int,Kokkos::ThrustGPUNode)
00132 // #endif
00133 #endif // complex float
00134 
00135 
00136 #ifdef HAVE_TPETRA_INST_INT_LONG
00137 #if defined(HAVE_TPETRA_INST_DOUBLE)
00138   TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(double,double,int,long,Kokkos::SerialNode)
00139 #if defined(HAVE_KOKKOSCLASSIC_TBB)
00140   TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(double,double,int,long,Kokkos::TBBNode)
00141 #endif
00142 #if defined(HAVE_KOKKOSCLASSIC_THREADPOOL)
00143     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(double,double,int,long,Kokkos::TPINode)
00144 #endif
00145 #if defined(HAVE_KOKKOSCLASSIC_OPENMP)
00146     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(double,double,int,long,Kokkos::OpenMPNode)
00147 #endif
00148 #if defined(HAVE_KOKKOSCLASSIC_CUSPARSE) && defined(HAVE_KOKKOSCLASSIC_CUDA_DOUBLE)
00149     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(double,double,int,long,Kokkos::ThrustGPUNode)
00150 #endif
00151 #endif // double
00152 #if defined(HAVE_TPETRA_INST_FLOAT)
00153   TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(float,float,int,long,Kokkos::SerialNode)
00154 #if defined(HAVE_KOKKOSCLASSIC_TBB)
00155   TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(float,float,int,long,Kokkos::TBBNode)
00156 #endif
00157 #if defined(HAVE_KOKKOSCLASSIC_THREADPOOL)
00158     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(float,float,int,long,Kokkos::TPINode)
00159 #endif
00160 #if defined(HAVE_KOKKOSCLASSIC_OPENMP)
00161     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(float,float,int,long,Kokkos::OpenMPNode)
00162 #endif
00163 #if defined(HAVE_KOKKOSCLASSIC_CUSPARSE) && defined(HAVE_KOKKOSCLASSIC_CUDA_FLOAT)
00164     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(float,float,int,long,Kokkos::ThrustGPUNode)
00165 #endif
00166 #endif // float
00167 #if defined(HAVE_TPETRA_INST_COMPLEX_DOUBLE)
00168   TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(std::complex<double>,std::complex<double>,int,long,Kokkos::SerialNode)
00169 #if defined(HAVE_KOKKOSCLASSIC_TBB)
00170   TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(std::complex<double>,std::complex<double>,int,long,Kokkos::TBBNode)
00171 #endif
00172 #if defined(HAVE_KOKKOSCLASSIC_THREADPOOL)
00173     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(std::complex<double>,std::complex<double>,int,long,Kokkos::TPINode)
00174 #endif
00175 #if defined(HAVE_KOKKOSCLASSIC_OPENMP)
00176     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(std::complex<double>,std::complex<double>,int,long,Kokkos::OpenMPNode)
00177 #endif
00178 // not yet supported
00179 // #if defined(HAVE_KOKKOSCLASSIC_CUSPARSE) && defined(HAVE_KOKKOSCLASSIC_CUDA_COMPLEX_DOUBLE)
00180 //     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(std::complex<double>,std::complex<double>,int,long,Kokkos::ThrustGPUNode)
00181 // #endif
00182 #endif // complex double
00183 #if defined(HAVE_TPETRA_INST_COMPLEX_FLOAT)
00184   TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(std::complex<float>,std::complex<float>,int,long,Kokkos::SerialNode)
00185 #if defined(HAVE_KOKKOSCLASSIC_TBB)
00186   TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(std::complex<float>,std::complex<float>,int,long,Kokkos::TBBNode)
00187 #endif
00188 #if defined(HAVE_KOKKOSCLASSIC_THREADPOOL)
00189     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(std::complex<float>,std::complex<float>,int,long,Kokkos::TPINode)
00190 #endif
00191 #if defined(HAVE_KOKKOSCLASSIC_OPENMP)
00192     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(std::complex<float>,std::complex<float>,int,long,Kokkos::OpenMPNode)
00193 #endif
00194 // not yet supported
00195 // #if defined(HAVE_KOKKOSCLASSIC_CUSPARSE) && defined(HAVE_KOKKOSCLASSIC_CUDA_COMPLEX_FLOAT)
00196 //     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(std::complex<float>,std::complex<float>,int,long,Kokkos::ThrustGPUNode)
00197 // #endif
00198 #endif // complex float
00199 #endif // <int,long>
00200 
00201 
00202   // get all cross scalar applications for testing (these should be moved to a
00203   // different file if they are indeed just to support testing)
00204   // double x float
00205 #if defined(HAVE_TPETRA_INST_DOUBLE) && defined(HAVE_TPETRA_INST_FLOAT)
00206   TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(double,float,int,int,Kokkos::SerialNode)
00207   TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(float,double,int,int,Kokkos::SerialNode)
00208 #if defined(HAVE_KOKKOSCLASSIC_TBB)
00209   TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(double,float,int,int,Kokkos::TBBNode)
00210   TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(float,double,int,int,Kokkos::TBBNode)
00211 #endif
00212 #if defined(HAVE_KOKKOSCLASSIC_THREADPOOL)
00213     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(double,float,int,int,Kokkos::TPINode)
00214     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(float,double,int,int,Kokkos::TPINode)
00215 #endif
00216 #if defined(HAVE_KOKKOSCLASSIC_OPENMP)
00217     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(double,float,int,int,Kokkos::OpenMPNode)
00218     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(float,double,int,int,Kokkos::OpenMPNode)
00219 #endif
00220 #if defined(HAVE_KOKKOSCLASSIC_CUSPARSE) && defined(HAVE_KOKKOSCLASSIC_CUDA_FLOAT) && defined(HAVE_KOKKOSCLASSIC_CUDA_DOUBLE)
00221     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(double,float,int,int,Kokkos::ThrustGPUNode)
00222     TPETRA_CRSMATRIX_MULTIPLYOP_INSTANT(float,double,int,int,Kokkos::ThrustGPUNode)
00223 #endif
00224 #endif
00225 
00226 } // namespace Tpetra
00227 
00228 #endif // HAVE_TPETRA_EXPLICIT_INSTANTIATION
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines