1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
|
//@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 <Kokkos_Core.hpp>
namespace {
struct TestMDRangePolicyCTAD {
template <typename... Ts>
static void maybe_unused(Ts&&...) {}
struct SomeExecutionSpace {
using execution_space = SomeExecutionSpace;
using size_type = size_t;
};
static_assert(Kokkos::is_execution_space_v<SomeExecutionSpace>);
struct ImplicitlyConvertibleToDefaultExecutionSpace {
[[maybe_unused]] operator Kokkos::DefaultExecutionSpace() const {
return Kokkos::DefaultExecutionSpace();
}
};
static_assert(!Kokkos::is_execution_space_v<
ImplicitlyConvertibleToDefaultExecutionSpace>);
[[maybe_unused]] static inline Kokkos::DefaultExecutionSpace des;
[[maybe_unused]] static inline ImplicitlyConvertibleToDefaultExecutionSpace
notEs;
[[maybe_unused]] static inline SomeExecutionSpace ses;
[[maybe_unused]] static inline int t[5];
[[maybe_unused]] static inline int64_t tt[5];
[[maybe_unused]] static inline Kokkos::Array<int64_t, 3> a;
[[maybe_unused]] static inline Kokkos::Array<int64_t, 2> aa;
[[maybe_unused]] static inline int64_t i64;
// Workaround for nvc++ (CUDA-11.7-NVHPC) ignoring [[maybe_unused]] on
// ImplicitlyConvertibleToDefaultExecutionSpace::operator
// Kokkos::DefaultExecutionSpace() const
[[maybe_unused]] static inline Kokkos::DefaultExecutionSpace notEsToDes =
notEs;
// Workaround for HIP-ROCm-5.2 "declared but never referenced"
TestMDRangePolicyCTAD() {
maybe_unused(des, notEs, ses, t, tt, a, aa, notEsToDes, i64);
}
// MDRangePolicy with C array parameters
static_assert(
std::is_same_v<Kokkos::MDRangePolicy<Kokkos::Rank<std::size(t)>>,
decltype(Kokkos::MDRangePolicy(t, t))>);
static_assert(
std::is_same_v<Kokkos::MDRangePolicy<Kokkos::Rank<std::size(t)>>,
decltype(Kokkos::MDRangePolicy(t, t, tt))>);
static_assert(
std::is_same_v<Kokkos::MDRangePolicy<Kokkos::Rank<std::size(t)>>,
decltype(Kokkos::MDRangePolicy(des, t, tt))>);
static_assert(
std::is_same_v<Kokkos::MDRangePolicy<Kokkos::Rank<std::size(t)>>,
decltype(Kokkos::MDRangePolicy(notEs, t, t))>);
static_assert(
std::is_same_v<
Kokkos::MDRangePolicy<SomeExecutionSpace, Kokkos::Rank<std::size(t)>>,
decltype(Kokkos::MDRangePolicy(ses, t, t))>);
// MDRangePolicy with Kokkos::initializer_list parameters
static_assert(std::is_same_v<Kokkos::MDRangePolicy<Kokkos::Rank<6>>,
decltype(Kokkos::MDRangePolicy(
{1, 2, 3, 4, 5, 6}, {1, 2, 3, 4, 5, 6}))>);
static_assert(std::is_same_v<Kokkos::MDRangePolicy<Kokkos::Rank<6>>,
decltype(Kokkos::MDRangePolicy(
{1, 2, 3, 4, 5, 6}, {1, 2, 3, 4, 5, 6},
{i64, i64, i64, i64, i64, i64}))>);
static_assert(std::is_same_v<Kokkos::MDRangePolicy<Kokkos::Rank<6>>,
decltype(Kokkos::MDRangePolicy(
des, {1, 2, 3, 4, 5, 6},
{i64, i64, i64, i64, i64, i64}))>);
static_assert(
std::is_same_v<Kokkos::MDRangePolicy<Kokkos::Rank<6>>,
decltype(Kokkos::MDRangePolicy(notEs, {1, 2, 3, 4, 5, 6},
{1, 2, 3, 4, 5, 6}))>);
static_assert(
std::is_same_v<Kokkos::MDRangePolicy<SomeExecutionSpace, Kokkos::Rank<6>>,
decltype(Kokkos::MDRangePolicy(ses, {1, 2, 3, 4, 5, 6},
{1, 2, 3, 4, 5, 6}))>);
// MDRangePolicy with Kokkos::Array parameters
static_assert(
std::is_same_v<Kokkos::MDRangePolicy<Kokkos::Rank<std::size(a)>>,
decltype(Kokkos::MDRangePolicy(a, a))>);
static_assert(
std::is_same_v<Kokkos::MDRangePolicy<Kokkos::Rank<std::size(a)>>,
decltype(Kokkos::MDRangePolicy(a, a, aa))>);
static_assert(
std::is_same_v<Kokkos::MDRangePolicy<Kokkos::Rank<std::size(a)>>,
decltype(Kokkos::MDRangePolicy(des, a, a))>);
static_assert(
std::is_same_v<Kokkos::MDRangePolicy<Kokkos::Rank<std::size(a)>>,
decltype(Kokkos::MDRangePolicy(notEs, a, a))>);
static_assert(
std::is_same_v<Kokkos::MDRangePolicy<Kokkos::Rank<std::size(a)>>,
decltype(Kokkos::MDRangePolicy(des, a, a, aa))>);
static_assert(
std::is_same_v<Kokkos::MDRangePolicy<Kokkos::Rank<std::size(a)>>,
decltype(Kokkos::MDRangePolicy(notEs, a, a, aa))>);
static_assert(
std::is_same_v<
Kokkos::MDRangePolicy<SomeExecutionSpace, Kokkos::Rank<std::size(a)>>,
decltype(Kokkos::MDRangePolicy(ses, a, a))>);
static_assert(
std::is_same_v<
Kokkos::MDRangePolicy<SomeExecutionSpace, Kokkos::Rank<std::size(a)>>,
decltype(Kokkos::MDRangePolicy(ses, a, a, aa))>);
};
} // namespace
|