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

Memory error in the in/out query #1167

Closed
agcapps opened this issue Aug 17, 2023 · 6 comments
Closed

Memory error in the in/out query #1167

agcapps opened this issue Aug 17, 2023 · 6 comments
Assignees
Labels
bug Something isn't working Quest Issues related to Axom's 'quest' component

Comments

@agcapps
Copy link
Member

agcapps commented Aug 17, 2023

User reports an Umpire error message saying "Cannot find allocator for pointer: ." Here is an excerpt of the stack trace, deepest at top:

~axom::Array
~axom::Polygon
axom::primal::clip
quest::inOutOctree<3>::withinGrayBlock

The crash is in clip.hpp, line 100, when it goes out of scope. I think from the stack allocated poly[2] array (line 54). The poly array entries are passed back to the caller and copied into separate variables. I'm not sure if the m_vertices are being copied correctly. In particular, does the destructor called when clip() goes out-of-scope occur before or after the assignment of the new polygon.

This is a very large problem. The user's code is using the in/out query to process STL files; the error occurs on the second file. That file may not be available for us to troubleshoot.

@agcapps agcapps added bug Something isn't working Quest Issues related to Axom's 'quest' component labels Aug 17, 2023
@kennyweiss
Copy link
Member

Thanks for reporting this @agcapps.

That's not a lot to go on...

  • Presumably, this is a configuration w/ Umpire
  • What's the platform? (e.g. toss3, toss4, blueos, windows, ...?)
  • Also, which compiler are you using? Is there a device compiler as well?
  • It's worth noting that the In/Out has not yet been ported to GPUs, so, hopefully all the allocators you're dealing with are HOST-based (?)

Any chance, the following change helps?

diff --git a/src/axom/primal/operators/clip.hpp b/src/axom/primal/operators/clip.hpp
index b80a08408..d375a7371 100644
--- a/src/axom/primal/operators/clip.hpp
+++ b/src/axom/primal/operators/clip.hpp
@@ -51,9 +51,10 @@ Polygon<T, 3> clip(const Triangle<T, 3>& tri, const BoundingBox<T, 3>& bbox)
 
   // Use two polygons with pointers for 'back-buffer'-like swapping
   const int MAX_VERTS = 6;
-  PolygonType poly[2] = {PolygonType(MAX_VERTS), PolygonType(MAX_VERTS)};
-  PolygonType* currentPoly = &poly[0];
-  PolygonType* prevPoly = &poly[1];
+  PolygonType poly0(MAX_VERTS);
+  PolygonType poly1(MAX_VERTS);
+  PolygonType* currentPoly = &poly0;
+  PolygonType* prevPoly = &poly1;
 
   // First check if the triangle is contained in the bbox, if not we are empty
   BoundingBoxType triBox;

If not, since you mentioned Umpire, would it be possible to rebuild your application with additional Umpire diagnostics enabled?

@agcapps
Copy link
Member Author

agcapps commented Aug 18, 2023

Thanks. You're right; it's not a lot to go on. I'll see if the user can try out the suggestion.

@agcapps
Copy link
Member Author

agcapps commented Aug 18, 2023

Some more details:

  • user has a workaround: setting OMP_NUM_THREADS=1 avoids this particular crash
  • this is on BlueOS; yes, Umpire is present. Not sure if we can get Umpire diags going.
  • host compiler is IBM Clang 14.0.5 with XL 2022.08.19
  • device compiler is nvcc from CUDA 11.7
  • I will see about getting a reproducer

@rhornung67
Copy link
Member

rhornung67 commented Aug 18, 2023

is setting omp num threads to 1 a clue that there may be a memory (or thread safety) isssue in the in-out implementation?

@agcapps agcapps self-assigned this Sep 7, 2023
@agcapps
Copy link
Member Author

agcapps commented Oct 26, 2023

I have been unable to reproduce the crash with the Umpire error message "Cannot find allocator for pointer: ." In the meantime, several fixes (in particular, those upstreamed to us in #1204 ) went in to the copy of Axom. I propose to close this bug, to be reopened if the problem reappears.

@agcapps
Copy link
Member Author

agcapps commented Aug 16, 2024

Closing as can't reproduce.

@agcapps agcapps closed this as not planned Won't fix, can't repro, duplicate, stale Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Quest Issues related to Axom's 'quest' component
Projects
None yet
Development

No branches or pull requests

3 participants