Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement expand half to full (neighbor list) #809

Merged
merged 2 commits into from
Jan 4, 2023

Conversation

dalg24
Copy link
Contributor

@dalg24 dalg24 commented Jan 2, 2023

@dalg24
Copy link
Contributor Author

dalg24 commented Jan 2, 2023

Retest this please

src/details/ArborX_DetailsExpandHalfToFull.hpp Outdated Show resolved Hide resolved
src/details/ArborX_DetailsExpandHalfToFull.hpp Outdated Show resolved Hide resolved
Comment on lines +41 to +45
#define ARBORX_TEST_EXPAND_HALF_TO_FULL(exec_space, offsets_in, indices_in, \
offsets_out, indices_out) \
BOOST_TEST(Test::expand(exec_space, offsets_in, indices_in) == \
make_compressed_storage(offsets_out, indices_out), \
boost::test_tools::per_element())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use _half and _full instead of _in and _out for clarity, and maybe add _ref to the full ones.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not changing

Comment on lines +59 to +62
ARBORX_TEST_EXPAND_HALF_TO_FULL(
exec_space, (std::vector<int>{0, 1}), (std::vector<int>{0}),
(std::vector<int>{0, 2}), (std::vector<int>{0, 0}));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I must be missing something here and in the rest of the tests.

It seems that you are testing the expand function on the input that would be invalid outputs for the half traversal. In this particular case, you have a single element (0, 0) in the half-list, and it produces two (0, 0) in the output. This does not seem right.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added comments explaining what each assertion is checking in pair format

Comment on lines 35 to 43
Kokkos::deep_copy(space, offsets, 0);
Kokkos::parallel_for(
"ArborX::Experimental::count",
Kokkos::RangePolicy<ExecutionSpace>(space, 0, n), KOKKOS_LAMBDA(int i) {
for (int j = offsets_orig(i); j < offsets_orig(i + 1); ++j)
{
int const k = indices_orig(j);
Kokkos::atomic_increment(&offsets(i));
Kokkos::atomic_increment(&offsets(k));
}
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would alias offsets to counts here for clarity.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not going to do that

src/details/ArborX_DetailsExpandHalfToFull.hpp Outdated Show resolved Hide resolved
src/details/ArborX_DetailsExpandHalfToFull.hpp Outdated Show resolved Hide resolved
{

template <class ExecutionSpace, class Offsets, class Indices>
void expandHalfToFull(ExecutionSpace const &space, Offsets &offsets,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note to myself: may want to explore a version of the function where we construct an array of pairs (i, j) and (j, i), sort it, and then construct new indices and offsets.

@aprokop aprokop added the enhancement New feature or request label Jan 3, 2023
@aprokop aprokop changed the title Add functionality to expand half (neighbor list) to full Implement expand half to full (neighbor list) Jan 4, 2023
@aprokop aprokop merged commit 70e165e into arborx:master Jan 4, 2023
@dalg24 dalg24 deleted the expand_half_to_full branch January 4, 2023 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants