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

Fixed-size vectorizable Eigen matrices in WhiteNoiseAcceleration #66

Open
travek opened this issue May 10, 2019 · 13 comments
Open

Fixed-size vectorizable Eigen matrices in WhiteNoiseAcceleration #66

travek opened this issue May 10, 2019 · 13 comments
Assignees
Labels

Comments

@travek
Copy link

travek commented May 10, 2019

Hi!

I'm using MS VS 2015.
I compiled example from test_UKF and started running it.
On the following line of code from example file:
std::unique_ptr<AdditiveStateModel> wna = utils::make_unique<WhiteNoiseAcceleration>(T, tilde_q);
I got assert error (from Eigen DenseStorage):

EIGEN_DEVICE_FUNC
plain_array() 
{ 
  EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(15);
  check_static_allocation_size<T,Size>();
}

Could you advice how to fix example code quickly?

@claudiofantacci
Copy link
Collaborator

Hi @travek!
Are you compiling 32 or 64 bit?

@travek
Copy link
Author

travek commented May 10, 2019

I tried x86 in MS VS

@claudiofantacci
Copy link
Collaborator

Can you by chance try to compile it for x64 and let us know? Thanks!

@travek
Copy link
Author

travek commented May 11, 2019

@claudiofantacci
It works when compiling in x64. Thanks!

Is it possible to have Eigen works correctly in x86 ? Do you know what needs to be changed ?

@travek
Copy link
Author

travek commented May 11, 2019

@claudiofantacci
I tried with preprocessing options, it works with x86, too
Thanks

@claudiofantacci
Copy link
Collaborator

Hi travek, do you mind giving us details of your findings to have the code compiled under x86? This could be useful to other users as well! Anyway, I’ll add to our pipeline this issue.

@travek
Copy link
Author

travek commented May 11, 2019

I compile with this preprocessing definitions:
EIGEN_DONT_ALIGN_STATICALLY
EIGEN_DONT_VECTORIZE
EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT

@traversaro
Copy link
Member

A small note: if I am not wrong, compiling a library that uses Eigen classes in its public interfaces changes the ABI of the Eigen classes, that means that it may create run-time crashes if the library is used/linked in a compilation unit that uses Eigen and is not compiled with that options.

@travek
Copy link
Author

travek commented May 13, 2019

@claudiofantacci
Copy link
Collaborator

The problem is related to the fixed-size Eigen::Matrix4d matrices in WhiteNoiseAcceleration.h header file. This is, of course, an error and I will fix as soon as possible.
We are undergoing an heavy maintenence on the library and I plan to fix it within the next release.
Thanks for reporting this 👍

@claudiofantacci
Copy link
Collaborator

See this Eigen reference page.

@claudiofantacci claudiofantacci changed the title Issue - failed to run example from test_UKF Fixed-size vectorizable Eigen matrices in WhiteNoiseAcceleration May 13, 2019
@claudiofantacci claudiofantacci self-assigned this May 13, 2019
@claudiofantacci claudiofantacci added this to the 0.9.0 milestone May 13, 2019
@traversaro
Copy link
Member

traversaro commented May 13, 2019

@traversaro
Recommendation is taken from
https://eigen.tuxfamily.org/dox/group__TopicUnalignedArrayAssert.html

Exactly this document explains that defining EIGEN_DONT_ALIGN_STATICALLY: "note that this breaks ABI compatibility with the default behavior of static alignment."
This ABI incompatibility is what causes the run-time crashes in the cases I was describing.

@claudiofantacci
Copy link
Collaborator

claudiofantacci commented May 30, 2019

I changed the implementation of WhiteNoiseAcceleration using the PIMPL pattern and by generalizing it a bit for 1D, 2D and 3D position + velocity state space. You can see the new implementation here. It is still WIP and consequently the implementation may change until it is merged into devel.

@xEnVrE xEnVrE closed this as completed Nov 25, 2020
@xEnVrE xEnVrE reopened this Nov 25, 2020
@xEnVrE xEnVrE removed this from the 0.9.0 milestone Jun 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants