Skip to content

Commit

Permalink
Fix deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
aprokop committed Dec 26, 2023
1 parent bb419c9 commit 530017f
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 26 deletions.
2 changes: 1 addition & 1 deletion benchmarks/dbscan/dbscan_timpl.hpp
Expand Up @@ -118,7 +118,7 @@ void sortAndFilterClusters(ExecutionSpace const &exec_space,
},
num_clusters);
Kokkos::resize(Kokkos::WithoutInitializing, cluster_offset, num_clusters + 1);
ArborX::exclusivePrefixSum(exec_space, cluster_offset);
KokkosExt::exclusive_scan(exec_space, cluster_offset);

auto cluster_starts = KokkosExt::clone(exec_space, cluster_offset);
KokkosExt::reallocWithoutInitializing(
Expand Down
1 change: 0 additions & 1 deletion src/details/ArborX_DetailsBatchedQueries.hpp
Expand Up @@ -16,7 +16,6 @@
#include <ArborX_DetailsAlgorithms.hpp> // returnCentroid, translateAndScale
#include <ArborX_DetailsKokkosExtViewHelpers.hpp>
#include <ArborX_DetailsSortUtils.hpp> // sortObjects
#include <ArborX_DetailsUtils.hpp> // exclusivePrefixSum, lastElement
#include <ArborX_HyperBox.hpp>
#include <ArborX_SpaceFillingCurves.hpp>

Expand Down
6 changes: 3 additions & 3 deletions src/details/ArborX_DetailsCrsGraphWrapperImpl.hpp
Expand Up @@ -205,7 +205,7 @@ void queryImpl(ExecutionSpace const &space, Tree const &tree,
"ArborX::CrsGraphWrapper::copy_counts_to_offsets",
Kokkos::RangePolicy<ExecutionSpace>(space, 0, n_queries),
KOKKOS_LAMBDA(int const i) { permuted_offset(i) = counts(i); });
exclusivePrefixSum(space, offset);
KokkosExt::exclusive_scan(space, offset);

int const n_results = KokkosExt::lastElement(space, offset);

Expand Down Expand Up @@ -301,7 +301,7 @@ allocateAndInitializeStorage(Tag, ExecutionSpace const &space,

if (buffer_size != 0)
{
exclusivePrefixSum(space, offset);
KokkosExt::exclusive_scan(space, offset);

// Use calculation for the size to avoid calling lastElement(space, offset)
// as it will launch an extra kernel to copy to host.
Expand All @@ -324,7 +324,7 @@ allocateAndInitializeStorage(Tag, ExecutionSpace const &space,
"scan_queries_for_numbers_of_nearest_neighbors",
Kokkos::RangePolicy<ExecutionSpace>(space, 0, n_queries),
KOKKOS_LAMBDA(int i) { offset(i) = getK(predicates(i)); });
exclusivePrefixSum(space, offset);
KokkosExt::exclusive_scan(space, offset);

KokkosExt::reallocWithoutInitializing(space, out,
KokkosExt::lastElement(space, offset));
Expand Down
6 changes: 3 additions & 3 deletions src/details/ArborX_DetailsDistributedTreeImpl.hpp
Expand Up @@ -352,7 +352,7 @@ void DistributedTreeImpl<DeviceType>::deviseStrategy(
}
});

exclusivePrefixSum(space, new_offset);
KokkosExt::exclusive_scan(space, new_offset);

// Truncate results so that queries will only be forwarded to as many local
// trees as necessary to find k neighbors.
Expand Down Expand Up @@ -684,7 +684,7 @@ void DistributedTreeImpl<DeviceType>::countResults(
Kokkos::atomic_increment(&offset(query_ids(i)));
});

exclusivePrefixSum(space, offset);
KokkosExt::exclusive_scan(space, offset);
}

template <typename DeviceType>
Expand Down Expand Up @@ -892,7 +892,7 @@ void DistributedTreeImpl<DeviceType>::filterResults(
new_offset(q) = min(offset(q + 1) - offset(q), getK(queries(q)));
});

exclusivePrefixSum(space, new_offset);
KokkosExt::exclusive_scan(space, new_offset);

int const n_truncated_results = KokkosExt::lastElement(space, new_offset);
Kokkos::View<int *, DeviceType> new_indices(
Expand Down
2 changes: 1 addition & 1 deletion src/details/ArborX_DetailsExpandHalfToFull.hpp
Expand Up @@ -41,7 +41,7 @@ void expandHalfToFull(ExecutionSpace const &space, Offsets &offsets,
Kokkos::atomic_increment(&offsets(k));
}
});
exclusivePrefixSum(space, offsets);
KokkosExt::exclusive_scan(space, offsets);

