0

I'm trying to parallelize my code, and I'm using a CGAL's AABB tree for interference detection (pretty neat efficiency btw :) ). No problem on a single machine (I'm not saying it's multi-threaded, but that's another story), but I now want to do several analyses at once, and I'm going to use MPI to spawn my software onto several computers. The obstacle(s) do not change in the different analyses, my AABB tree is thus identical for all children. To minimize the overhead, I'd like to avoid re-reading and re-building my tree, and actually, not even a write file/read file operation.

Through the MPI function's SPAWN, I can give an array of strings to the child, and I'd like to pass the AABB tree along with the other global variables as arguments to skip the reading file part of the overhead.

1st question: That would mean passing something like 1.5MB+ in argv, anything wrong with that?

2nd question: How do I pass the tree? I read something interesting in this thread but it's old, and there is no follow up. Is there anyone who did the serialization in the meantime? Is there any new instruction to do it? Else I'll try to do such a function, at least in my case (ie, Simple_cartesian kernel, Triangle_3 primitives). Any help welcomed :)

luneart
  • 182
  • 1
  • 8
  • About your first question: http://www.in-ulm.de/~mascheck/various/argmax/ – Erbureth Nov 12 '13 at 16:44
  • great! thanks a lot, that is really helpful. and it does show me I've got some margin :) – luneart Nov 13 '13 at 07:08
  • with a more complete reading, I won't try passing the tree as args. I'm just going to try to write the data in a file, and avoid having to re-build the tree. Thank you Erbureth! – luneart Nov 13 '13 at 07:28

1 Answers1

0

Unfortunately, the answer in the thread you quoted is still valid: CGAL does not offer anything to help the serialization of an AABB Tree. What type of primitive do you have in your AABB Tree?

lrineau
  • 6,036
  • 3
  • 34
  • 47
  • I'm using Triangle_3 from Simple_cartesian kernel. I do not use KD-trees as I only need intersections queries. I having a look at AABB_node, AABB_search_tree, the members m_primitives and m_p_root_node as answered in the link. Thank you for your quick answer! – luneart Nov 13 '13 at 11:08
  • You seem to know CGAL inside out, so I'd like you to bear with me a little more :) What are your thoughts on putting AABB_tree.h members "Primitives m_primitives" and "Node* m_p_root_node" to public, and copying the data of m_primitives (as it's a std::vector, memory arrangement is continue) and the data pointed by m_p_root_node (ie, the first AABB) to last AABB into chars (such as this [code] (http://ideone.com/7H8dy) from this [thread] (http://stackoverflow.com/questions/11353642/vector-serialization)). (next comment...) – luneart Nov 13 '13 at 13:56
  • To get the end of that last part, maybe re-enable the copy constructor / assignment operator of AABB_node.h? or I am totally wrong here? – luneart Nov 13 '13 at 14:00
  • No, you are not wrong. But I doubt such a patch can be accepted officially in CGAL. The difficulty is that the AABB tree code does not control the type of the primitives that are stored inside it. – lrineau Nov 14 '13 at 10:42
  • I don't plan on making a patch (at least not right away and in this state). First, I'd compile CGAL with the modification needed, and if it works, make a friend function to copy out or in. Back to the real problem, I re-read the old mail and I forgot the search_tree. But then again, I'd like to copy the data pointed by the member m_p_tree of the class. I understand that AABB_tree does not control or even know the type of the primitives, but does it matter? By copying the Nodes through the data pointed by m_p_root_node of AABB_tree, the AABB_node type is embedded, no? – luneart Nov 14 '13 at 11:32
  • The data attached to an `AABB_node` is not always embedded. When the data set if a `Polyhedron_3`, the primitive can store only pointers to polyhedron facets, instead of storing the facets themselves. – lrineau Nov 14 '13 at 15:33
  • so it is possible, with a special case for indexed traits needing a little more digging? If so, any idea on getting the last AABB and last Node? (there are no size() in those classes as there is in AABB_tree) Same question for special case, getting the last facet pointed? Thanks a lot (especially for your patience!) :) (and as you know CGAL that well you probably are/were from Geometrica? on peut parler francais si tu préfères ;) ) – luneart Nov 14 '13 at 16:08