Skip to content

Commit

Permalink
Remove ARBORX_TEST_QUERY_TREE_WITH_DISTANCE
Browse files Browse the repository at this point in the history
It is only used in the distributed testing, and does not test anything
useful. It prevents the refactoring of the DistributedTree as it reaches
inside the implementation which would vary between the old and new
interface.

Should have been removed as part of #366.
  • Loading branch information
aprokop committed Dec 29, 2023
1 parent 0691121 commit 8b3a427
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 67 deletions.
50 changes: 0 additions & 50 deletions test/Search_UnitTestHelpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,56 +112,6 @@ auto query(ExecutionSpace const &exec_space, Tree const &tree,
(reference), \
boost::test_tools::per_element());

#ifdef ARBORX_ENABLE_MPI
// Workaround for NVCC that complains that the enclosing parent function
// (query_with_distance) for an extended __host__ __device__ lambda must not
// have deduced return type
template <typename DeviceType, typename ExecutionSpace>
Kokkos::View<ArborX::Details::PairIndexRankAndDistance *, DeviceType>
zip(ExecutionSpace const &space, Kokkos::View<int *, DeviceType> indices,
Kokkos::View<int *, DeviceType> ranks,
Kokkos::View<float *, DeviceType> distances)
{
auto const n = indices.extent(0);
Kokkos::View<ArborX::Details::PairIndexRankAndDistance *, DeviceType> values(
Kokkos::view_alloc(Kokkos::WithoutInitializing, "Testing::values"), n);
Kokkos::parallel_for(
"ArborX:UnitTestSupport:zip",
Kokkos::RangePolicy<ExecutionSpace>(space, 0, n), KOKKOS_LAMBDA(int i) {
values(i) = {{indices(i), ranks(i)}, distances(i)};
});
return values;
}

template <typename ExecutionSpace, typename Tree, typename Queries>
auto query_with_distance(ExecutionSpace const &exec_space, Tree const &tree,
Queries const &queries,
std::enable_if_t<is_distributed<Tree>{}> * = nullptr)
{
using MemorySpace = typename Tree::memory_space;
using DeviceType = Kokkos::Device<ExecutionSpace, MemorySpace>;

Kokkos::View<int *, MemorySpace> offsets("Testing::offsets", 0);
Kokkos::View<int *, MemorySpace> indices("Testing::indices", 0);
Kokkos::View<int *, MemorySpace> ranks("Testing::ranks", 0);
Kokkos::View<float *, MemorySpace> distances("Testing::distances", 0);
ArborX::Details::DistributedTreeImpl<DeviceType>::queryDispatchImpl(
ArborX::Details::NearestPredicateTag{}, tree, exec_space, queries,
indices, offsets, ranks, &distances);

auto values = zip(exec_space, indices, ranks, distances);

return make_compressed_storage(
Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace{}, offsets),
Kokkos::create_mirror_view_and_copy(Kokkos::HostSpace{}, values));
}
#endif

#define ARBORX_TEST_QUERY_TREE_WITH_DISTANCE(exec_space, tree, queries, \
reference) \
BOOST_TEST(query_with_distance(exec_space, tree, queries) == (reference), \
boost::test_tools::per_element());

template <typename Tree, typename ExecutionSpace>
auto make(ExecutionSpace const &exec_space, std::vector<ArborX::Box> const &b)
{
Expand Down
17 changes: 0 additions & 17 deletions test/tstDistributedTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,6 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(empty_tree, DeviceType, ARBORX_DEVICE_TYPES)
makeNearestQueries<DeviceType>({}),
make_reference_solution<PairIndexRank>({}, {0}));

ARBORX_TEST_QUERY_TREE_WITH_DISTANCE(
ExecutionSpace{}, tree, makeNearestQueries<DeviceType>({}),
make_reference_solution<PairIndexRankAndDistance>({}, {0}));

// Only rank 0 has a couple spatial queries with a spatial predicate
if (comm_rank == 0)
{
Expand Down Expand Up @@ -210,15 +206,6 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(empty_tree, DeviceType, ARBORX_DEVICE_TYPES)
}),
make_reference_solution<PairIndexRank>({}, {0, 0}));
}

// All ranks have a single query with a nearest predicate (this version
// returns distances as well)
ARBORX_TEST_QUERY_TREE_WITH_DISTANCE(
ExecutionSpace{}, tree,
makeNearestQueries<DeviceType>({
{{{0., 0., 0.}}, comm_size},
}),
make_reference_solution<PairIndexRankAndDistance>({}, {0, 0}));
}

BOOST_AUTO_TEST_CASE_TEMPLATE(unique_leaf_on_rank_0, DeviceType,
Expand Down Expand Up @@ -259,10 +246,6 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(unique_leaf_on_rank_0, DeviceType,
makeNearestQueries<DeviceType>({}),
make_reference_solution<PairIndexRank>({}, {0}));

ARBORX_TEST_QUERY_TREE_WITH_DISTANCE(
ExecutionSpace{}, tree, makeNearestQueries<DeviceType>({}),
make_reference_solution<PairIndexRankAndDistance>({}, {0}));

// Querying for more neighbors than there are leaves in the tree
ARBORX_TEST_QUERY_TREE(
ExecutionSpace{}, tree,
Expand Down

0 comments on commit 8b3a427

Please sign in to comment.