auto const m = KokkosExt::lastElement(space, offsets);
KokkosExt::reallocWithoutInitializing(space, indices, m);
Expand Down
2 changes: 1 addition & 1 deletion src/details/ArborX_DetailsTreeTraversal.hpp
Expand Up @@ -158,7 +158,7 @@ struct TreeTraversal<BVH, Predicates, Callback, NearestPredicateTag>
"scan_queries_for_numbers_of_neighbors",
Kokkos::RangePolicy<ExecutionSpace>(space, 0, n_queries),
KOKKOS_CLASS_LAMBDA(int i) { offset(i) = getK(_predicates(i)); });
exclusivePrefixSum(space, offset);
KokkosExt::exclusive_scan(space, offset);
int const buffer_size = KokkosExt::lastElement(space, offset);
// Allocate buffer over which to perform heap operations in
// TreeTraversal::nearestQuery() to store nearest leaf nodes found so far.
Expand Down
6 changes: 3 additions & 3 deletions src/details/ArborX_NeighborList.hpp
Expand Up @@ -13,8 +13,8 @@
#define ARBORX_NEIGHBOR_LIST_HPP

#include <ArborX_DetailsHalfTraversal.hpp>
#include <ArborX_DetailsKokkosExtStdAlgorithms.hpp>
#include <ArborX_DetailsKokkosExtViewHelpers.hpp> // reallocWithoutInitializing
#include <ArborX_DetailsUtils.hpp> // exclusivePrefixSum
#include <ArborX_LinearBVH.hpp>
#include <ArborX_Sphere.hpp>

Expand Down Expand Up @@ -57,7 +57,7 @@ void findHalfNeighborList(ExecutionSpace const &space,
space, bvh,
KOKKOS_LAMBDA(int, int j) { Kokkos::atomic_increment(&offsets(j)); },
NeighborListPredicateGetter{radius});
exclusivePrefixSum(space, offsets);
KokkosExt::exclusive_scan(space, offsets);
KokkosExt::reallocWithoutInitializing(space, indices,
KokkosExt::lastElement(space, offsets));

Expand Down Expand Up @@ -105,7 +105,7 @@ void findFullNeighborList(ExecutionSpace const &space,
Kokkos::atomic_increment(&offsets(j));
},
NeighborListPredicateGetter{radius});
exclusivePrefixSum(space, offsets);
KokkosExt::exclusive_scan(space, offsets);
KokkosExt::reallocWithoutInitializing(space, indices,
KokkosExt::lastElement(space, offsets));

Expand Down
6 changes: 3 additions & 3 deletions test/ArborX_BoostRTreeHelpers.hpp
Expand Up @@ -18,8 +18,8 @@
#include "ArborX_BoostRangeAdapters.hpp"
#include <ArborX_Box.hpp>
#include <ArborX_DetailsKokkosExtAccessibilityTraits.hpp> // is_accessible_from_host
#include <ArborX_DetailsKokkosExtStdAlgorithms.hpp> // exclusive_scan
#include <ArborX_DetailsKokkosExtViewHelpers.hpp> // lastElement
#include <ArborX_DetailsUtils.hpp> // exclusivePrefixSum
#include <ArborX_Point.hpp>
#include <ArborX_Predicates.hpp>
#include <ArborX_Sphere.hpp>
Expand Down Expand Up @@ -201,7 +201,7 @@ performQueries(RTree<Indexable> const &rtree, InputView const &queries)
std::back_inserter(returned_values));
using ExecutionSpace = typename InputView::execution_space;
ExecutionSpace space;
ArborX::exclusivePrefixSum(space, offset);
KokkosExt::exclusive_scan(space, offset);
auto const n_results = KokkosExt::lastElement(space, offset);
OutputView indices("indices", n_results);
for (int i = 0; i < n_queries; ++i)
Expand Down Expand Up @@ -230,7 +230,7 @@ performQueries(ParallelRTree<Indexable> const &rtree, InputView const &queries)
std::back_inserter(returned_values));
using ExecutionSpace = typename InputView::execution_space;
ExecutionSpace space;
ArborX::exclusivePrefixSum(space, offset);
KokkosExt::exclusive_scan(space, offset);
auto const n_results = KokkosExt::lastElement(space, offset);
OutputView1 values("values", n_results);
for (int i = 0; i < n_queries; ++i)
Expand Down
10 changes: 6 additions & 4 deletions test/tstDetailsCrsGraphWrapperImpl.cpp
Expand Up @@ -11,7 +11,8 @@

#include "ArborX_EnableDeviceTypes.hpp" // ARBORX_DEVICE_TYPES
#include "ArborX_EnableViewComparison.hpp"
#include <ArborX_DetailsCrsGraphWrapperImpl.hpp>
#include <ArborX_DetailsCrsGraphWrapperImpl.hpp> // exclusive_scan
#include <ArborX_DetailsKokkosExtStdAlgorithms.hpp>
#include <ArborX_Predicates.hpp>
#include <ArborX_TraversalPolicy.hpp>

