kokkos-utils
0.0.5
Toggle main menu visibility
Loading...
Searching...
No Matches
TestWorkload.hpp
Go to the documentation of this file.
1
#ifndef KOKKOS_UTILS_TESTS_CALLBACKS_TESTWORKLOAD_HPP
2
#define KOKKOS_UTILS_TESTS_CALLBACKS_TESTWORKLOAD_HPP
3
4
#include "Kokkos_Core.hpp"
5
#include "Kokkos_Profiling_ProfileSection.hpp"
6
#include "Kokkos_Profiling_ScopedRegion.hpp"
7
8
namespace
Kokkos::utils::tests::callbacks
9
{
10
11
template
<Kokkos::ExecutionSpace Exec>
12
struct
MyWorkload
13
{
14
struct
MyFunctor
15
{
16
template
<std::
int
egral T>
17
KOKKOS_FUNCTION
18
void
operator()
(
const
T)
const
{}
19
};
20
21
void
execute
(
const
Exec& exec)
const
22
{
23
Kokkos::Profiling::ProfilingSection profile_section(
"profile section"
);
24
25
profile_section.start();
26
27
{
28
const
Kokkos::Profiling::ScopedRegion guard_level_0(
"computation - level 0"
);
29
30
Kokkos::parallel_for(
31
"computation - level 0 - pfor"
,
32
Kokkos::RangePolicy(exec, 0, 1),
33
MyFunctor
{}
34
);
35
exec.fence(
"computation - level 0 - fence after pfor"
);
36
37
Kokkos::Profiling::markEvent(
"buried marker"
);
38
39
{
40
const
Kokkos::Profiling::ScopedRegion guard_level_1(
"computation - level 1"
);
41
42
// Another kernel, a parallel reduce on the default execution space instance.
43
double
my_result;
44
Kokkos::parallel_reduce(
45
"computation - level 1 - preduce on default exec"
,
46
Kokkos::RangePolicy(0, 1),
47
KOKKOS_LAMBDA (
const
typename
Exec::size_type,
const
double
&) {},
48
my_result
49
);
50
}
51
}
52
53
profile_section.stop();
54
55
exec.fence(
"other fence after stopping the profile section"
);
56
}
57
};
58
59
}
// namespace Kokkos::utils::tests::callbacks
60
61
#endif
// KOKKOS_UTILS_TESTS_CALLBACKS_TESTWORKLOAD_HPP
Kokkos::utils::tests::callbacks
Definition
Helpers.hpp:7
Kokkos::utils::tests::callbacks::MyWorkload::MyFunctor
Definition
TestWorkload.hpp:15
Kokkos::utils::tests::callbacks::MyWorkload::MyFunctor::operator()
KOKKOS_FUNCTION void operator()(const T) const
Definition
TestWorkload.hpp:18
Kokkos::utils::tests::callbacks::MyWorkload
Definition
TestWorkload.hpp:13
Kokkos::utils::tests::callbacks::MyWorkload::execute
void execute(const Exec &exec) const
Definition
TestWorkload.hpp:21
tests
callbacks
TestWorkload.hpp
Generated on
for kokkos-utils by
1.18.0