Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
Stokhos_Tpetra_ETI_Helpers_UQ_PCE_DEVICE.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Stokhos Package
5 // Copyright (2009) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
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 Eric T. Phipps (etphipp@sandia.gov).
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 // UQ::PCE includes
44 #include "TpetraCore_ETIHelperMacros.h"
45 
46 #define INSTANTIATE_UQ_PCE_STORAGE(INSTMACRO, STORAGE, LO, GO, N) \
47  INSTMACRO( Sacado::UQ::PCE<STORAGE>, LO, GO, N )
48 
49 #define INSTANTIATE_UQ_PCE_STORAGE_SD(INSTMACRO, STORAGE, N) \
50  INSTMACRO( Sacado::UQ::PCE<STORAGE>, N )
51 
52 #define INSTANTIATE_UQ_PCE_DS_SLD(INSTMACRO, S, L, D, LO, GO, N) \
53  typedef Stokhos::DynamicStorage<L,S,D::execution_space> DS_ ## L ## _ ## S ## _ ## _ ## D; \
54  INSTANTIATE_UQ_PCE_STORAGE(INSTMACRO, DS_ ## L ## _ ## S ## _ ## _ ## D, LO, GO, N)
55 
56 #define INSTANTIATE_UQ_PCE_DS_SLD_SD(INSTMACRO, S, L, D, N) \
57  typedef Stokhos::DynamicStorage<L,S,D::execution_space> DS_ ## L ## _ ## S ## _ ## _ ## D ## _2; \
58  INSTANTIATE_UQ_PCE_STORAGE_SD(INSTMACRO, DS_ ## L ## _ ## S ## _ ## _ ## D ## _2, N)
59 
60 #define INSTANTIATE_UQ_PCE_S_D(INSTMACRO, D, LO, GO, N) \
61  INSTANTIATE_UQ_PCE_DS_SLD(INSTMACRO, double, int, D, LO, GO, N)
62 
63 #define INSTANTIATE_UQ_PCE_S_D_SD(INSTMACRO, D, N) \
64  INSTANTIATE_UQ_PCE_DS_SLD_SD(INSTMACRO, double, int, D, N)
65 
66 #define INSTANTIATE_UQ_PCE_S(INSTMACRO, LO, GO, N) \
67  typedef Stokhos::DeviceForNode2<N>::type DFN_ ## LO ## _ ## GO ## _ ## N; \
68  INSTANTIATE_UQ_PCE_S_D(INSTMACRO, DFN_ ## LO ## _ ## GO ## _ ## N, LO, GO, N)
69 
70 #if @IS_DEVICE_NODE@
71 
72 // Add instantiation on HostMirror for device nodes.
73 #define INSTANTIATE_UQ_PCE_S_SD(INSTMACRO, N) \
74  typedef Stokhos::DeviceForNode2<N>::type DFN_ ## N; \
75  typedef Kokkos::View<double*, N::device_type>::HostMirror::device_type host_device_type_##N; \
76  INSTANTIATE_UQ_PCE_S_D_SD(INSTMACRO, DFN_ ## N, N) \
77  INSTANTIATE_UQ_PCE_S_D_SD(INSTMACRO, DFN_ ## N, host_device_type_##N)
78 
79 #else
80 
81 #define INSTANTIATE_UQ_PCE_S_SD(INSTMACRO, N) \
82  typedef Stokhos::DeviceForNode2<N>::type DFN_ ## N; \
83  INSTANTIATE_UQ_PCE_S_D_SD(INSTMACRO, DFN_ ## N, N)
84 
85 #endif
86 
87 #define INSTANTIATE_UQ_PCE(INSTMACRO, LO, GO, N) \
88  INSTANTIATE_UQ_PCE_S(INSTMACRO, LO, GO, N)
89 
90 #define INSTANTIATE_UQ_PCE_SD(INSTMACRO, N) \
91  INSTANTIATE_UQ_PCE_S_SD(INSTMACRO, N)
92 
93 #define INSTANTIATE_TPETRA_UQ_PCE_N(INSTMACRO, N) \
94  using default_local_ordinal_type = Tpetra::Map<>::local_ordinal_type; \
95  using default_global_ordinal_type = Tpetra::Map<>::global_ordinal_type; \
96  INSTANTIATE_UQ_PCE_S(INSTMACRO, default_local_ordinal_type, default_global_ordinal_type, N)
97 
98 #define INSTANTIATE_TPETRA_UQ_PCE_N_SD(INSTMACRO, N) \
99  INSTANTIATE_UQ_PCE_S_SD(INSTMACRO, N)
100 
101 #define INSTANTIATE_TPETRA_UQ_PCE_WRAPPER_NODES(INSTMACRO) \
102  INSTMACRO(Kokkos_Compat_Kokkos@DEVICE@WrapperNode)
103 
104 #define INSTANTIATE_TPETRA_UQ_PCE(INSTMACRO) \
105  namespace Tpetra { \
106  \
107  TPETRA_ETI_MANGLING_TYPEDEFS() \
108  \
109  INSTANTIATE_TPETRA_UQ_PCE_WRAPPER_NODES(INSTMACRO) \
110  \
111 }