| 1 |
//@HEADER |
| 2 |
// ************************************************************************ |
| 3 |
// |
| 4 |
// Kokkos v. 4.0 |
| 5 |
// Copyright (2022) National Technology & Engineering |
| 6 |
// Solutions of Sandia, LLC (NTESS). |
| 7 |
// |
| 8 |
// Under the terms of Contract DE-NA0003525 with NTESS, |
| 9 |
// the U.S. Government retains certain rights in this software. |
| 10 |
// |
| 11 |
// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. |
| 12 |
// See https://kokkos.org/LICENSE for license information. |
| 13 |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 14 |
// |
| 15 |
//@HEADER |
| 16 |
|
| 17 |
#ifndef KOKKOSCOMPAT_VIEW_DEF_HPP |
| 18 |
#define KOKKOSCOMPAT_VIEW_DEF_HPP |
| 19 |
|
| 20 |
#include "KokkosCompat_View.hpp" |
| 21 |
|
| 22 |
namespace Kokkos { |
| 23 |
namespace Compat { |
| 24 |
|
| 25 |
// template <typename D, typename T> |
| 26 |
// Kokkos::View<T*,D> |
| 27 |
// getKokkosViewDeepCopy(const Teuchos::ArrayView<T>& a) { |
| 28 |
// typedef typename std::conditional< |
| 29 |
// Impl::VerifyExecutionCanAccessMemorySpace< D, Kokkos::HostSpace>::value, |
| 30 |
// typename D::execution_space, Kokkos::HostSpace>::type |
| 31 |
// HostDevice; |
| 32 |
// typedef Kokkos::View<T*,D> view_type; |
| 33 |
// typedef Kokkos::View<T*,typename view_type::array_layout,HostDevice,Kokkos::MemoryUnmanaged> unmanaged_host_view_type; |
| 34 |
// if (a.size() == 0) |
| 35 |
// return view_type(); |
| 36 |
// view_type v("", a.size()); |
| 37 |
// unmanaged_host_view_type hv(a.getRawPtr(), a.size()); |
| 38 |
// Kokkos::deep_copy(v,hv); |
| 39 |
// return v; |
| 40 |
// } |
| 41 |
|
| 42 |
// template <typename D, typename T> |
| 43 |
// Kokkos::View<const T*,D> |
| 44 |
// getKokkosViewDeepCopy(const Teuchos::ArrayView<const T>& a) { |
| 45 |
// typedef typename std::conditional< |
| 46 |
// Impl::VerifyExecutionCanAccessMemorySpace< D, Kokkos::HostSpace>::value, |
| 47 |
// typename D::execution_space, Kokkos::HostSpace>::type |
| 48 |
// HostDevice; |
| 49 |
// typedef Kokkos::View<T*,D> view_type; |
| 50 |
// typedef Kokkos::View<const T*,typename view_type::array_layout,HostDevice,Kokkos::MemoryUnmanaged> unmanaged_host_view_type; |
| 51 |
// if (a.size() == 0) |
| 52 |
// return view_type(); |
| 53 |
// view_type v("", a.size()); |
| 54 |
// unmanaged_host_view_type hv(a.getRawPtr(), a.size()); |
| 55 |
// Kokkos::deep_copy(v,hv); |
| 56 |
// return v; |
| 57 |
// } |
| 58 |
|
| 59 |
// template <typename T, typename D> |
| 60 |
// void |
| 61 |
// realloc(Kokkos::View<T*,D>& v, const typename D::size_type size) { |
| 62 |
// Kokkos::realloc(v,size); |
| 63 |
// } |
| 64 |
|
| 65 |
// template <typename T, typename L, typename D, typename M> |
| 66 |
// Kokkos::View<T*,L,D,M> |
| 67 |
// create_view(const std::string& label, size_t size) { |
| 68 |
// return Kokkos::View<T*,L,D,M>(label, size); |
| 69 |
// } |
| 70 |
|
| 71 |
// #define COMPAT_INSTANT(T,D) |
| 72 |
|
| 73 |
// template Kokkos::View<T*,D> getKokkosViewDeepCopy<D,T>(const Teuchos::ArrayView<T>& a); |
| 74 |
//template Kokkos::View<const T*,D> getKokkosViewDeepCopy<D,T>(const Teuchos::ArrayView<const T>& a); |
| 75 |
// template void realloc<T,D>(Kokkos::View<T*,D>& v, const D::size_type size); |
| 76 |
// template Kokkos::View<T*,Kokkos::LayoutLeft,D,void> create_view<T,Kokkos::LayoutLeft,D,void>(const std::string& label, size_t size); |
| 77 |
// template Kokkos::View<T*,Kokkos::LayoutRight,D,void> create_view<T,Kokkos::LayoutRight,D,void>(const std::string& label, size_t size); |
| 78 |
// template Kokkos::View<T*,D,void,void> create_view<T,D,void,void>(const std::string& label, size_t size); |
| 79 |
|
| 80 |
} // namespace Compat |
| 81 |
} // namespace Kokkos |
| 82 |
|
| 83 |
#endif // KOKKOSCOMPAT_VIEW_DEF_HPP |