Skip to content
New issue

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

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

Already on GitHub? # to your account

Add triangulated surface distance benchmark #1052

Merged
merged 3 commits into from
Apr 11, 2024

Conversation

aprokop
Copy link
Contributor

@aprokop aprokop commented Apr 3, 2024

This constructs a triangular tesselation of a sphere, then computes the distances from a randomly generated point cloud to the surface. User can specify the number of refinements of isocahedron and its radius, as well as the number of query points. It also optionally allows for saving the mesh in the legacy VTK format.

Screenshot 2024-04-03 at 12 18 37 PM

@aprokop aprokop changed the title Add helper functions to construct predicates Add triangular surface distance benchmark Apr 3, 2024
@aprokop aprokop force-pushed the benchmark_distance_ball branch from 0ecf36b to e81f15c Compare April 5, 2024 15:59
@aprokop aprokop marked this pull request as ready for review April 5, 2024 15:59
@aprokop aprokop added this to the Tentative 1.6 Release milestone Apr 9, 2024
@aprokop aprokop changed the title Add triangular surface distance benchmark Add triangulated surface distance benchmark Apr 9, 2024
@aprokop aprokop force-pushed the benchmark_distance_ball branch from e81f15c to 9d69509 Compare April 9, 2024 20:07
Value const &value,
OutputFunctor const &out) const
{
using ArborX::Details::distance;
Copy link
Contributor

Choose a reason for hiding this comment

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

OK since we are not in examples/ but wondering whether we need to do something about it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Like what? We can simply remove it, I guess, as we control the geometries in the benchmark. But if a user looks here at any point, we may want to leave this around.

Copy link
Contributor

Choose a reason for hiding this comment

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

Add a comment, discuss whether we want to officially support geometric functions, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add a comment, discuss whether we want to officially support geometric functions, etc.

I don't understand what you are saying.

Copy link
Contributor

Choose a reason for hiding this comment

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

Users are not allowed to reach into functionality that lives in the namespace Details:: and we should avoid showcasing doing so.

Copy link
Contributor Author

@aprokop aprokop Apr 9, 2024

Choose a reason for hiding this comment

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

You are right. We wouldn't want to show it here. But it doesn't detect distance from the arguments.

Comment on lines +32 to +33
auto a = Kokkos::numbers::phi_v<float>;
auto b = 1.f;
Copy link
Contributor

Choose a reason for hiding this comment

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

What about

Suggested change
auto a = Kokkos::numbers::phi_v<float>;
auto b = 1.f;
auto const phi = Kokkos::numbers::phi_v<float>;
auto const one = 1.f;

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 would prefer not to. a and b are icosahedron parameter. We don't necessarily need to initialize them to phi and one, could do any scaling of those.

Kokkos::view_alloc(space, Kokkos::WithoutInitializing,
"Benchmark::points"),
n);
generatePointCloud(PointCloudType::filled_box, std::cbrt(n), random_points);
Copy link
Contributor

Choose a reason for hiding this comment

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

How do you control the volume in which points are being generated?

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 don't. I generate the points in std::cbrt(n) box. I thought about providing an argument for it, but I honestly don't see what it adds to the benchmark.

Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose not much as long as it stays centered on the origin

Copy link
Contributor

@dalg24 dalg24 left a comment

Choose a reason for hiding this comment

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

Good enough (once we clear the questions about controlling the random points location.

It would be nice if we avoided using Boost.program_options for examples/benchmarks when we can.

@aprokop
Copy link
Contributor Author

aprokop commented Apr 9, 2024

It would be nice if we avoided using Boost.program_options for examples/benchmarks when we can.

An alternative would be some configuration file. But I like cmd line arguments because it plays better with bash scripting.

@aprokop
Copy link
Contributor Author

aprokop commented Apr 9, 2024

One thing I haven't considered is that distance to a surface is somewhat pathological case for a query. Specifically, we currently reorder queries based on the scene bounding box of the primitives. The issue is that it is highly likely that the predicates are outside of that box. So, a lot of them would be mapped to same Morton indices which would likely result in divergence during the traversal.

This is outside of the scope of the current PR, though. Simply an observation.

return std::make_pair(vertices, triangles);
}

/* Suvdivide every triangle into four
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/* Suvdivide every triangle into four
/* Subdivide every triangle into four

Copy link
Contributor

@dalg24 dalg24 left a comment

Choose a reason for hiding this comment

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

Maybe fix the date of the copyright too (besides the typo pointed out by Daniel)

@aprokop
Copy link
Contributor Author

aprokop commented Apr 10, 2024

Maybe fix the date of the copyright too (besides the typo pointed out by Daniel)

I stopped worrying about copyright, really. I think we should just stick the same copyright on all files without worrying about years, and only updated it with major releases. Too much hassle to track for individual files.

@@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 2017-2022 by the ArborX authors *
* Copyright (c) 2023 by the ArborX authors *
Copy link
Contributor

Choose a reason for hiding this comment

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

We're in 2024 :)

@aprokop aprokop merged commit 3603868 into arborx:master Apr 11, 2024
1 of 2 checks passed
@aprokop aprokop deleted the benchmark_distance_ball branch April 11, 2024 00:30
@aprokop aprokop mentioned this pull request Apr 11, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants