Tpetra parallel linear algebra  Version of the Day
Tpetra_ConfigDefs.hpp
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Tpetra: Templated Linear Algebra Services Package
5 // Copyright (2008) Sandia Corporation
6 //
7 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8 // the U.S. Government retains certain rights in this software.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38 //
39 // ************************************************************************
40 // @HEADER
41 
42 #ifndef TPETRA_CONFIGDEFS_HPP
43 #define TPETRA_CONFIGDEFS_HPP
44 
45 #include "TpetraCore_config.h"
46 #include "Kokkos_DefaultNode.hpp"
47 
49 namespace Tpetra {
50  // Used in all Tpetra code that explicitly must a type (like a loop index)
51  // that is used with the Teuchos::Array[View,RCP] classes.
52 
54  typedef Teuchos_Ordinal Array_size_type;
55 }
56 
57 // these make some of the macros in Tpetra_Util.hpp much easier to describe
58 #ifdef HAVE_TPETRA_THROW_EFFICIENCY_WARNINGS
59  #define TPETRA_THROWS_EFFICIENCY_WARNINGS 1
60 #else
61  #define TPETRA_THROWS_EFFICIENCY_WARNINGS 0
62 #endif
63 
64 #ifdef HAVE_TPETRA_PRINT_EFFICIENCY_WARNINGS
65  #define TPETRA_PRINTS_EFFICIENCY_WARNINGS 1
66 #else
67  #define TPETRA_PRINTS_EFFICIENCY_WARNINGS 0
68 #endif
69 
70 #ifdef HAVE_TPETRA_THROW_ABUSE_WARNINGS
71  #define TPETRA_THROWS_ABUSE_WARNINGS 1
72 #else
73  #define TPETRA_THROWS_ABUSE_WARNINGS 0
74 #endif
75 
76 #ifdef HAVE_TPETRA_PRINT_ABUSE_WARNINGS
77  #define TPETRA_PRINTS_ABUSE_WARNINGS 1
78 #else
79  #define TPETRA_PRINTS_ABUSE_WARNINGS 0
80 #endif
81 
82 
83 #include <functional>
84 
85 //#ifndef __CUDACC__
86 // mem management
87 #include "Teuchos_Array.hpp" // includes ArrayRCP
88 #include "Teuchos_RCP.hpp"
89 #include "Teuchos_Tuple.hpp" // includes ArrayView
90 // traits classes
91 #include "Teuchos_OrdinalTraits.hpp"
92 #include "Teuchos_ScalarTraits.hpp"
93 #include "Teuchos_TypeNameTraits.hpp"
94 #include "Teuchos_NullIteratorTraits.hpp"
95 #include "Teuchos_SerializationTraits.hpp"
96 // comm
97 #include "Teuchos_CommHelpers.hpp"
98 // misc
99 #include "Teuchos_ParameterList.hpp"
100 //#endif
101 
103 namespace Tpetra {
104 
111  typedef size_t global_size_t;
112 
120  enum LocalGlobal {
121  LocallyReplicated,
122  GloballyDistributed
123  };
124 
129  };
130 
132  enum ProfileType {
135  };
136 
141  };
142 
143 
146  namespace Details {
147 
149  namespace DefaultTypes {
151  typedef double scalar_type;
153  typedef int local_ordinal_type;
154 
157 #if defined(HAVE_TPETRA_INST_INT_INT)
158  typedef int global_ordinal_type;
159 #elif defined(HAVE_TPETRA_INST_INT_LONG_LONG)
160  typedef long long global_ordinal_type;
161 #elif defined(HAVE_TPETRA_INST_INT_LONG)
162  typedef long global_ordinal_type;
163 #elif defined(HAVE_TPETRA_INST_INT_UNSIGNED_LONG)
164  typedef unsigned long global_ordinal_type;
165 #elif defined(HAVE_TPETRA_INST_INT_UNSIGNED)
166  typedef unsigned global_ordinal_type;
167 #else
168 # error "Tpetra: No global ordinal types in the set {int, long long, long, unsigned long, unsigned} have been enabled."
169 #endif
170  typedef KokkosClassic::DefaultNode::DefaultNodeType node_type;
172  } // namespace DefaultTypes
173 
174  } // namespace Details
175 
176  enum EPrivateComputeViewConstructor {
177  COMPUTE_VIEW_CONSTRUCTOR
178  };
179 
180  enum EPrivateHostViewConstructor {
181  HOST_VIEW_CONSTRUCTOR
182  };
183 
184  // import Teuchos memory management classes into Tpetra
185 //#ifndef __CUDACC__
186  using Teuchos::ArrayRCP;
187  using Teuchos::ArrayView;
188  using Teuchos::Array;
189  using Teuchos::OrdinalTraits;
190  using Teuchos::ScalarTraits;
191  using Teuchos::RCP;
192  using Teuchos::Tuple;
193  using Teuchos::Comm;
194  using Teuchos::null;
195 
196  using Teuchos::outArg;
197  using Teuchos::tuple;
198  using Teuchos::arcp;
199  using Teuchos::rcp;
200  using Teuchos::rcpFromRef;
201  using Teuchos::rcp_const_cast;
202  using Teuchos::av_reinterpret_cast;
203  using Teuchos::arcp_reinterpret_cast;
204 
205  using Teuchos::typeName;
206 
207  using Teuchos::ParameterList;
208  using Teuchos::parameterList;
209  using Teuchos::sublist;
210 //#endif
211 
228  template<class Arg1, class Arg2>
229  class project1st : public std::binary_function<Arg1, Arg2, Arg1> {
230  public:
231  typedef Arg1 first_argument_type;
232  typedef Arg2 second_argument_type;
233  typedef Arg1 result_type;
234  Arg1 operator () (const Arg1& x, const Arg2& ) const {
235  return x;
236  }
237  };
238 
254  template<class Arg1, class Arg2>
255  class project2nd : public std::binary_function<Arg1, Arg2, Arg2> {
256  public:
257  typedef Arg1 first_argument_type;
258  typedef Arg2 second_argument_type;
259  typedef Arg2 result_type;
260  Arg2 operator () (const Arg1& , const Arg2& y) const {
261  return y;
262  }
263  };
264 
265 } // end of Tpetra namespace
266 
267 
268 // We include this after the above Tpetra namespace declaration,
269 // so that we don't interfere with Doxygen's ability to find the
270 // Tpetra namespace declaration.
271 #include <Tpetra_CombineMode.hpp>
272 
273 
275 namespace TpetraExamples {
276 }
277 
278 namespace Tpetra {
280  namespace RTI {
281  }
282 }
283 
284 namespace Tpetra {
286  namespace Ext {
287  }
288 
294  namespace MatrixMatrix {
295  }
296 }
297 
298 namespace Tpetra {
301  Forward = 0,
302  Backward,
303  Symmetric
304  };
305 }
306 
307 #if defined(HAVE_TPETRACORE_KOKKOSCORE) && defined(HAVE_TPETRACORE_TEUCHOSKOKKOSCOMPAT) && defined(TPETRA_ENABLE_KOKKOS_DISTOBJECT)
308 #define TPETRA_USE_KOKKOS_DISTOBJECT 1
309 #else
310 #define TPETRA_USE_KOKKOS_DISTOBJECT 0
311 #endif
312 
313 #include <Kokkos_Complex.hpp>
314 
315 // Specializations of Teuchos::SerializationTraits for
316 // Kokkos::complex<{float,double}>.
317 
318 namespace Teuchos {
319  template<typename Ordinal>
320  class SerializationTraits<Ordinal, ::Kokkos::complex<float> >
321  : public DirectSerializationTraits<Ordinal, ::Kokkos::complex<float> >
322  {};
323 
324  template<typename Ordinal>
325  class SerializationTraits<Ordinal, ::Kokkos::complex<double> >
326  : public DirectSerializationTraits<Ordinal, ::Kokkos::complex<double> >
327  {};
328 } // namespace Teuchos
329 
330 #endif // TPETRA_CONFIGDEFS_HPP
Namespace Tpetra contains the class and methods constituting the Tpetra library.
KokkosClassic::DefaultNode::DefaultNodeType node_type
Default value of Node template parameter.
LookupStatus
Return status of Map remote index lookup (getRemoteIndexList()).
Namespace for Tpetra example classes and methods.
int local_ordinal_type
Default value of LocalOrdinal template parameter.
Teuchos_Ordinal Array_size_type
Size type for Teuchos Array objects.
Implementation details of Tpetra.
size_t global_size_t
Global size_t object.
Declaration of Tpetra::CombineMode enum, and a function for setting a Tpetra::CombineMode parameter i...
ESweepDirection
Sweep direction for Gauss-Seidel or Successive Over-Relaxation (SOR).
double scalar_type
Default value of Scalar template parameter.
Binary function that returns its second argument.
LocalGlobal
Enum for local versus global allocation of Map entries.
Binary function that returns its first argument.