Re: [eigen] General questions about vectorization/alignment AGAIN |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] General questions about vectorization/alignment AGAIN
- From: Jose Luis Blanco <joseluisblancoc@xxxxxxxxx>
- Date: Mon, 17 Jan 2011 21:53:41 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=NECmpslixtBz9Q+sZycL6OO+XXzotod+O4UShY5l9sU=; b=oPFhFIKSMq0m7LWGxNB4VC7qr0/L1g3zg6yF1JqmfGRUN9IydBwu3gSGajqYbuVY5p W5dMQYQHhN3SXhdMkGAZVWHLM8UI/23ZYyauvwcK2hdmOv8RpuWHsZdRD7tHpE3GC8Sz q8f+jU9GM2lqnFrSMlZnlqHhmy+BDXOnS4oGg=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=tHwxwB4aYi9plsWz9xC62xbdmGV80CjcUhiEYta+vf9LyTBysdurMUVC7N77H2KhjA kXw1+Mv8g7Bc5/oaQZez1lRdsXp33nSE9b80ssw6wwjxUNQQ2LHv6ed/4ql3yz9Qfi4W tJ/PEjMP1CiNL532jpLcyR4ZLQRNf9PgySMro=
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
> http://eigen.tuxfamily.org/dox-devel/TopicUnalignedArrayAssert.html.
> 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: https://wiki.ubuntu.com/DebootstrapChroot
Best,
JL