kokkos-utils
0.0.5
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_Core.hpp"
6
7
#include "
kokkos-utils/concepts/View.hpp
"
8
9
using
execution_space
= Kokkos::DefaultExecutionSpace;
10
21
22
namespace
Kokkos::utils::tests::concepts
23
{
24
26
TEST
(
concepts
, View)
27
{
28
using
view_1d_t = Kokkos::View<int[5] , execution_space>;
29
using
view_2d_t = Kokkos::View<int[5][5], execution_space>;
30
31
static_assert
(
Kokkos::utils::concepts::View<view_1d_t>
);
32
static_assert
(
Kokkos::utils::concepts::View<view_2d_t>
);
33
}
34
36
TEST
(
concepts
, ViewOfInstanceOf)
37
{
38
using
Kokkos::utils::concepts::ViewOfInstanceOf
;
39
40
static_assert
( ViewOfInstanceOf<Kokkos::View<std::tuple<int> ,
execution_space
>, std::tuple>);
41
static_assert
( ViewOfInstanceOf<Kokkos::View<std::tuple<int>*,
execution_space
>, std::tuple>);
42
static_assert
(! ViewOfInstanceOf<Kokkos::View<std::tuple<int>*,
execution_space
>, Kokkos::IndexType>);
43
}
44
46
TEST
(
concepts
, ViewOf)
47
{
48
using
Kokkos::utils::concepts::ViewOf
;
49
50
static_assert
( ViewOf<Kokkos::View<double , execution_space>,
double
>);
51
static_assert
( ViewOf<Kokkos::View<double[5] , execution_space>,
double
>);
52
static_assert
( ViewOf<Kokkos::View<double* , execution_space>,
double
>);
53
static_assert
( ViewOf<Kokkos::View<double** , execution_space>,
double
>);
54
static_assert
( ViewOf<Kokkos::View<const double*, execution_space>,
const
double
>);
55
static_assert
(! ViewOf<Kokkos::View<const double*, execution_space>,
double
>);
56
static_assert
(! ViewOf<Kokkos::View<int , execution_space>,
double
>);
57
static_assert
(! ViewOf< double , double>);
58
}
59
61
TEST
(
concepts
, ViewOfRank)
62
{
63
using
Kokkos::utils::concepts::ViewOfRank
;
64
65
using
int_0d_view_t = Kokkos::View<int , execution_space>;
66
using
int_1d_view_t = Kokkos::View<int* , execution_space>;
67
using
int_2d_view_t = Kokkos::View<int**, execution_space>;
68
69
static_assert
( ViewOfRank<int_0d_view_t, 0>);
70
static_assert
(! ViewOfRank<int_0d_view_t, 1>);
71
72
static_assert
( ViewOfRank<int_1d_view_t, 1>);
73
static_assert
(! ViewOfRank<int_1d_view_t, 2>);
74
75
static_assert
(! ViewOfRank<int_2d_view_t, 1>);
76
static_assert
( ViewOfRank<int_2d_view_t, 2>);
77
}
78
80
TEST
(
concepts
, ModifiableView)
81
{
82
using
Kokkos::utils::concepts::ModifiableView
;
83
84
using
double_view_t = Kokkos::View< double*, execution_space>;
85
using
const_double_view_t = Kokkos::View<const double*, execution_space>;
86
87
static_assert
( ModifiableView< double_view_t>);
88
static_assert
(! ModifiableView<const_double_view_t>);
89
}
90
91
}
// 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:8
tests
concepts
test_View.cpp
Generated on
for kokkos-utils by
1.18.0