Re: [eigen] General questions about vectorization/alignment AGAIN

[ Thread Index | Date Index | More Archives ]

Hi there,

> * Is it safe to add an alignment operator, even though the underlying
> datatype is not a "fixed-size vectorizable"?
> E.g.: vector<Vector3d, Eigen::aligned_allocator<Eigen::Vector3d> > Is
> this any dangerous?

Yeap, you can do it without problems. The only side effect might be a
tiny, tiny, tiny slow down in memory allocations, but if you need it
for doing cool templates, I guess it's worth.

> * Is it safe to add EIGEN_MAKE_ALIGNED_OPERATOR_NEW to a class even
> though it does NOT include a "fixed-size vectorizable"?

Yes, it's safe. The worst thing I ever found by adding that macro to
hundreds of other classes was a compile error but was due to a weird
conflict with another smart pointer library...

> * What is the right way to use an std container recursively?
>  - Is this code alright:
>  typedef std::vector<Vector4d,
> Eigen::aligned_allocator<Eigen::Vector4d> >  AlignedVector;
>  std::map<int, AlignedVector> int_vec_map;

Yes, it's OK. If a container has vectorized objects, the container
itself doesn't need to be memory aligned, since most STL containers
reserve dynamic memory. An exception would be boost fixed-size
STL-like arrays, for example, but I can't think of a standard STL
container that allocates in the stack.

> * Is it safe to use a "fixed-size vectorizable" and
> Eigen::aligned_allocator in conjunction with std::tr1::unordered_map?

This one I can't answer for sure (just I'm not familiar with
unordered_map), but like you would bet "yes".

> * It seems like that all issues regarding alignment only occur on
> 32-bit operation systems, right? (Would be nice to add this info to
>  Btw., which is the easiest way to test the code on a 64-bit OS? I
> used virtual box to setup a 32-bit OS. Is there an easier option?)

Take a look at:


Mail converted by MHonArc 2.6.19+