From 131503d8d7c3fbf40ab99a4979073f9652054b15 Mon Sep 17 00:00:00 2001 From: Damien L-G Date: Mon, 22 May 2023 23:12:04 -0400 Subject: [PATCH] Revert to `DualView` when deprecated code 4 is enabled --- containers/src/Kokkos_DualView.hpp | 29 ++++++++++++- containers/unit_tests/CMakeLists.txt | 1 + .../unit_tests/TestDualViewParameterPack.cpp | 43 +++++++++++++++++++ 3 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 containers/unit_tests/TestDualViewParameterPack.cpp diff --git a/containers/src/Kokkos_DualView.hpp b/containers/src/Kokkos_DualView.hpp index d2a7ad66b7..e821570a8d 100644 --- a/containers/src/Kokkos_DualView.hpp +++ b/containers/src/Kokkos_DualView.hpp @@ -87,8 +87,14 @@ inline const Kokkos::Cuda& get_cuda_space(const NonCudaExecSpace&) { } // namespace Impl +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 +template +class DualView; +#else template class DualView; +#endif template struct is_dual_view : public std::false_type {}; @@ -102,21 +108,35 @@ struct is_dual_view> : public std::true_type {}; template inline constexpr bool is_dual_view_v = is_dual_view::value; +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 +template +class DualView : public ViewTraits { + template +#else template class DualView : public ViewTraits { template +#endif friend class DualView; public: //! \name Typedefs for device types and various Kokkos::View specializations. //@{ - using traits = ViewTraits; +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 + using traits = ViewTraits; +#else + using traits = ViewTraits; +#endif //! The Kokkos Host Device type; using host_mirror_space = typename traits::host_mirror_space; //! The type of a Kokkos::View on the device. - using t_dev = View; +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 + using t_dev = View; +#else + using t_dev = View; +#endif /// \typedef t_host /// \brief The type of a Kokkos::View host mirror of \c t_dev. @@ -124,7 +144,12 @@ class DualView : public ViewTraits { //! The type of a const View on the device. //! The type of a Kokkos::View on the device. +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 + using t_dev_const = + View; +#else using t_dev_const = View; +#endif /// \typedef t_host_const /// \brief The type of a const View host mirror of \c t_dev_const. diff --git a/containers/unit_tests/CMakeLists.txt b/containers/unit_tests/CMakeLists.txt index d9f4d0d384..15c130829b 100644 --- a/containers/unit_tests/CMakeLists.txt +++ b/containers/unit_tests/CMakeLists.txt @@ -49,6 +49,7 @@ endforeach() SET(COMPILE_ONLY_SOURCES TestCreateMirror.cpp + TestDualViewParameterPack.cpp ) KOKKOS_ADD_EXECUTABLE( ContainersTestCompileOnly diff --git a/containers/unit_tests/TestDualViewParameterPack.cpp b/containers/unit_tests/TestDualViewParameterPack.cpp new file mode 100644 index 0000000000..861eba2b3e --- /dev/null +++ b/containers/unit_tests/TestDualViewParameterPack.cpp @@ -0,0 +1,43 @@ +//@HEADER +// ************************************************************************ +// +// Kokkos v. 4.0 +// Copyright (2022) National Technology & Engineering +// Solutions of Sandia, LLC (NTESS). +// +// Under the terms of Contract DE-NA0003525 with NTESS, +// the U.S. Government retains certain rights in this software. +// +// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. +// See https://kokkos.org/LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//@HEADER + +#include +#include + +namespace { + +template +void not_supported_anymore( + Kokkos::DualView x) { + static_assert(Kokkos::is_dual_view_v); +} + +template +void prefer_instead(Kokkos::DualView x) { + static_assert(Kokkos::is_dual_view_v); +} + +using KDV = Kokkos::DualView; + +#ifdef KOKKOS_ENABLE_DEPRECATED_CODE_4 +static_assert( + std::is_void_v()))>); +#endif + +static_assert(std::is_void_v()))>); + +} // namespace