kokkos-execution
0.0.1
Toggle main menu visibility
Loading...
Searching...
No Matches
load_check_add.hpp
Go to the documentation of this file.
1
#ifndef KOKKOS_EXECUTION_TESTS_UTILS_FUNCTORS_LOAD_CHECK_ADD_HPP
2
#define KOKKOS_EXECUTION_TESTS_UTILS_FUNCTORS_LOAD_CHECK_ADD_HPP
3
4
#include "Kokkos_Core.hpp"
5
6
namespace
Tests::Utils::Functors
{
7
13
template
<
typename
ValueType,
bool
OnDevice>
14
struct
LoadCheckAdd
{
15
ValueType
prev
;
16
ValueType
value
;
17
ValueType*
data
;
18
19
KOKKOS_FUNCTION
20
void
operator()
()
const
{
21
if
constexpr
(OnDevice) {
22
KOKKOS_IF_ON_HOST(Kokkos::abort(
"You should not be running on host."
);)
23
}
else
{
24
KOKKOS_IF_ON_DEVICE(Kokkos::abort(
"You should not be running on device."
);)
25
}
26
27
if
(*
data
!=
prev
) {
28
KOKKOS_IF_ON_HOST(Kokkos::abort(
"Unexpected value on host."
);)
29
KOKKOS_IF_ON_DEVICE(Kokkos::abort(
"Unexpected value on device."
);)
30
}
31
*
data
+=
value
;
32
}
33
};
34
35
}
// namespace Tests::Utils::Functors
36
37
#endif
// KOKKOS_EXECUTION_TESTS_UTILS_FUNCTORS_LOAD_CHECK_ADD_HPP
Tests::Utils::Functors
Definition
counter.hpp:6
Tests::Utils::Functors::LoadCheckAdd
Load the value at data and check it is equal to prev. Then, add value to it.
Definition
load_check_add.hpp:14
Tests::Utils::Functors::LoadCheckAdd::prev
ValueType prev
Definition
load_check_add.hpp:15
Tests::Utils::Functors::LoadCheckAdd::value
ValueType value
Definition
load_check_add.hpp:16
Tests::Utils::Functors::LoadCheckAdd::operator()
void operator()() const
Definition
load_check_add.hpp:20
Tests::Utils::Functors::LoadCheckAdd::data
ValueType * data
Definition
load_check_add.hpp:17
tests
utils
functors
load_check_add.hpp
Generated on
for kokkos-execution by
1.18.0