kokkos-utils
0.0.7
Toggle main menu visibility
Loading...
Searching...
No Matches
test_View.cpp
Go to the documentation of this file.
1
#include <tuple>
2
3
#include "gtest/gtest.h"
4
5
#include "Kokkos_Macros.hpp"
6
#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES
7
import
kokkos.core;
8
#else
9
#include "Kokkos_Core.hpp"
10
#endif
11
12
#include "
kokkos-utils/concepts/View.hpp
"
13
14
using
execution_space
= Kokkos::DefaultExecutionSpace;
15
26
27
namespace
Kokkos::utils::tests::concepts
28
{
29
31
TEST
(
concepts
, View)
32
{
33
using
view_1d_t = Kokkos::View<int[5] , execution_space>;
34
using
view_2d_t = Kokkos::View<int[5][5], execution_space>;
35
36
static_assert
(
Kokkos::utils::concepts::View<view_1d_t>
);
37
static_assert
(
Kokkos::utils::concepts::View<view_2d_t>
);
38
}
39
41
TEST
(
concepts
, ViewOfInstanceOf)
42
{
43
using
Kokkos::utils::concepts::ViewOfInstanceOf
;
44
45
static_assert
( ViewOfInstanceOf<Kokkos::View<std::tuple<int> ,
execution_space
>, std::tuple>);
46
static_assert
( ViewOfInstanceOf<Kokkos::View<std::tuple<int>*,
execution_space
>, std::tuple>);
47
static_assert
(! ViewOfInstanceOf<Kokkos::View<std::tuple<int>*,
execution_space
>, Kokkos::IndexType>);
48
}
49
51
TEST
(
concepts
, ViewOf)
52
{
53
using
Kokkos::utils::concepts::ViewOf
;
54
55
static_assert
( ViewOf<Kokkos::View<double , execution_space>,
double
>);
56
static_assert
( ViewOf<Kokkos::View<double[5] , execution_space>,
double
>);
57
static_assert
( ViewOf<Kokkos::View<double* , execution_space>,
double
>);
58
static_assert
( ViewOf<Kokkos::View<double** , execution_space>,
double
>);
59
static_assert
( ViewOf<Kokkos::View<const double*, execution_space>,
const
double
>);
60
static_assert
(! ViewOf<Kokkos::View<const double*, execution_space>,
double
>);
61
static_assert
(! ViewOf<Kokkos::View<int , execution_space>,
double
>);
62
static_assert
(! ViewOf< double , double>);
63
}
64
66
TEST
(
concepts
, ViewOfRank)
67
{
68
using
Kokkos::utils::concepts::ViewOfRank
;
69
70
using
int_0d_view_t = Kokkos::View<int , execution_space>;
71
using
int_1d_view_t = Kokkos::View<int* , execution_space>;
72
using
int_2d_view_t = Kokkos::View<int**, execution_space>;
73
74
static_assert
( ViewOfRank<int_0d_view_t, 0>);
75
static_assert
(! ViewOfRank<int_0d_view_t, 1>);
76
77
static_assert
( ViewOfRank<int_1d_view_t, 1>);
78
static_assert
(! ViewOfRank<int_1d_view_t, 2>);
79
80
static_assert
(! ViewOfRank<int_2d_view_t, 1>);
81
static_assert
( ViewOfRank<int_2d_view_t, 2>);
82
}
83
85
TEST
(
concepts
, ModifiableView)
86
{
87
using
Kokkos::utils::concepts::ModifiableView
;
88
89
using
double_view_t = Kokkos::View< double*, execution_space>;
90
using
const_double_view_t = Kokkos::View<const double*, execution_space>;
91
92
static_assert
( ModifiableView< double_view_t>);
93
static_assert
(! ModifiableView<const_double_view_t>);
94
}
95
96
}
// namespace Kokkos::utils::tests::concepts
Kokkos::utils::concepts::ModifiableView
Specify that a type is a modifiable Kokkos::View.
Definition
View.hpp:23
Kokkos::utils::concepts::ViewOfInstanceOf
Specify that a type is a Kokkos::View, whose value type is an instance of a given class template U.
Definition
View.hpp:31
Kokkos::utils::concepts::ViewOfRank
Specify that a type is a Kokkos::View of given rank Rank.
Definition
View.hpp:19
Kokkos::utils::concepts::ViewOf
Specify that a type is a Kokkos::View with value type ValueType.
Definition
View.hpp:27
Kokkos::utils::concepts::View
Specify that a type is a Kokkos::View.
Definition
View.hpp:15
View.hpp
Kokkos::utils::tests::concepts
Definition
test_DualView.cpp:20
Kokkos::utils::tests::concepts::TEST
TEST(concepts, DualView)
Definition
test_DualView.cpp:23
execution_space
Kokkos::DefaultExecutionSpace execution_space
Definition
test_InsertOp.cpp:13
tests
concepts
test_View.cpp
Generated on
for kokkos-utils by
1.18.0