kokkos-execution
0.0.1
Toggle main menu visibility
Loading...
Searching...
No Matches
maxloc.hpp
Go to the documentation of this file.
1
#ifndef KOKKOS_EXECUTION_TESTS_UTILS_FUNCTORS_MAXLOC_HPP
2
#define KOKKOS_EXECUTION_TESTS_UTILS_FUNCTORS_MAXLOC_HPP
3
4
#include "Kokkos_Macros.hpp"
5
#ifdef KOKKOS_ENABLE_EXPERIMENTAL_CXX20_MODULES
6
import
kokkos.core;
7
#else
8
# include "Kokkos_Core.hpp"
9
#endif
10
11
namespace
Tests::Utils::Functors
{
12
14
template
<
typename
DataType>
15
struct
MaxLoc
{
16
typename
DataType::const_type
data
;
17
18
template
<std::
int
egral IndexType,
typename
ValueType>
19
KOKKOS_FUNCTION
void
operator()
(
const
IndexType index, ValueType& current)
const
noexcept
{
20
if
(
data
(index) > current.val) {
21
current.val =
data
(index);
22
current.loc = index;
23
}
24
}
25
};
26
27
}
// namespace Tests::Utils::Functors
28
29
#endif
// KOKKOS_EXECUTION_TESTS_UTILS_FUNCTORS_MAXLOC_HPP
Tests::Utils::Functors
Definition
counter.hpp:11
Tests::Utils::Functors::MaxLoc
Can be used in a parallel_reduce to find the greater of the values in data alongside its index.
Definition
maxloc.hpp:15
Tests::Utils::Functors::MaxLoc::data
DataType::const_type data
Definition
maxloc.hpp:16
Tests::Utils::Functors::MaxLoc::operator()
void operator()(const IndexType index, ValueType ¤t) const noexcept
Definition
maxloc.hpp:19
tests
utils
functors
maxloc.hpp
Generated on
for kokkos-execution by
1.18.0