Tpetra parallel linear algebra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Tpetra_Details_MpiTypeTraits.hpp
Go to the documentation of this file.
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_MPITYPETRAITS_HPP
45 #define TPETRA_DETAILS_MPITYPETRAITS_HPP
46 
70 
71 #include "TpetraCore_config.h"
72 #ifdef HAVE_TPETRACORE_MPI
73 
74 #include "Kokkos_Complex.hpp"
75 #include "Teuchos_Details_MpiTypeTraits.hpp"
76 // Include this file for uintptr_t.
77 // Windows (Visual Studio 2015) claims to have that type too:
78 //
79 // https://msdn.microsoft.com/en-us/library/323b6b3k.aspx
80 #include <cstdint>
81 
82 namespace Teuchos {
83 namespace Details {
84 
86 template<>
87 class MpiTypeTraits< ::Kokkos::complex<double> > {
88 private:
89 #if MPI_VERSION >= 3
90  static const bool hasMpi3 = true;
91 #else
92  static const bool hasMpi3 = false;
93 #endif // MPI_VERSION >= 3
94 
95 public:
97  static const bool isSpecialized = true;
98 
101  static const bool needsFree = ! hasMpi3;
102 
104  static MPI_Datatype getType (const ::Kokkos::complex<double>& z);
105 
107  static MPI_Datatype getType ();
108 };
109 
110 template<>
111 class MpiTypeTraits< ::Kokkos::complex<float> > {
112 private:
113 #if MPI_VERSION >= 3
114  static const bool hasMpi3 = true;
115 #else
116  static const bool hasMpi3 = false;
117 #endif // MPI_VERSION >= 3
118 
119 public:
121  static const bool isSpecialized = true;
122 
125  static const bool needsFree = ! hasMpi3;
126 
128  static MPI_Datatype getType (const ::Kokkos::complex<float>& z);
129 
131  static MPI_Datatype getType ();
132 };
133 
134 } // namespace Details
135 } // namespace Teuchos
136 
137 namespace Tpetra {
138 namespace Details {
139 
140 // Import MpiTypeTraits into the Tpetra::Details namespace.
141 using ::Teuchos::Details::MpiTypeTraits;
142 
143 } // namespace Details
144 } // namespace Tpetra
145 
146 #endif // HAVE_TPETRACORE_MPI
147 #endif // TPETRA_DETAILS_MPITYPETRAITS_HPP