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 // @HEADER
2 // *****************************************************************************
3 // Tpetra: Templated Linear Algebra Services Package
4 //
5 // Copyright 2008 NTESS and the Tpetra contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef TPETRA_DETAILS_MPITYPETRAITS_HPP
11 #define TPETRA_DETAILS_MPITYPETRAITS_HPP
12 
36 
37 #include "TpetraCore_config.h"
38 #ifdef HAVE_TPETRACORE_MPI
39 
40 #include "Kokkos_Complex.hpp"
41 #include "Teuchos_Details_MpiTypeTraits.hpp"
42 // Include this file for uintptr_t.
43 // Windows (Visual Studio 2015) claims to have that type too:
44 //
45 // https://msdn.microsoft.com/en-us/library/323b6b3k.aspx
46 #include <cstdint>
47 
48 namespace Teuchos {
49 namespace Details {
50 
52 template<>
53 class MpiTypeTraits< ::Kokkos::complex<double> > {
54 private:
55 #if MPI_VERSION >= 3
56  static const bool hasMpi3 = true;
57 #else
58  static const bool hasMpi3 = false;
59 #endif // MPI_VERSION >= 3
60 
61 public:
63  static const bool isSpecialized = true;
64 
67  static const bool needsFree = ! hasMpi3;
68 
70  static MPI_Datatype getType (const ::Kokkos::complex<double>& z);
71 
73  static MPI_Datatype getType ();
74 };
75 
76 template<>
77 class MpiTypeTraits< ::Kokkos::complex<float> > {
78 private:
79 #if MPI_VERSION >= 3
80  static const bool hasMpi3 = true;
81 #else
82  static const bool hasMpi3 = false;
83 #endif // MPI_VERSION >= 3
84 
85 public:
87  static const bool isSpecialized = true;
88 
91  static const bool needsFree = ! hasMpi3;
92 
94  static MPI_Datatype getType (const ::Kokkos::complex<float>& z);
95 
97  static MPI_Datatype getType ();
98 };
99 
100 } // namespace Details
101 } // namespace Teuchos
102 
103 namespace Tpetra {
104 namespace Details {
105 
106 // Import MpiTypeTraits into the Tpetra::Details namespace.
107 using ::Teuchos::Details::MpiTypeTraits;
108 
109 } // namespace Details
110 } // namespace Tpetra
111 
112 #endif // HAVE_TPETRACORE_MPI
113 #endif // TPETRA_DETAILS_MPITYPETRAITS_HPP