Skip to content

Commit

Permalink
Get rid of generic lambdas not supported by CUDA
Browse files Browse the repository at this point in the history
  • Loading branch information
aprokop committed Apr 9, 2024
1 parent fd39c11 commit fb2ec1f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
16 changes: 10 additions & 6 deletions src/details/ArborX_NeighborList.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ void findHalfNeighborList(ExecutionSpace const &space,
Points points{primitives}; // NOLINT
int const n = points.size();

BoundingVolumeHierarchy<MemorySpace, PairValueIndex<Point>> bvh(
using Value = PairValueIndex<Point>;

BoundingVolumeHierarchy<MemorySpace, Value> bvh(
space, Experimental::attach_indices(points));

Kokkos::Profiling::pushRegion(
Expand All @@ -77,7 +79,7 @@ void findHalfNeighborList(ExecutionSpace const &space,
Kokkos::deep_copy(space, offsets, 0);
HalfTraversal(
space, bvh,
KOKKOS_LAMBDA(auto, auto const &value) {
KOKKOS_LAMBDA(Value const &, Value const &value) {
Kokkos::atomic_increment(&offsets(value.index));
},
NeighborListPredicateGetter{radius});
Expand All @@ -93,7 +95,7 @@ void findHalfNeighborList(ExecutionSpace const &space,
"ArborX::Experimental::HalfNeighborList::counts");
HalfTraversal(
space, bvh,
KOKKOS_LAMBDA(auto const &value1, auto const &value2) {
KOKKOS_LAMBDA(Value const &value1, Value const &value2) {
indices(Kokkos::atomic_fetch_inc(&counts(value2.index))) = value1.index;
},
NeighborListPredicateGetter{radius});
Expand Down Expand Up @@ -125,7 +127,9 @@ void findFullNeighborList(ExecutionSpace const &space,
Points points{primitives}; // NOLINT
int const n = points.size();

BoundingVolumeHierarchy<MemorySpace, PairValueIndex<Point>> bvh(
using Value = PairValueIndex<Point>;

BoundingVolumeHierarchy<MemorySpace, Value> bvh(
space, Experimental::attach_indices(points));

Kokkos::Profiling::pushRegion(
Expand All @@ -135,7 +139,7 @@ void findFullNeighborList(ExecutionSpace const &space,
Kokkos::deep_copy(space, offsets, 0);
HalfTraversal(
space, bvh,
KOKKOS_LAMBDA(auto const &value1, auto const &value2) {
KOKKOS_LAMBDA(Value const &value1, Value const &value2) {
Kokkos::atomic_increment(&offsets(value1.index));
Kokkos::atomic_increment(&offsets(value2.index));
},
Expand All @@ -152,7 +156,7 @@ void findFullNeighborList(ExecutionSpace const &space,
"ArborX::Experimental::FullNeighborList::counts");
HalfTraversal(
space, bvh,
KOKKOS_LAMBDA(auto const &value1, auto const &value2) {
KOKKOS_LAMBDA(Value const &value1, Value const &value2) {
indices(Kokkos::atomic_fetch_inc(&counts(value2.index))) = value1.index;
},
NeighborListPredicateGetter{radius});
Expand Down
3 changes: 2 additions & 1 deletion test/tstDetailsHalfTraversal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(half_traversal, DeviceType, ARBORX_DEVICE_TYPES)
// [n] 1 1 1 1 1 1 1 1 1 0

using ArborX::Details::HalfTraversal;
using Value = ArborX::PairValueIndex<ArborX::Box>;
HalfTraversal(
exec_space, bvh,
KOKKOS_LAMBDA(auto const &value1, auto const &value2) {
KOKKOS_LAMBDA(Value const &value1, Value const &value2) {
int i = value1.index;
int j = value2.index;
auto [min_ij, max_ij] = Kokkos::minmax(i, j);
Expand Down

0 comments on commit fb2ec1f

Please sign in to comment.