dartsim / dart

DART: Dynamic Animation and Robotics Toolkit
http://dartsim.github.io/
BSD 2-Clause "Simplified" License
898 stars 286 forks source link

SkelParser.cpp eigen issues #413

Closed jturner65 closed 9 years ago

jturner65 commented 9 years ago

The new SkelParser.h file defines 2 stl containers (specifically maps) of structures containing vectorizable Eigen constructs (as does SdfParser.h on lines 77,78). as per this page :

http://eigen.tuxfamily.org/dox/group__TopicStlContainers.html

these maps need to specify alignment allocators.

furthermore, in Joint.h : struct Properties requires EIGEN_MAKE_ALIGNED_OPERATOR_NEW (I'm pretty sure an Isometry3d is vectorizable and so subject to this requirement)

Edit: here's something that is being done in the MRPT to address this kind of thing : http://reference.mrpt.org/svn/aligned__containers_8h_source.html note, this problem is with stl containers of Eigen vectorizable constructs, or -> structs containing them <-, the latter of which is the issue here, i think.

jturner65 commented 9 years ago

Also, i am having an issue with the "return std::make_shared<...>" code. I have found that boost::make_shared will not work with objects requiring alignment, and i think that's the issue here as well. see this thread :

https://forum.kde.org/viewtopic.php?f=74&t=97936

specifically this : "you need to pass this allocator: Eigen::aligned_allocator to allocate_shared(...); "

Edit : more on this : http://eigen.tuxfamily.org/bz/show_bug.cgi?id=795

mxgrey commented 9 years ago

Just out of curiosity, @jturner65 , what platform are you getting these issues on?

We were negligent about explicitly dealing with Eigen's alignment problems, because we thought this was resolved with C++11, but it seems that not all platforms support that part of the standard yet. It looks like Windows is one such culprit.

mkoval commented 9 years ago

@mxgrey I've also seen many more alignment issues on x86 than x86_64.

@jturner65 Are you running 32-bit or 64-bit Windows?

jturner65 commented 9 years ago

i am on windows 7 64, using visual studio 2013 32-bit.

with regard to the alignment issues, i wouldn't think any standard adherence would help this since, as i understand it, Eigen's alignment requirements are related to SIMD optimisations.

mxgrey commented 9 years ago

We haven't been experiencing any alignment-related issues with GCC and Clang, which both have the C++11 alignment support that VS2013 only has "partial" support for.

You can see on this page that according to the Eigen developers, the alignment issues are resolved in C++11:

No, it's not our bug. It's more like an inherent problem of the C++98 language specification, and seems to be taken care of in the upcoming language revision: see this document.

jturner65 commented 9 years ago

cool, thanks for the link - it's good to know that at least some compilers don't have this issue.

mxgrey commented 9 years ago

Hopefully once Microsoft catches up, the whole issue can be a thing of the past. We thought it already was, but I guess we need to get some active Windows developers on the team.

jturner65 commented 9 years ago

i'd love to help :- ) i've been living in dart for a couple years now. i'll help out any way i can.

jturner65 commented 9 years ago

fixed with #414