-
Notifications
You must be signed in to change notification settings - Fork 32
Partial change from larger clipping performance work #1736
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
base: feature/gunney/support-for-shaping-branch
Are you sure you want to change the base?
Partial change from larger clipping performance work #1736
Conversation
This WIP change to the mesh clipper code is meant to be more manageable for code review than the large change in the full change set. - Factor out repetitive parts of the code that computes volume contributions from primitive overlap. - Implements screening in TetClipper to improve performance. - Implements the Plane3DClipper, also with screening. - Switches to decomposing a hex into 18 tets instead of 24 tets. This should reduce the work load involving those tets. - Adds a general container for statics needed to evaluate clipping performance. - Adds parameter to control how much screening is done before the expensive clip loop. This is also for evaluating performance. - Fix at least 1 bug.
kennyweiss
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @gunney1 -- nice speedups!
| using PointType = primal::Point<double, NDIMS>; | ||
| using SphereType = primal::Sphere<double, NDIMS>; | ||
|
|
||
| PointType center {0.0, 0.0, 0.0}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also test this on spheres that are not centered at the origin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please document the functions in this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kennyweiss The public methods are implementations that should inherit documentation from the base class methods. Do you mean to explicitly add comments for them?
| /************************************************************ | ||
| * Shared variables. | ||
| ************************************************************/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an example, a tutorial on how to use our code. So perhaps the simplicity of using these global variables outweighs the uneasiness I feel. I'm still not convinced we need globals.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get your uneasiness. The variables are not global, and I am adding static to them to make that clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static doesn't make global variables any better. If you absolutely need something like a global variable, such as for reference, put it in a singleton. We already have one singleton at line 342, Input params.
Arlie-Capps
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really appreciate your work on this, @gunney1 . I found a few typos: there may be more. I'm not convinced the shaping example should use the global variables. Please explain why that's the best way to structure the example, or rewrite it to be more modular. Beyond that, I approve.
Arlie-Capps
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized my review was hasty. I'll spend some more time working on this.
For one thing, static or not, we should not have global variables in the code, even in examples.
|
Brian, I appreciate your hard work, but you need to submit smaller pull requests. I suggest putting the sidre changes in one PR, everything else but the quest changes in a second PR, and then work on breaking the quest changes down further into a series of PRs. That will allow lots of things, including not burning out your reviewers. |
|
@Arlie-Capps I agree 100%. It's OK to slow down and be more careful and rigorous in development and reviews. Reasonably-sized, easily digestible PRs are an important piece of this. |
|
As @Arlie-Capps suggested, I'll take out pieces of this PR to make small reviews. The sidre changes are in #1746 |
|
|
||
| /*! | ||
| * \brief Returns the algebraic volume of the cone | ||
| * \brief Returns the algebraic volume of the cone, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please write "signed volume" instead of "algebraic volume". We say "signed volume" elsewhere (such as in Tetrahedron).
| if(tupleAllocId == INVALID_ALLOCATOR_ID) | ||
| { | ||
| tupleAllocId = ConduitMemory::conduitAllocIdToAxom(dst.allocator()); | ||
| } | ||
| if(arrayAllocId == INVALID_ALLOCATOR_ID) | ||
| { | ||
| arrayAllocId = ConduitMemory::conduitAllocIdToAxom(dst.allocator()); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this necessary? How does it interact with the check and adjustment at (new) line 1503, which seems to do the same thing (or very close)? Unless there's a very strong need, please remove either these lines or the check/adjustment at (new) line 1503. And if you do need both, please add a comment that clearly explains why.
Summary
TetClipperto reduce use of expensive clipping method.PlaneClipper, for clipping the 3D plane geometry. This is now the second geometry supported in the new clipping code.MeshClipperImpl, addressing issue Re-factor MeshClipperImpl::computeClipVolumes3D #1704ShapeMesh, for evaluating performance as we test against diverse sets of configuratios.Not included in this PR: shapes for the sphere, SOR (including cone and cylinder), hex, tet mesh. Further optimizations.
Performance
These are the number of clips used and the clipping time for the 2 shapes in this PR (tet and plane). They came from the same domain, with 3 mesh resolutions: 50^3, 100^3 and 200^3, respectively M50, M100 and M200. There are three levels of screening: L0 is no screening. L1 is screening on the hex cells. L2 is screening on the 18 individual tets in each hex. Values in the L1 and L2 columns are normalized by the L0 column for the same mesh, so they are ratios. Smaller mean more effective screening.