Boost logo

Boost Users :

Subject: Re: [Boost-users] [Pool] Problems using Boost.Pool with the Eigen matrix library
From: lfrfly_at_[hidden]
Date: 2010-10-22 14:59:23


>2010/10/14 <lfrfly_at_[hidden]>:
>> Since Eigen matrices and vectors use SSE and therefore require a
particular
>> alignment, Eigen requires that when these types (specifically, the
>> compile-time sized versions) are within a struct or class, that
struct be
>> given the EIGEN_MAKE_ALIGNED_OPERATOR_NEW macro.
>
>What we do require is that e.g. Vector4f's be created at 16 byte
>aligned locations. EIGEN_MAKE_ALIGNED_OPERATOR_NEW is just one way of
>doing that.
>
>>
>> But here's the problem. What if that struct is allocated by a
>> boost::pool_allocator<T>? Is there any way to enforce alignment then?
>
>That's a question for boost::pool_allocator, not for us; if this
>allocator doesn't give you 16 byte alignment, then you need a
>different allocator (or just modify this allocator to meet this
>criterion).
>
>The allocator is what gives you an address. If it's giving
>non-16-byte-aligned addresses, then it can't be used.
>
>Benoit

It's now clear that this question belongs firmly on the Boost.Pool side
of the fence, so here it is---I'm wondering why boost::pool_allocator
isn't designed to work with a standard-compliant allocator as its
second template parameter?

I tried creating a boost::fast_pool_allocator<T,
Eigen::aligned_allocator<T>>, but this failed with a compile
error----apparently fast_pool_allocator has an unusual notion of what
concept a UserAllocator should satisfy, requiring the methods malloc()
and free(). Why does it not accept any standard allocator, which will
instead provide allocate() and deallocate()? This seems like a serious
shortcoming.

  


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net