|
Tpetra Matrix/Vector Services
Version of the Day
|
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_RowMatrixTransposer.hpp" 00045 00046 #ifdef HAVE_TPETRA_EXPLICIT_INSTANTIATION 00047 00048 #include "Tpetra_ETIHelperMacros.h" 00049 #include "Tpetra_RowMatrixTransposer_def.hpp" 00050 00051 namespace Tpetra { 00052 00053 TPETRA_ETI_MANGLING_TYPEDEFS() 00054 00055 // mfh 21 Jul 2013: Unfortunately, the Tpetra explicit template 00056 // instantiation (ETI) system doesn't currently let us control the 00057 // Scalar types for a specific Node; it attempts to instantiate for 00058 // all supported Scalar types. This is a problem for ThrustGPUNode 00059 // with CUSPARSEOps, since the latter only supports Scalar = void, 00060 // float, or double. I deal with this as follows: 00061 // 00062 // 1. I only instantiate all supported Scalar, LocalOrdinal, and 00063 // GlobalOrdinal combinations for non-GPU Node types. 00064 // 00065 // 2. With Node=ThrustGPUNode, I manually instantiate 00066 // RowMatrixTransposer only for the supported Scalar types. In 00067 // this case, that's Scalar = float and double. (Scalar = void 00068 // is only meaningful for CUSPARSEOps; it's a trick to deal with 00069 // the fact that Tpetra::CrsGraph has to refer to 00070 // CUSPARSEOps<Scalar, ...>, but doesn't have a sensible Scalar 00071 // type other than void.) 00072 00073 // Let Tpetra's ETI system handle non-GPU types. 00074 TPETRA_INSTANTIATE_SLGN_NOGPU(TPETRA_ROWMATRIXTRANSPOSER_INSTANT) 00075 00076 // mfh 21 Jul 2013: Since we're rolling explicit instantiation by 00077 // hand here, we don't have to use the typedefs. (The typedefs work 00078 // around the fact that macros do not deal well with commas or 00079 // spaces in their arguments. We're not using macros to instantiate 00080 // the classes here, so we don't need the typedefs.) 00081 00082 // FIXME (mfh 21 Jul 2013) The instantiations below do not include 00083 // GlobalOrdinal = unsigned long (CMake BOOL option 00084 // Tpetra_INST_UNSIGNED_LONG) and other combinations of LocalOrdinal 00085 // and GlobalOrdinal types enabled by Tpetra's ETI system. However, 00086 // it does avoid link errors for common cases. 00087 00088 // FIXME (mfh 22 Jul 2013) There must be a more concise way to ask 00089 // if ThrustGPUNode with CUSPARSEOps (the default sparse kernels for 00090 // ThrustGPUNode) works. However, this works for now. 00091 #if defined(HAVE_KOKKOSCLASSIC_CUDA) && defined(HAVE_KOKKOSCLASSIC_THRUST) && defined(HAVE_KOKKOSCLASSIC_CUSPARSE) 00092 00093 // 00094 // LocalOrdinal = int, GlobalOrdinal = int 00095 // 00096 00097 # if defined(HAVE_TPETRA_INST_FLOAT) && defined(HAVE_KOKKOSCLASSIC_CUDA_FLOAT) 00098 template class RowMatrixTransposer<float, int, int, KokkosClassic::ThrustGPUNode>; 00099 # endif 00100 # if defined(HAVE_TPETRA_INST_DOUBLE) && defined(HAVE_KOKKOSCLASSIC_CUDA_DOUBLE) 00101 template class RowMatrixTransposer<double, int, int, KokkosClassic::ThrustGPUNode>; 00102 # endif 00103 # if defined(HAVE_TPETRA_INST_COMPLEX_FLOAT) && defined(HAVE_KOKKOSCLASSIC_CUDA_COMPLEX_FLOAT) 00104 template class RowMatrixTransposer<std::complex<float>, int, int, KokkosClassic::ThrustGPUNode>; 00105 # endif 00106 # if defined(HAVE_TPETRA_INST_COMPLEX_DOUBLE) && defined(HAVE_KOKKOSCLASSIC_CUDA_COMPLEX_DOUBLE) 00107 template class RowMatrixTransposer<std::complex<double>, int, int, KokkosClassic::ThrustGPUNode>; 00108 # endif 00109 00110 // 00111 // LocalOrdinal = int, GlobalOrdinal = unsigned int 00112 // 00113 00114 # if defined(HAVE_TPETRA_INST_FLOAT) && defined(HAVE_KOKKOSCLASSIC_CUDA_FLOAT) 00115 template class RowMatrixTransposer<float, int, unsignedint, KokkosClassic::ThrustGPUNode>; 00116 # endif 00117 # if defined(HAVE_TPETRA_INST_DOUBLE) && defined(HAVE_KOKKOSCLASSIC_CUDA_DOUBLE) 00118 template class RowMatrixTransposer<double, int, unsignedint, KokkosClassic::ThrustGPUNode>; 00119 # endif 00120 # if defined(HAVE_TPETRA_INST_COMPLEX_FLOAT) && defined(HAVE_KOKKOSCLASSIC_CUDA_COMPLEX_FLOAT) 00121 template class RowMatrixTransposer<std::complex<float>, int, unsignedint, KokkosClassic::ThrustGPUNode>; 00122 # endif 00123 # if defined(HAVE_TPETRA_INST_COMPLEX_DOUBLE) && defined(HAVE_KOKKOSCLASSIC_CUDA_COMPLEX_DOUBLE) 00124 template class RowMatrixTransposer<std::complex<double>, int, unsignedint, KokkosClassic::ThrustGPUNode>; 00125 # endif 00126 00127 // 00128 // LocalOrdinal = int, GlobalOrdinal = long 00129 // 00130 00131 # ifdef HAVE_TPETRA_INST_INT_LONG 00132 # if defined(HAVE_TPETRA_INST_FLOAT) && defined(HAVE_KOKKOSCLASSIC_CUDA_FLOAT) 00133 template class RowMatrixTransposer<float, int, long, KokkosClassic::ThrustGPUNode>; 00134 # endif 00135 # if defined(HAVE_TPETRA_INST_DOUBLE) && defined(HAVE_KOKKOSCLASSIC_CUDA_DOUBLE) 00136 template class RowMatrixTransposer<double, int, long, KokkosClassic::ThrustGPUNode>; 00137 # endif 00138 # if defined(HAVE_TPETRA_INST_COMPLEX_FLOAT) && defined(HAVE_KOKKOSCLASSIC_CUDA_COMPLEX_FLOAT) 00139 template class RowMatrixTransposer<std::complex<float>, int, long, KokkosClassic::ThrustGPUNode>; 00140 # endif 00141 # if defined(HAVE_TPETRA_INST_COMPLEX_DOUBLE) && defined(HAVE_KOKKOSCLASSIC_CUDA_COMPLEX_DOUBLE) 00142 template class RowMatrixTransposer<std::complex<double>, int, long, KokkosClassic::ThrustGPUNode>; 00143 # endif 00144 # endif // HAVE_TPETRA_INST_INT_LONG 00145 00146 #endif // defined(HAVE_KOKKOSCLASSIC_CUDA) && defined(HAVE_KOKKOSCLASSIC_THRUST) && defined(HAVE_KOKKOSCLASSIC_CUSPARSE) 00147 00148 } // namespace Tpetra 00149 00150 #endif // HAVE_TPETRA_EXPLICIT_INSTANTIATION
1.7.6.1