From 530017fd9749b2620ebb40eddd4037d1fcd39152 Mon Sep 17 00:00:00 2001 From: Andrey Prokopenko Date: Tue, 26 Dec 2023 12:53:53 -0500 Subject: [PATCH] Fix deprecation warnings --- benchmarks/dbscan/dbscan_timpl.hpp | 2 +- src/details/ArborX_DetailsBatchedQueries.hpp | 1 - .../ArborX_DetailsCrsGraphWrapperImpl.hpp | 6 +++--- .../ArborX_DetailsDistributedTreeImpl.hpp | 6 +++--- src/details/ArborX_DetailsExpandHalfToFull.hpp | 2 +- src/details/ArborX_DetailsTreeTraversal.hpp | 2 +- src/details/ArborX_NeighborList.hpp | 6 +++--- test/ArborX_BoostRTreeHelpers.hpp | 6 +++--- test/tstDetailsCrsGraphWrapperImpl.cpp | 10 ++++++---- test/tstDetailsUtils.cpp | 18 ++++++++++++------ 10 files changed, 33 insertions(+), 26 deletions(-) diff --git a/benchmarks/dbscan/dbscan_timpl.hpp b/benchmarks/dbscan/dbscan_timpl.hpp index ed5985a2b..a46125ebd 100644 --- a/benchmarks/dbscan/dbscan_timpl.hpp +++ b/benchmarks/dbscan/dbscan_timpl.hpp @@ -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( diff --git a/src/details/ArborX_DetailsBatchedQueries.hpp b/src/details/ArborX_DetailsBatchedQueries.hpp index 0dc778f45..fec3a1523 100644 --- a/src/details/ArborX_DetailsBatchedQueries.hpp +++ b/src/details/ArborX_DetailsBatchedQueries.hpp @@ -16,7 +16,6 @@ #include // returnCentroid, translateAndScale #include #include // sortObjects -#include // exclusivePrefixSum, lastElement #include #include diff --git a/src/details/ArborX_DetailsCrsGraphWrapperImpl.hpp b/src/details/ArborX_DetailsCrsGraphWrapperImpl.hpp index 582d87105..a80c9c1f1 100644 --- a/src/details/ArborX_DetailsCrsGraphWrapperImpl.hpp +++ b/src/details/ArborX_DetailsCrsGraphWrapperImpl.hpp @@ -205,7 +205,7 @@ void queryImpl(ExecutionSpace const &space, Tree const &tree, "ArborX::CrsGraphWrapper::copy_counts_to_offsets", Kokkos::RangePolicy(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); @@ -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. @@ -324,7 +324,7 @@ allocateAndInitializeStorage(Tag, ExecutionSpace const &space, "scan_queries_for_numbers_of_nearest_neighbors", Kokkos::RangePolicy(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)); diff --git a/src/details/ArborX_DetailsDistributedTreeImpl.hpp b/src/details/ArborX_DetailsDistributedTreeImpl.hpp index 1ca6c2762..4b10bfd83 100644 --- a/src/details/ArborX_DetailsDistributedTreeImpl.hpp +++ b/src/details/ArborX_DetailsDistributedTreeImpl.hpp @@ -352,7 +352,7 @@ void DistributedTreeImpl::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. @@ -684,7 +684,7 @@ void DistributedTreeImpl::countResults( Kokkos::atomic_increment(&offset(query_ids(i))); }); - exclusivePrefixSum(space, offset); + KokkosExt::exclusive_scan(space, offset); } template @@ -892,7 +892,7 @@ void DistributedTreeImpl::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 new_indices( diff --git a/src/details/ArborX_DetailsExpandHalfToFull.hpp b/src/details/ArborX_DetailsExpandHalfToFull.hpp index cad1353de..7942b9b58 100644 --- a/src/details/ArborX_DetailsExpandHalfToFull.hpp +++ b/src/details/ArborX_DetailsExpandHalfToFull.hpp @@ -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); diff --git a/src/details/ArborX_DetailsTreeTraversal.hpp b/src/details/ArborX_DetailsTreeTraversal.hpp index f4bfcbced..894ec0b24 100644 --- a/src/details/ArborX_DetailsTreeTraversal.hpp +++ b/src/details/ArborX_DetailsTreeTraversal.hpp @@ -158,7 +158,7 @@ struct TreeTraversal "scan_queries_for_numbers_of_neighbors", Kokkos::RangePolicy(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. diff --git a/src/details/ArborX_NeighborList.hpp b/src/details/ArborX_NeighborList.hpp index bff32298e..c2e6762fa 100644 --- a/src/details/ArborX_NeighborList.hpp +++ b/src/details/ArborX_NeighborList.hpp @@ -13,8 +13,8 @@ #define ARBORX_NEIGHBOR_LIST_HPP #include +#include #include // reallocWithoutInitializing -#include // exclusivePrefixSum #include #include @@ -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)); @@ -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)); diff --git a/test/ArborX_BoostRTreeHelpers.hpp b/test/ArborX_BoostRTreeHelpers.hpp index 52307a917..92c65bdc7 100644 --- a/test/ArborX_BoostRTreeHelpers.hpp +++ b/test/ArborX_BoostRTreeHelpers.hpp @@ -18,8 +18,8 @@ #include "ArborX_BoostRangeAdapters.hpp" #include #include // is_accessible_from_host +#include // exclusive_scan #include // lastElement -#include // exclusivePrefixSum #include #include #include @@ -201,7 +201,7 @@ performQueries(RTree 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) @@ -230,7 +230,7 @@ performQueries(ParallelRTree 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) diff --git a/test/tstDetailsCrsGraphWrapperImpl.cpp b/test/tstDetailsCrsGraphWrapperImpl.cpp index e948c8eb8..0c6e8b80c 100644 --- a/test/tstDetailsCrsGraphWrapperImpl.cpp +++ b/test/tstDetailsCrsGraphWrapperImpl.cpp @@ -11,7 +11,8 @@ #include "ArborX_EnableDeviceTypes.hpp" // ARBORX_DEVICE_TYPES #include "ArborX_EnableViewComparison.hpp" -#include +#include // exclusive_scan +#include #include #include @@ -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 offset("offset", 0); Kokkos::View indices("indices", 0); @@ -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); diff --git a/test/tstDetailsUtils.cpp b/test/tstDetailsUtils.cpp index feb3d73b3..bb7244a4f 100644 --- a/test/tstDetailsUtils.cpp +++ b/test/tstDetailsUtils.cpp @@ -12,6 +12,7 @@ #include "ArborXTest_StdVectorToKokkosView.hpp" #include "ArborX_EnableDeviceTypes.hpp" // ARBORX_DEVICE_TYPES #include "ArborX_EnableViewComparison.hpp" +#include #include #include #include @@ -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 x("x", n); std::vector x_ref(n, 1); @@ -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 y("y", n); - ArborX::exclusivePrefixSum(space, x, y); + KokkosExt::exclusive_scan(space, x, y); + std::vector y_ref(n); std::iota(y_ref.begin(), y_ref.end(), 0); auto y_host = Kokkos::create_mirror_view(y); @@ -72,13 +78,13 @@ 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 z("z", m); - BOOST_CHECK_THROW(ArborX::exclusivePrefixSum(space, x, z), + BOOST_CHECK_THROW(KokkosExt::exclusive_scan(space, x, z), ArborX::SearchException); Kokkos::View v("v"); auto v_host = Kokkos::create_mirror_view(v); @@ -86,19 +92,19 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(prefix_sum, DeviceType, ARBORX_DEVICE_TYPES) 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 v_ref = {0., 1., 2.}; BOOST_TEST(v_host == v_ref, tt::per_element()); Kokkos::View 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 w_ref = {0., 1., 1.};