Skip to content

Commit

Permalink
fix some warnings in policy_performance benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricchevalier19 committed Mar 4, 2024
1 parent 750ef21 commit 97fa76f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion benchmarks/policy_performance/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ int main(int argc, char* argv[]) {

Kokkos::parallel_reduce(
"parallel_reduce warmup", Kokkos::TeamPolicy<>(10, 1),
KOKKOS_LAMBDA(const Kokkos::TeamPolicy<>::member_type team,
KOKKOS_LAMBDA(const Kokkos::TeamPolicy<>::member_type&,
double& lval) { lval += 1; },
result);

Expand Down
14 changes: 7 additions & 7 deletions benchmarks/policy_performance/policy_perf_test.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ struct ParallelScanFunctor {
using value_type = double;
ViewType v;

ParallelScanFunctor(const ViewType& v_) : v(v_) {}
explicit ParallelScanFunctor(const ViewType& v_) : v(v_) {}

KOKKOS_INLINE_FUNCTION
void operator()(const int idx, value_type& val, const bool& final) const {
void operator()(const int idx, value_type& val, const bool& is_final) const {
// inclusive scan
val += v(idx);
if (final) {
if (is_final) {
v(idx) = val;
}
}
Expand Down Expand Up @@ -109,7 +109,7 @@ void test_policy(int team_range, int thread_range, int vector_range,
vector_result = 0.0;
Kokkos::parallel_reduce(
Kokkos::ThreadVectorRange(team, vector_range),
[&](const int vi, double& vval) { vval += 1; },
[&](const int, double& vval) { vval += 1; },
vector_result);
}
v2(idx, t) = vector_result;
Expand All @@ -128,7 +128,7 @@ void test_policy(int team_range, int thread_range, int vector_range,
team_result = 0.0;
Kokkos::parallel_reduce(
Kokkos::TeamThreadRange(team, thread_range),
[&](const int t, double& lval) { lval += 1; }, team_result);
[&](const int, double& lval) { lval += 1; }, team_result);
}
v1(idx) = team_result;
// prevent compiler optimizing loop away
Expand Down Expand Up @@ -170,13 +170,13 @@ void test_policy(int team_range, int thread_range, int vector_range,
for (int tr = 0; tr < thread_repeat; ++tr) {
Kokkos::parallel_reduce(
Kokkos::TeamThreadRange(team, thread_range),
[&](const int t, double& lval) {
[&](const int, double& lval) {
double vector_result = 0.0;
for (int vr = 0; vr < inner_repeat; ++vr) {
vector_result = 0.0;
Kokkos::parallel_reduce(
Kokkos::ThreadVectorRange(team, vector_range),
[&](const int vi, double& vval) { vval += 1; },
[&](const int, double& vval) { vval += 1; },
vector_result);
lval += vector_result;
}
Expand Down

0 comments on commit 97fa76f

Please sign in to comment.