Skip to content

Commit

Permalink
Fix kokkos#6336: capturing this implicitly is deprecated in C++20 (k…
Browse files Browse the repository at this point in the history
…okkos#6337)

* fixes kokkos#6336 (hopefully)

* address comments
  • Loading branch information
fnrizzi committed Aug 7, 2023
1 parent 639c1da commit 11c6cf7
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions algorithms/unit_tests/TestStdAlgorithmsTeamAdjacentFind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct TestFunctorA {
case 0: {
const auto it = KE::adjacent_find(member, KE::cbegin(myRowViewFrom),
KE::cend(myRowViewFrom));
Kokkos::single(Kokkos::PerTeam(member), [=]() {
Kokkos::single(Kokkos::PerTeam(member), [=, *this]() {
m_distancesView(myRowIndex) =
KE::distance(KE::cbegin(myRowViewFrom), it);
});
Expand All @@ -64,7 +64,7 @@ struct TestFunctorA {

case 1: {
const auto it = KE::adjacent_find(member, myRowViewFrom);
Kokkos::single(Kokkos::PerTeam(member), [=]() {
Kokkos::single(Kokkos::PerTeam(member), [=, *this]() {
m_distancesView(myRowIndex) =
KE::distance(KE::begin(myRowViewFrom), it);
});
Expand All @@ -75,7 +75,7 @@ struct TestFunctorA {
const auto it =
KE::adjacent_find(member, KE::cbegin(myRowViewFrom),
KE::cend(myRowViewFrom), m_binaryPred);
Kokkos::single(Kokkos::PerTeam(member), [=]() {
Kokkos::single(Kokkos::PerTeam(member), [=, *this]() {
m_distancesView(myRowIndex) =
KE::distance(KE::cbegin(myRowViewFrom), it);
});
Expand All @@ -84,7 +84,7 @@ struct TestFunctorA {

case 3: {
const auto it = KE::adjacent_find(member, myRowViewFrom, m_binaryPred);
Kokkos::single(Kokkos::PerTeam(member), [=]() {
Kokkos::single(Kokkos::PerTeam(member), [=, *this]() {
m_distancesView(myRowIndex) =
KE::distance(KE::begin(myRowViewFrom), it);
});
Expand Down
4 changes: 2 additions & 2 deletions algorithms/unit_tests/TestStdAlgorithmsTeamCount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ struct TestFunctorA {
auto result =
KE::count(member, KE::cbegin(rowView), KE::cend(rowView), value);
Kokkos::single(Kokkos::PerTeam(member),
[=]() { m_countsView(rowIndex) = result; });
[=, *this]() { m_countsView(rowIndex) = result; });

break;
}

case 1: {
auto result = KE::count(member, rowView, value);
Kokkos::single(Kokkos::PerTeam(member),
[=]() { m_countsView(rowIndex) = result; });
[=, *this]() { m_countsView(rowIndex) = result; });

break;
}
Expand Down
4 changes: 2 additions & 2 deletions algorithms/unit_tests/TestStdAlgorithmsTeamCountIf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ struct TestFunctorA {
KE::end(myRowView), predicate);

Kokkos::single(Kokkos::PerTeam(member),
[=]() { m_countsView(myRowIndex) = myCount; });
[=, *this]() { m_countsView(myRowIndex) = myCount; });
} else if (m_apiPick == 1) {
auto myCount = KE::count_if(member, myRowView, predicate);
Kokkos::single(Kokkos::PerTeam(member),
[=]() { m_countsView(myRowIndex) = myCount; });
[=, *this]() { m_countsView(myRowIndex) = myCount; });
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,31 +67,31 @@ struct TestFunctorA {
const bool result = KE::lexicographical_compare(
member, dataBegin, dataEnd, compBegin, compEnd);
Kokkos::single(Kokkos::PerTeam(member),
[=]() { m_resultsView(rowIndex) = result; });
[=, *this]() { m_resultsView(rowIndex) = result; });
break;
}

case 1: {
const bool result =
KE::lexicographical_compare(member, rowData, rowComp);
Kokkos::single(Kokkos::PerTeam(member),
[=]() { m_resultsView(rowIndex) = result; });
[=, *this]() { m_resultsView(rowIndex) = result; });
break;
}

case 2: {
const bool result = KE::lexicographical_compare(
member, dataBegin, dataEnd, compBegin, compEnd, m_binaryComp);
Kokkos::single(Kokkos::PerTeam(member),
[=]() { m_resultsView(rowIndex) = result; });
[=, *this]() { m_resultsView(rowIndex) = result; });
break;
}

case 3: {
const bool result =
KE::lexicographical_compare(member, rowData, rowComp, m_binaryComp);
Kokkos::single(Kokkos::PerTeam(member),
[=]() { m_resultsView(rowIndex) = result; });
[=, *this]() { m_resultsView(rowIndex) = result; });
break;
}
}
Expand Down
8 changes: 4 additions & 4 deletions algorithms/unit_tests/TestStdAlgorithmsTeamMismatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct TestFunctorA {

const auto dataDist = KE::distance(dataBegin, dataIt);
const auto compDist = KE::distance(compBegin, compIt);
Kokkos::single(Kokkos::PerTeam(member), [=]() {
Kokkos::single(Kokkos::PerTeam(member), [=, *this]() {
m_resultsView(rowIndex) = Kokkos::make_pair(dataDist, compDist);
});

Expand All @@ -80,7 +80,7 @@ struct TestFunctorA {

const auto dataDist = KE::distance(dataBegin, dataIt);
const auto compDist = KE::distance(compBegin, compIt);
Kokkos::single(Kokkos::PerTeam(member), [=]() {
Kokkos::single(Kokkos::PerTeam(member), [=, *this]() {
m_resultsView(rowIndex) = Kokkos::make_pair(dataDist, compDist);
});

Expand All @@ -92,7 +92,7 @@ struct TestFunctorA {

const std::size_t dataDist = KE::distance(dataBegin, dataIt);
const std::size_t compDist = KE::distance(compBegin, compIt);
Kokkos::single(Kokkos::PerTeam(member), [=]() {
Kokkos::single(Kokkos::PerTeam(member), [=, *this]() {
m_resultsView(rowIndex) = Kokkos::make_pair(dataDist, compDist);
});

Expand All @@ -105,7 +105,7 @@ struct TestFunctorA {

const std::size_t dataDist = KE::distance(dataBegin, dataIt);
const std::size_t compDist = KE::distance(compBegin, compIt);
Kokkos::single(Kokkos::PerTeam(member), [=]() {
Kokkos::single(Kokkos::PerTeam(member), [=, *this]() {
m_resultsView(rowIndex) = Kokkos::make_pair(dataDist, compDist);
});

Expand Down

0 comments on commit 11c6cf7

Please sign in to comment.