Expand Down Expand Up @@ -48,6 +49,8 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(query_impl, DeviceType, ARBORX_DEVICE_TYPES)
{
using ExecutionSpace = typename DeviceType::execution_space;

namespace KokkosExt = ArborX::Details::KokkosExt;

Kokkos::View<int *, DeviceType> offset("offset", 0);
Kokkos::View<int *, DeviceType> indices("indices", 0);

Expand All @@ -69,9 +72,8 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(query_impl, DeviceType, ARBORX_DEVICE_TYPES)
ExecutionSpace space;
ArborX::iota(space, permute);

ArborX::exclusivePrefixSum(space, offset);
Kokkos::realloc(indices,
ArborX::Details::KokkosExt::lastElement(space, offset));
KokkosExt::exclusive_scan(space, offset);
Kokkos::realloc(indices, KokkosExt::lastElement(space, offset));
ArborX::Details::CrsGraphWrapperImpl::queryImpl(
space, Test1{}, predicates, ArborX::Details::DefaultCallback{}, indices,
offset, permute, ArborX::Details::BufferStatus::PreallocationHard);
Expand Down
18 changes: 12 additions & 6 deletions test/tstDetailsUtils.cpp
Expand Up @@ -12,6 +12,7 @@
#include "ArborXTest_StdVectorToKokkosView.hpp"
#include "ArborX_EnableDeviceTypes.hpp" // ARBORX_DEVICE_TYPES
#include "ArborX_EnableViewComparison.hpp"
#include <ArborX_DetailsKokkosExtStdAlgorithms.hpp>
#include <ArborX_DetailsSortUtils.hpp>
#include <ArborX_DetailsUtils.hpp>
#include <ArborX_Exception.hpp>
Expand Down Expand Up @@ -52,8 +53,11 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(iota, DeviceType, ARBORX_DEVICE_TYPES)

BOOST_AUTO_TEST_CASE_TEMPLATE(prefix_sum, DeviceType, ARBORX_DEVICE_TYPES)
{
namespace KokkosExt = ArborX::Details::KokkosExt;
using ExecutionSpace = typename DeviceType::execution_space;

ExecutionSpace space{};

int const n = 10;
Kokkos::View<int *, DeviceType> x("x", n);
std::vector<int> x_ref(n, 1);
Expand All @@ -62,8 +66,10 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(prefix_sum, DeviceType, ARBORX_DEVICE_TYPES)
for (int i = 0; i < n; ++i)
x_host(i) = x_ref[i];
Kokkos::deep_copy(x, x_host);

Kokkos::View<int *, DeviceType> y("y", n);
ArborX::exclusivePrefixSum(space, x, y);
KokkosExt::exclusive_scan(space, x, y);

std::vector<int> y_ref(n);
std::iota(y_ref.begin(), y_ref.end(), 0);
auto y_host = Kokkos::create_mirror_view(y);
Expand All @@ -72,33 +78,33 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(prefix_sum, DeviceType, ARBORX_DEVICE_TYPES)
BOOST_TEST(y_host == y_ref, tt::per_element());
BOOST_TEST(x_host == x_ref, tt::per_element());
// in-place
ArborX::exclusivePrefixSum(space, x, x);
KokkosExt::exclusive_scan(space, x, x);
Kokkos::deep_copy(x_host, x);
BOOST_TEST(x_host == y_ref, tt::per_element());
int const m = 11;
BOOST_TEST(n != m);
Kokkos::View<int *, DeviceType> z("z", m);
BOOST_CHECK_THROW(ArborX::exclusivePrefixSum(space, x, z),
BOOST_CHECK_THROW(KokkosExt::exclusive_scan(space, x, z),
ArborX::SearchException);
Kokkos::View<double[3], DeviceType> v("v");
auto v_host = Kokkos::create_mirror_view(v);
v_host(0) = 1.;
v_host(1) = 1.;
v_host(2) = 0.;
Kokkos::deep_copy(v, v_host);
ArborX::exclusivePrefixSum(space, v);
KokkosExt::exclusive_scan(space, v);
Kokkos::deep_copy(v_host, v);
std::vector<double> v_ref = {0., 1., 2.};
BOOST_TEST(v_host == v_ref, tt::per_element());
Kokkos::View<double *, DeviceType> w("w", 4);
BOOST_CHECK_THROW(ArborX::exclusivePrefixSum(space, v, w),
BOOST_CHECK_THROW(KokkosExt::exclusive_scan(space, v, w),
ArborX::SearchException);
v_host(0) = 1.;
v_host(1) = 0.;
v_host(2) = 0.;
Kokkos::deep_copy(v, v_host);
Kokkos::resize(w, 3);
ArborX::exclusivePrefixSum(space, v, w);
KokkosExt::exclusive_scan(space, v, w);
auto w_host = Kokkos::create_mirror_view(w);
Kokkos::deep_copy(w_host, w);
std::vector<double> w_ref = {0., 1., 1.};
Expand Down

0 comments on commit 530017f

Please sign in to comment.