10 #ifndef KOKKOS_VIEW_FAD_FWD_HPP
11 #define KOKKOS_VIEW_FAD_FWD_HPP
14 #if defined(HAVE_SACADO_KOKKOS)
18 #ifndef KOKKOS_IMPL_PUBLIC_INCLUDE
19 #define KOKKOS_IMPL_PUBLIC_INCLUDE
20 #define KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE
24 #include "Kokkos_Core_fwd.hpp"
25 #include "Kokkos_View.hpp"
26 #ifdef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE
27 #undef KOKKOS_IMPL_PUBLIC_INCLUDE
28 #undef KOKKOS_IMPL_PUBLIC_INCLUDE_NOTDEFINED_CORE
34 template <
typename view_type>
40 #if defined(HAVE_SACADO_VIEW_SPEC) && !defined(SACADO_DISABLE_FAD_VIEW_SPEC)
45 struct ViewSpecializeSacadoFad;
46 struct ViewSpecializeSacadoFadContiguous;
56 template<
class DT,
class ... DP,
57 class ST,
class ... SP>
58 typename std::enable_if< is_view_fad< Kokkos::View<DT,DP...> >
::value &&
59 is_view_fad< Kokkos::View<ST,SP...> >
::value
61 view_copy(
const Kokkos::View<DT,DP...>& dst,
const Kokkos::View<ST,SP...>& src);
63 template<
class ExecutionSpace,
64 class DT,
class ... DP,
65 class ST,
class ... SP>
66 typename std::enable_if< is_view_fad< Kokkos::View<DT,DP...> >
::value &&
67 is_view_fad< Kokkos::View<ST,SP...> >
::value
69 view_copy(
const ExecutionSpace& space,
70 const Kokkos::View<DT,DP...>& dst,
const Kokkos::View<ST,SP...>& src);
72 template<
class Space,
class T,
class ... P>
73 struct MirrorViewType;
80 template<
class T ,
class ... P >
82 typename std::enable_if<
83 ( std::is_same<
typename ViewTraits<
T,P...>::specialize ,
84 Kokkos::Impl::ViewSpecializeSacadoFad >
::value ||
85 std::is_same<
typename ViewTraits<
T,P...>::specialize ,
86 Kokkos::Impl::ViewSpecializeSacadoFadContiguous >
::value ) &&
87 !std::is_same<
typename Kokkos::ViewTraits<T,P...>::array_layout,
88 Kokkos::LayoutStride >::
value,
89 typename Kokkos::View<T,P...>::HostMirror>::type
90 create_mirror(
const Kokkos::View<T,P...> & src);
92 template<
class T ,
class ... P >
94 typename std::enable_if<
95 ( std::is_same<
typename ViewTraits<
T,P...>::specialize ,
96 Kokkos::Impl::ViewSpecializeSacadoFad >
::value ||
97 std::is_same<
typename ViewTraits<
T,P...>::specialize ,
98 Kokkos::Impl::ViewSpecializeSacadoFadContiguous >
::value ) &&
99 std::is_same<
typename Kokkos::ViewTraits<T,P...>::array_layout,
100 Kokkos::LayoutStride >::
value,
101 typename Kokkos::View<T,P...>::HostMirror>::type
102 create_mirror(
const Kokkos::View<T,P...> & src);
104 template<
class Space,
class T,
class ... P,
106 typename std::enable_if<
107 std::is_same<
typename ViewTraits<
T,P...>::specialize ,
108 Kokkos::Impl::ViewSpecializeSacadoFad >
::value ||
109 std::is_same<
typename ViewTraits<
T,P...>::specialize ,
110 Kokkos::Impl::ViewSpecializeSacadoFadContiguous >
::value,
111 typename Impl::MirrorViewType<Space,
T,P ...>::dest_view_type>::type
112 create_mirror(
const Space&,
const Kokkos::View<T,P...> & src);
114 template<
class T ,
class ... P >
116 typename std::enable_if<
117 ( std::is_same<
typename ViewTraits<
T,P...>::specialize ,
118 Kokkos::Impl::ViewSpecializeSacadoFad >
::value ||
119 std::is_same<
typename ViewTraits<
T,P...>::specialize ,
120 Kokkos::Impl::ViewSpecializeSacadoFadContiguous >
::value ) &&
121 !std::is_same<
typename Kokkos::ViewTraits<T,P...>::array_layout,
122 Kokkos::LayoutStride >::
value,
123 typename Kokkos::View<T,P...>::HostMirror>::type
124 create_mirror(Kokkos::Impl::WithoutInitializing_t wi,
125 const Kokkos::View<T,P...> & src);
127 template<
class T ,
class ... P >
129 typename std::enable_if<
130 ( std::is_same<
typename ViewTraits<
T,P...>::specialize ,
131 Kokkos::Impl::ViewSpecializeSacadoFad >
::value ||
132 std::is_same<
typename ViewTraits<
T,P...>::specialize ,
133 Kokkos::Impl::ViewSpecializeSacadoFadContiguous >
::value ) &&
134 std::is_same<
typename Kokkos::ViewTraits<T,P...>::array_layout,
135 Kokkos::LayoutStride >::
value,
136 typename Kokkos::View<T,P...>::HostMirror>::type
137 create_mirror(Kokkos::Impl::WithoutInitializing_t wi,
138 const Kokkos::View<T,P...> & src);
140 template<
class Space,
class T,
class ... P,
142 typename std::enable_if<
143 ( std::is_same<
typename ViewTraits<
T,P...>::specialize ,
144 Kokkos::Impl::ViewSpecializeSacadoFad >
::value ||
145 std::is_same<
typename ViewTraits<
T,P...>::specialize ,
146 Kokkos::Impl::ViewSpecializeSacadoFadContiguous >
::value ),
147 typename Impl::MirrorViewType<Space,T,P ...>::dest_view_type>::type
148 create_mirror(Kokkos::Impl::WithoutInitializing_t wi,
149 const Space&,
const Kokkos::View<T,P...> & src);
151 template <
class Space,
class T,
class... P>
152 typename Impl::MirrorViewType<Space,
T, P...>::view_type
153 create_mirror_view_and_copy(
154 const Space&,
const Kokkos::View<T, P...>& src,
155 std::string
const& name =
"",
156 typename std::enable_if<
157 ( std::is_same<
typename ViewTraits<T, P...>::specialize,
158 Kokkos::Impl::ViewSpecializeSacadoFad>::
value ||
159 std::is_same<
typename ViewTraits<T,P...>::specialize ,
160 Kokkos::Impl::ViewSpecializeSacadoFadContiguous >::
value ) &&
161 Impl::MirrorViewType<Space, T, P...>::is_same_memspace>::type* =
164 template <
class Space,
class T,
class... P>
165 typename Impl::MirrorViewType<Space,
T, P...>::view_type
166 create_mirror_view_and_copy(
167 const Space&,
const Kokkos::View<T, P...>& src,
168 std::string
const& name =
"",
169 typename std::enable_if<
170 ( std::is_same<
typename ViewTraits<T, P...>::specialize,
171 Kokkos::Impl::ViewSpecializeSacadoFad>::
value ||
172 std::is_same<
typename ViewTraits<T,P...>::specialize ,
173 Kokkos::Impl::ViewSpecializeSacadoFadContiguous >::
value ) &&
174 !Impl::MirrorViewType<Space, T, P...>::is_same_memspace>::type* =
179 template <
unsigned N,
typename... Args>
180 KOKKOS_FUNCTION std::enable_if_t<
181 N ==
View<Args...>::Rank &&
182 (std::is_same<
typename ViewTraits<Args...>::specialize,
183 Kokkos::Impl::ViewSpecializeSacadoFad>
::value ||
184 std::is_same<
typename ViewTraits<Args...>::specialize,
185 Kokkos::Impl::ViewSpecializeSacadoFadContiguous>
::value),
187 as_view_of_rank_n(View<Args...> v);
191 template <
unsigned N,
typename T,
typename... Args>
193 N !=
View<
T, Args...>::Rank &&
194 (std::is_same<
typename ViewTraits<
T, Args...>::specialize,
195 Kokkos::Impl::ViewSpecializeSacadoFad>
::value ||
196 std::is_same<
typename ViewTraits<
T, Args...>::specialize,
197 Kokkos::Impl::ViewSpecializeSacadoFadContiguous>
::value),
198 View<
typename RankDataType<
typename View<T, Args...>::value_type,
N>::type,
200 as_view_of_rank_n(View<T, Args...>);
204 namespace Experimental {
206 template <
class DT,
class... DP>
207 void KOKKOS_INLINE_FUNCTION local_deep_copy_contiguous(
208 const View<DT, DP...>& dst,
209 typename ViewTraits<DT, DP...>::const_value_type&
value,
210 typename std::enable_if<(
211 ( std::is_same<
typename ViewTraits<DT,DP...>::specialize,
212 Kokkos::Impl::ViewSpecializeSacadoFad >::value
214 std::is_same<
typename ViewTraits<DT,DP...>::specialize,
215 Kokkos::Impl::ViewSpecializeSacadoFadContiguous >::value )
216 && (
unsigned(ViewTraits<DT, DP...>::rank) == 1))>::type* =
nullptr);
218 template <
class DT,
class... DP>
219 void KOKKOS_INLINE_FUNCTION local_deep_copy_contiguous(
220 const View<DT, DP...>& dst,
221 typename ViewTraits<DT, DP...>::const_value_type& value,
222 typename std::enable_if<(
223 ( std::is_same<
typename ViewTraits<DT,DP...>::specialize,
224 Kokkos::Impl::ViewSpecializeSacadoFad >::value
226 std::is_same<
typename ViewTraits<DT,DP...>::specialize,
227 Kokkos::Impl::ViewSpecializeSacadoFadContiguous >::value )
228 && (
unsigned(ViewTraits<DT, DP...>::rank) == 2))>::type* =
nullptr);
230 template <
class DT,
class... DP>
231 void KOKKOS_INLINE_FUNCTION local_deep_copy_contiguous(
232 const View<DT, DP...>& dst,
233 typename ViewTraits<DT, DP...>::const_value_type& value,
234 typename std::enable_if<(
235 ( std::is_same<
typename ViewTraits<DT,DP...>::specialize,
236 Kokkos::Impl::ViewSpecializeSacadoFad >::value
238 std::is_same<
typename ViewTraits<DT,DP...>::specialize,
239 Kokkos::Impl::ViewSpecializeSacadoFadContiguous >::value )
240 && (
unsigned(ViewTraits<DT, DP...>::rank) == 3))>::type* =
nullptr);
242 template <
class DT,
class... DP>
243 void KOKKOS_INLINE_FUNCTION local_deep_copy_contiguous(
244 const View<DT, DP...>& dst,
245 typename ViewTraits<DT, DP...>::const_value_type& value,
246 typename std::enable_if<(
247 ( std::is_same<
typename ViewTraits<DT,DP...>::specialize,
248 Kokkos::Impl::ViewSpecializeSacadoFad >::value
250 std::is_same<
typename ViewTraits<DT,DP...>::specialize,
251 Kokkos::Impl::ViewSpecializeSacadoFadContiguous >::value )
252 && (
unsigned(ViewTraits<DT, DP...>::rank) == 4))>::type* =
nullptr);
254 template <
class DT,
class... DP>
255 void KOKKOS_INLINE_FUNCTION local_deep_copy_contiguous(
256 const View<DT, DP...>& dst,
257 typename ViewTraits<DT, DP...>::const_value_type& value,
258 typename std::enable_if<(
259 ( std::is_same<
typename ViewTraits<DT,DP...>::specialize,
260 Kokkos::Impl::ViewSpecializeSacadoFad >::value
262 std::is_same<
typename ViewTraits<DT,DP...>::specialize,
263 Kokkos::Impl::ViewSpecializeSacadoFadContiguous >::value )
264 && (
unsigned(ViewTraits<DT, DP...>::rank) == 5))>::type* =
nullptr);
266 template <
class DT,
class... DP>
267 void KOKKOS_INLINE_FUNCTION local_deep_copy_contiguous(
268 const View<DT, DP...>& dst,
269 typename ViewTraits<DT, DP...>::const_value_type& value,
270 typename std::enable_if<(
271 ( std::is_same<
typename ViewTraits<DT,DP...>::specialize,
272 Kokkos::Impl::ViewSpecializeSacadoFad >::value
274 std::is_same<
typename ViewTraits<DT,DP...>::specialize,
275 Kokkos::Impl::ViewSpecializeSacadoFadContiguous >::value )
276 && (
unsigned(ViewTraits<DT, DP...>::rank) == 6))>::type* =
nullptr);
278 template <
class DT,
class... DP>
279 void KOKKOS_INLINE_FUNCTION local_deep_copy_contiguous(
280 const View<DT, DP...>& dst,
281 typename ViewTraits<DT, DP...>::const_value_type& value,
282 typename std::enable_if<(
283 ( std::is_same<
typename ViewTraits<DT,DP...>::specialize,
284 Kokkos::Impl::ViewSpecializeSacadoFad >::value
286 std::is_same<
typename ViewTraits<DT,DP...>::specialize,
287 Kokkos::Impl::ViewSpecializeSacadoFadContiguous >::value )
288 && (
unsigned(ViewTraits<DT, DP...>::rank) == 7))>::type* =
nullptr);
290 template <
class TeamType,
class DT,
class... DP>
291 void KOKKOS_INLINE_FUNCTION local_deep_copy_contiguous(
292 const TeamType& team,
const View<DT, DP...>& dst,
293 typename ViewTraits<DT, DP...>::const_value_type& value,
294 typename std::enable_if<(
295 ( std::is_same<
typename ViewTraits<DT,DP...>::specialize,
296 Kokkos::Impl::ViewSpecializeSacadoFad >::value
298 std::is_same<
typename ViewTraits<DT,DP...>::specialize,
299 Kokkos::Impl::ViewSpecializeSacadoFadContiguous >::value )
300 && (
unsigned(ViewTraits<DT, DP...>::rank) == 1))>::type* =
nullptr);
302 template <
class TeamType,
class DT,
class... DP>
303 void KOKKOS_INLINE_FUNCTION local_deep_copy_contiguous(
304 const TeamType& team,
const View<DT, DP...>& dst,
305 typename ViewTraits<DT, DP...>::const_value_type& value,
306 typename std::enable_if<(
307 ( std::is_same<
typename ViewTraits<DT,DP...>::specialize,
308 Kokkos::Impl::ViewSpecializeSacadoFad >::value
310 std::is_same<
typename ViewTraits<DT,DP...>::specialize,
311 Kokkos::Impl::ViewSpecializeSacadoFadContiguous >::value )
312 && (
unsigned(ViewTraits<DT, DP...>::rank) == 2))>::type* =
nullptr);
314 template <
class TeamType,
class DT,
class... DP>
315 void KOKKOS_INLINE_FUNCTION local_deep_copy_contiguous(
316 const TeamType& team,
const View<DT, DP...>& dst,
317 typename ViewTraits<DT, DP...>::const_value_type& value,
318 typename std::enable_if<(
319 ( std::is_same<
typename ViewTraits<DT,DP...>::specialize,
320 Kokkos::Impl::ViewSpecializeSacadoFad >::value
322 std::is_same<
typename ViewTraits<DT,DP...>::specialize,
323 Kokkos::Impl::ViewSpecializeSacadoFadContiguous >::value )
324 && (
unsigned(ViewTraits<DT, DP...>::rank) == 3))>::type* =
nullptr);
326 template <
class TeamType,
class DT,
class... DP>
327 void KOKKOS_INLINE_FUNCTION local_deep_copy_contiguous(
328 const TeamType& team,
const View<DT, DP...>& dst,
329 typename ViewTraits<DT, DP...>::const_value_type& value,
330 typename std::enable_if<(
331 ( std::is_same<
typename ViewTraits<DT,DP...>::specialize,
332 Kokkos::Impl::ViewSpecializeSacadoFad >::value
334 std::is_same<
typename ViewTraits<DT,DP...>::specialize,
335 Kokkos::Impl::ViewSpecializeSacadoFadContiguous >::value )
336 && (
unsigned(ViewTraits<DT, DP...>::rank) == 4))>::type* =
nullptr);
338 template <
class TeamType,
class DT,
class... DP>
339 void KOKKOS_INLINE_FUNCTION local_deep_copy_contiguous(
340 const TeamType& team,
const View<DT, DP...>& dst,
341 typename ViewTraits<DT, DP...>::const_value_type& value,
342 typename std::enable_if<(
343 ( std::is_same<
typename ViewTraits<DT,DP...>::specialize,
344 Kokkos::Impl::ViewSpecializeSacadoFad >::value
346 std::is_same<
typename ViewTraits<DT,DP...>::specialize,
347 Kokkos::Impl::ViewSpecializeSacadoFadContiguous >::value )
348 && (
unsigned(ViewTraits<DT, DP...>::rank) == 5))>::type* =
nullptr);
350 template <
class TeamType,
class DT,
class... DP>
351 void KOKKOS_INLINE_FUNCTION local_deep_copy_contiguous(
352 const TeamType& team,
const View<DT, DP...>& dst,
353 typename ViewTraits<DT, DP...>::const_value_type& value,
354 typename std::enable_if<(
355 ( std::is_same<
typename ViewTraits<DT,DP...>::specialize,
356 Kokkos::Impl::ViewSpecializeSacadoFad >::value
358 std::is_same<
typename ViewTraits<DT,DP...>::specialize,
359 Kokkos::Impl::ViewSpecializeSacadoFadContiguous >::value )
360 && (
unsigned(ViewTraits<DT, DP...>::rank) == 6))>::type* =
nullptr);
362 template <
class TeamType,
class DT,
class... DP>
363 void KOKKOS_INLINE_FUNCTION local_deep_copy_contiguous(
364 const TeamType& team,
const View<DT, DP...>& dst,
365 typename ViewTraits<DT, DP...>::const_value_type& value,
366 typename std::enable_if<(
367 ( std::is_same<
typename ViewTraits<DT,DP...>::specialize,
368 Kokkos::Impl::ViewSpecializeSacadoFad >::value
370 std::is_same<
typename ViewTraits<DT,DP...>::specialize,
371 Kokkos::Impl::ViewSpecializeSacadoFadContiguous >::value )
372 && (
unsigned(ViewTraits<DT, DP...>::rank) == 7))>::type* =
nullptr);
378 #endif // defined(HAVE_SACADO_VIEW_SPEC) && !defined(SACADO_DISABLE_FAD_VIEW_SPEC)
380 #endif // defined(HAVE_SACADO_KOKKOS)